OGS
VtkFilterFactory.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4// ** INCLUDES **
5#include "VtkFilterFactory.h"
6
7#include <vtkDataSetSurfaceFilter.h>
8
23
24QVector<VtkFilterInfo> VtkFilterFactory::GetFilterList()
25{
26 QVector<VtkFilterInfo> filterList;
27
28 // Composite filters
29 filterList.push_back(VtkFilterInfo("VtkCompositeImageToCylindersFilter",
30 "Image to bar chart",
31 "This filter converts the red pixel "
32 "values of the image into a bar graph.",
33 VTK_IMAGE_DATA, VTK_POLY_DATA));
34
35 filterList.push_back(
36 VtkFilterInfo("VtkCompositePointToGlyphFilter", "Points to spheres",
37 "This filter generates spheres on point data that can be "
38 "scaled and colored by scalar data.",
39 VTK_POLY_DATA, VTK_POLY_DATA));
40
41 filterList.push_back(
42 VtkFilterInfo("VtkCompositeLineToTubeFilter", "Lines to tubes",
43 "This filter will convert lines to tubes that can be "
44 "colored by scalar data.",
45 VTK_POLY_DATA, VTK_POLY_DATA));
46
47 filterList.push_back(VtkFilterInfo(
48 "VtkCompositeColormapToImageFilter", "Apply lookup table to image",
49 "This filter will take an input image of any valid scalar type, and "
50 "map the first component of the image through a lookup table.",
51 VTK_IMAGE_DATA, VTK_IMAGE_DATA));
52
53 filterList.push_back(VtkFilterInfo(
54 "VtkCompositeTextureOnSurfaceFilter", "Apply texture to surface",
55 "This filter assigns an image or raster file as a texture for the "
56 "given surface.",
57 VTK_POINT_SET, VTK_POLY_DATA));
58
59 filterList.push_back(VtkFilterInfo(
60 "VtkCompositeThresholdFilter", "Extract cells by threshold",
61 "This filter extracts cells from any dataset type that satisfy a "
62 "threshold criterion. A cell satisfies the criterion if the (first) "
63 "scalar value of (every or any) point satisfies the criterion. For "
64 "example this can be used to show only certain material groups in a "
65 "mesh.",
66 VTK_POINT_SET, VTK_UNSTRUCTURED_GRID));
67
68 filterList.push_back(VtkFilterInfo(
69 "VtkCompositeColorByHeightFilter", "Elevation-based colouring",
70 "This filter will generate scalar values based on the elevation of "
71 "each point in the dataset.",
72 VTK_POINT_SET, VTK_POLY_DATA));
73
74 filterList.push_back(VtkFilterInfo(
75 "VtkCompositeContourFilter", "Generate contours based on scalar fields",
76 "Visualisation of contour-lines/-planes within dense scalar fields.",
77 VTK_UNSTRUCTURED_GRID, VTK_UNSTRUCTURED_GRID));
78
79 filterList.push_back(VtkFilterInfo(
80 "VtkCompositeImageToPointCloudFilter", "Image to point cloud",
81 "This filter creates a point cloud with a density based on the first "
82 "component of pixel values.",
83 VTK_IMAGE_DATA, VTK_POLY_DATA));
84
85 filterList.push_back(VtkFilterInfo(
86 "VtkCompositeImageToSurfacePointsFilter", "Image to surface points",
87 "This filter creates a point cloud representing a surface based on the "
88 "first component of pixel values.",
89 VTK_IMAGE_DATA, VTK_POLY_DATA));
90
91 // Simple filters
92 filterList.push_back(VtkFilterInfo(
93 "VtkImageDataToLinePolyDataFilter", "Image to vertical lines",
94 "This filter converts the red pixel values of the image to lines with "
95 "length of the value.",
96 VTK_IMAGE_DATA, VTK_POLY_DATA));
97
98 // Standard VTK filter without properties
99 filterList.push_back(VtkFilterInfo("vtkDataSetSurfaceFilter",
100 "Surface filter",
101 "Extracts outer (polygonal) surface.",
102 VTK_UNSTRUCTURED_GRID, VTK_POLY_DATA));
103
104 // filterList.push_back(VtkFilterInfo(
105 // "VtkCompositeSelectionFilter",
106 // "Mesh Quality Filter",
107 // "This filter calculates the quality of meshes and highlights
108 // deformed elements.", VTK_UNSTRUCTURED_GRID,
109 // VTK_UNSTRUCTURED_GRID));
110
111 return filterList;
112}
113
115 QString type, vtkAlgorithm* inputAlgorithm)
116{
117 if (type.compare(QString("VtkCompositeImageToCylindersFilter")) == 0)
118 {
119 return new VtkCompositeImageToCylindersFilter(inputAlgorithm);
120 }
121 if (type.compare(QString("VtkCompositePointToGlyphFilter")) == 0)
122 {
123 return new VtkCompositePointToGlyphFilter(inputAlgorithm);
124 }
125 if (type.compare(QString("VtkCompositeLineToTubeFilter")) == 0)
126 {
127 return new VtkCompositeLineToTubeFilter(inputAlgorithm);
128 }
129 if (type.compare(QString("VtkCompositeColormapToImageFilter")) == 0)
130 {
131 return new VtkCompositeColormapToImageFilter(inputAlgorithm);
132 }
133 if (type.compare(QString("VtkCompositeTextureOnSurfaceFilter")) == 0)
134 {
135 return new VtkCompositeTextureOnSurfaceFilter(inputAlgorithm);
136 }
137 if (type.compare(QString("VtkCompositeThresholdFilter")) == 0)
138 {
139 return new VtkCompositeThresholdFilter(inputAlgorithm);
140 }
141 if (type.compare(QString("VtkCompositeColorByHeightFilter")) == 0)
142 {
143 return new VtkCompositeColorByHeightFilter(inputAlgorithm);
144 }
145 if (type.compare(QString("VtkCompositeElementSelectionFilter")) == 0)
146 {
147 return new VtkCompositeElementSelectionFilter(inputAlgorithm);
148 }
149 if (type.compare(QString("VtkCompositeNodeSelectionFilter")) == 0)
150 {
151 return new VtkCompositeNodeSelectionFilter(inputAlgorithm);
152 }
153 if (type.compare(QString("VtkCompositeContourFilter")) == 0)
154 {
155 return new VtkCompositeContourFilter(inputAlgorithm);
156 }
157 if (type.compare(QString("VtkCompositeGeoObjectFilter")) == 0)
158 {
159 return new VtkCompositeGeoObjectFilter(inputAlgorithm);
160 }
161 if (type.compare(QString("VtkCompositeImageToPointCloudFilter")) == 0)
162 {
163 return new VtkCompositeImageToPointCloudFilter(inputAlgorithm);
164 }
165 if (type.compare(QString("VtkCompositeImageToSurfacePointsFilter")) == 0)
166 {
167 return new VtkCompositeImageToSurfacePointsFilter(inputAlgorithm);
168 }
169
170 return nullptr;
171}
172
173vtkAlgorithm* VtkFilterFactory::CreateSimpleFilter(QString type)
174{
175 if (type.compare(QString("VtkImageDataToLinePolyDataFilter")) == 0)
176 {
178 }
179 if (type.compare(QString("vtkDataSetSurfaceFilter")) == 0)
180 {
181 return vtkDataSetSurfaceFilter::New();
182 }
183
184 return nullptr;
185}
This filter colors the input by the points z-value.
Applies a user adjustable color map to an image.
Visualisation of contour-lines/-planes within dense scalar fields. In init() the threshold is first s...
This filter selects/thresholds elements based on the selected array.
Is used to combine several filter in one VtkVisPipelineItem. You can use vtk filter and custom filter...
Highlights a single GeoObject.
Creates cylinders that stand on top of the image with the length of the corresponding first sub-pixel...
Converts lines to tube-objects.
This filter displays the points/nodes given in the index field as spheres.
Converts point data to scalar-scaled spheres.
Puts a texture on an object (and converts it into a vtkPolyData if necessary).
Visualises only parts of meshes that are above/below/within given thresholds. In init() the threshold...
static QVector< VtkFilterInfo > GetFilterList()
Returns all registered filters. New VtkCompositeFilter or filter inherited from VtkAlgorithmPropertie...
static VtkCompositeFilter * CreateCompositeFilter(QString type, vtkAlgorithm *inputAlgorithm)
Creates a composite filter by name.
static vtkAlgorithm * CreateSimpleFilter(QString type)
Creates a normal filter name.
static VtkImageDataToLinePolyDataFilter * New()
Create new objects with New() because of VTKs reference counting.
Holds meta information about a filter.