VTK: Filters/Core/vtkThreshold.h Source File

| VTK 9.3.1

vtkThreshold.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
49 #ifndef vtkThreshold_h
50 #define vtkThreshold_h
51
52 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_3_0
53 #include "vtkFiltersCoreModule.h" // For export macro
54 #include "vtkUnstructuredGridAlgorithm.h"
55
56 #define VTK_ATTRIBUTE_MODE_DEFAULT 0
57 #define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
58 #define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
59
60 // order / values are important because of the SetClampMacro
61 #define VTK_COMPONENT_MODE_USE_SELECTED 0
62 #define VTK_COMPONENT_MODE_USE_ALL 1
63 #define VTK_COMPONENT_MODE_USE_ANY 2
64
65 VTK_ABI_NAMESPACE_BEGIN
66 class vtkDataArray;
67 class vtkIdList;
68
69 class VTKFILTERSCORE_EXPORT vtkThreshold : public vtkUnstructuredGridAlgorithm
70 {
71 public:
72 static vtkThreshold* New();
73 vtkTypeMacro(vtkThreshold, vtkUnstructuredGridAlgorithm);
74 void PrintSelf(ostream& os, vtkIndent indent) override;
75
82 enum ThresholdType
83 {
84 THRESHOLD_BETWEEN = 0,
85 THRESHOLD_LOWER,
86 THRESHOLD_UPPER
87 };
88
90
94 void SetThresholdFunction(int function);
95 int GetThresholdFunction();
97
99
103 vtkSetMacro(UpperThreshold, double);
104 vtkSetMacro(LowerThreshold, double);
105 vtkGetMacro(UpperThreshold, double);
106 vtkGetMacro(LowerThreshold, double);
108
110
117 VTK_DEPRECATED_IN_9_3_0("Please use SetInputArrayToProcess instead.")
118 vtkSetMacro(AttributeMode, int);
119
120 VTK_DEPRECATED_IN_9_3_0("This method is deprecated.")
121 vtkGetMacro(AttributeMode, int);
122
123 VTK_DEPRECATED_IN_9_3_0("Please use SetInputArrayToProcess instead.")
124 void SetAttributeModeToDefault();
125
126 VTK_DEPRECATED_IN_9_3_0("Please use SetInputArrayToProcess instead.")
127 void SetAttributeModeToUsePointData();
128
129 VTK_DEPRECATED_IN_9_3_0("Please use SetInputArrayToProcess instead.")
130 void SetAttributeModeToUseCellData();
131
132 VTK_DEPRECATED_IN_9_3_0("This method is deprecated.")
133 const char* GetAttributeModeAsString();
135
137
145 vtkSetClampMacro(ComponentMode, int, VTK_COMPONENT_MODE_USE_SELECTED, VTK_COMPONENT_MODE_USE_ANY);
146 vtkGetMacro(ComponentMode, int);
147 void SetComponentModeToUseSelected() { this->SetComponentMode(VTK_COMPONENT_MODE_USE_SELECTED); }
148 void SetComponentModeToUseAll() { this->SetComponentMode(VTK_COMPONENT_MODE_USE_ALL); }
149 void SetComponentModeToUseAny() { this->SetComponentMode(VTK_COMPONENT_MODE_USE_ANY); }
150 const char* GetComponentModeAsString();
152
154
158 vtkSetClampMacro(SelectedComponent, int, 0, VTK_INT_MAX);
159 vtkGetMacro(SelectedComponent, int);
161
163
169 vtkSetMacro(AllScalars, vtkTypeBool);
170 vtkGetMacro(AllScalars, vtkTypeBool);
171 vtkBooleanMacro(AllScalars, vtkTypeBool);
173
175
183 vtkSetMacro(UseContinuousCellRange, vtkTypeBool);
184 vtkGetMacro(UseContinuousCellRange, vtkTypeBool);
185 vtkBooleanMacro(UseContinuousCellRange, vtkTypeBool);
187
189
196 VTK_DEPRECATED_IN_9_3_0("Please use SetOutputPointsPrecision instead.")
197 void SetPointsDataTypeToDouble();
198
199 VTK_DEPRECATED_IN_9_3_0("Please use SetOutputPointsPrecision instead.")
200 void SetPointsDataTypeToFloat();
201
202 VTK_DEPRECATED_IN_9_3_0("Please use SetOutputPointsPrecision instead.")
203 void SetPointsDataType(int type);
204
205 VTK_DEPRECATED_IN_9_3_0("Please use GetOutputPointsPrecision instead.")
206 int GetPointsDataType();
208
210
215 vtkSetMacro(Invert, bool);
216 vtkGetMacro(Invert, bool);
217 vtkBooleanMacro(Invert, bool);
219
221
226 vtkSetMacro(OutputPointsPrecision, int);
227 vtkGetMacro(OutputPointsPrecision, int);
229
231
244 int Lower(double s) const;
245 int Upper(double s) const;
246 int Between(double s) const;
248 protected:
249 vtkThreshold();
250 ~vtkThreshold() override;
251
252 // Usual data generation method
253 int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
254
255 int FillInputPortInformation(int port, vtkInformation* info) override;
256
257 double LowerThreshold;
258 double UpperThreshold;
259 vtkTypeBool AllScalars = 1;
260 vtkTypeBool UseContinuousCellRange = 0;
261 bool Invert = false;
262 int AttributeMode = -1;
263 int ComponentMode = VTK_COMPONENT_MODE_USE_SELECTED;
264 int SelectedComponent = 0;
265 int OutputPointsPrecision = DEFAULT_PRECISION;
266
267 int (vtkThreshold::*ThresholdFunction)(double s) const = &vtkThreshold::Between;
268
269 template <typename TScalarArray>
270 struct EvaluateCellsFunctor;
271 struct EvaluateCellsWorker;
272
273 template <typename TScalarsArray>
274 int EvaluateComponents(TScalarsArray& scalars, vtkIdType id);
275 template <typename TScalarsArray>
276 int EvaluateCell(TScalarsArray& scalars, const vtkIdType* cellPts, vtkIdType numCellPts);
277 template <typename TScalarsArray>
278 int EvaluateCell(TScalarsArray& scalars, int c, const vtkIdType* cellPts, vtkIdType numCellPts);
279
280 private:
281 vtkThreshold(const vtkThreshold&) = delete;
282 void operator=(const vtkThreshold&) = delete;
283
284 int NumberOfComponents;
285 };
286
287 VTK_ABI_NAMESPACE_END
288 #endif
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:32
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:40
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:72
vtkThreshold
extracts cells where scalar value in cell satisfies threshold criterion
Definition: vtkThreshold.h:70
vtkThreshold::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkThreshold::GetComponentModeAsString
const char * GetComponentModeAsString()
Control how the decision of in / out is made with multi-component data.
vtkThreshold::SetThresholdFunction
void SetThresholdFunction(int function)
Get/Set the threshold method, defining which threshold bounds to use.
vtkThreshold::SetComponentModeToUseAny
void SetComponentModeToUseAny()
Control how the decision of in / out is made with multi-component data.
Definition: vtkThreshold.h:149
vtkThreshold::ThresholdType
ThresholdType
Possible values for the threshold function:
Definition: vtkThreshold.h:83
vtkThreshold::THRESHOLD_LOWER
@ THRESHOLD_LOWER
Definition: vtkThreshold.h:85
vtkThreshold::SetComponentModeToUseAll
void SetComponentModeToUseAll()
Control how the decision of in / out is made with multi-component data.
Definition: vtkThreshold.h:148
vtkThreshold::New
static vtkThreshold * New()
vtkThreshold::GetThresholdFunction
int GetThresholdFunction()
Get/Set the threshold method, defining which threshold bounds to use.
vtkUnstructuredGridAlgorithm
Superclass for algorithms that produce only unstructured grid as output.
Definition: vtkUnstructuredGridAlgorithm.h:30
vtkX3D::info
@ info
Definition: vtkX3D.h:376
vtkX3D::port
@ port
Definition: vtkX3D.h:447
vtkX3D::type
@ type
Definition: vtkX3D.h:516
vtkThreshold::EvaluateCellsFunctor
Definition: vtkThreshold.h:270
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:64
vtkDeprecation.h
VTK_DEPRECATED_IN_9_3_0
#define VTK_DEPRECATED_IN_9_3_0(reason)
Definition: vtkDeprecation.h:99
VTK_COMPONENT_MODE_USE_SELECTED
#define VTK_COMPONENT_MODE_USE_SELECTED
Definition: vtkThreshold.h:61
VTK_COMPONENT_MODE_USE_ALL
#define VTK_COMPONENT_MODE_USE_ALL
Definition: vtkThreshold.h:62
VTK_COMPONENT_MODE_USE_ANY
#define VTK_COMPONENT_MODE_USE_ANY
Definition: vtkThreshold.h:63
vtkIdType
int vtkIdType
Definition: vtkType.h:315
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:144
vtkUnstructuredGridAlgorithm.h