VTK  9.3.0
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
40#ifndef vtkThreshold_h
41#define vtkThreshold_h
42
43#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_3_0
44#include "vtkFiltersCoreModule.h" // For export macro
46
47#define VTK_ATTRIBUTE_MODE_DEFAULT 0
48#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
49#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
50
51// order / values are important because of the SetClampMacro
52#define VTK_COMPONENT_MODE_USE_SELECTED 0
53#define VTK_COMPONENT_MODE_USE_ALL 1
54#define VTK_COMPONENT_MODE_USE_ANY 2
55
56VTK_ABI_NAMESPACE_BEGIN
57class vtkDataArray;
58class vtkIdList;
59
60class VTKFILTERSCORE_EXPORT vtkThreshold : public vtkUnstructuredGridAlgorithm
61{
62public:
63 static vtkThreshold* New();
65 void PrintSelf(ostream& os, vtkIndent indent) override;
66
74 {
75 THRESHOLD_BETWEEN = 0,
77 THRESHOLD_UPPER
78 };
79
81
85 void SetThresholdFunction(int function);
88
90
94 vtkSetMacro(UpperThreshold, double);
95 vtkSetMacro(LowerThreshold, double);
96 vtkGetMacro(UpperThreshold, double);
97 vtkGetMacro(LowerThreshold, double);
99
101
108 VTK_DEPRECATED_IN_9_3_0("Please use SetInputArrayToProcess instead.")
109 vtkSetMacro(AttributeMode, int);
110
111 VTK_DEPRECATED_IN_9_3_0("This method is deprecated.")
112 vtkGetMacro(AttributeMode, int);
113
114 VTK_DEPRECATED_IN_9_3_0("Please use SetInputArrayToProcess instead.")
115 void SetAttributeModeToDefault();
116
117 VTK_DEPRECATED_IN_9_3_0("Please use SetInputArrayToProcess instead.")
118 void SetAttributeModeToUsePointData();
119
120 VTK_DEPRECATED_IN_9_3_0("Please use SetInputArrayToProcess instead.")
121 void SetAttributeModeToUseCellData();
122
123 VTK_DEPRECATED_IN_9_3_0("This method is deprecated.")
124 const char* GetAttributeModeAsString();
126
128
136 vtkSetClampMacro(ComponentMode, int, VTK_COMPONENT_MODE_USE_SELECTED, VTK_COMPONENT_MODE_USE_ANY);
137 vtkGetMacro(ComponentMode, int);
138 void SetComponentModeToUseSelected() { this->SetComponentMode(VTK_COMPONENT_MODE_USE_SELECTED); }
139 void SetComponentModeToUseAll() { this->SetComponentMode(VTK_COMPONENT_MODE_USE_ALL); }
140 void SetComponentModeToUseAny() { this->SetComponentMode(VTK_COMPONENT_MODE_USE_ANY); }
143
145
149 vtkSetClampMacro(SelectedComponent, int, 0, VTK_INT_MAX);
150 vtkGetMacro(SelectedComponent, int);
152
154
160 vtkSetMacro(AllScalars, vtkTypeBool);
161 vtkGetMacro(AllScalars, vtkTypeBool);
162 vtkBooleanMacro(AllScalars, vtkTypeBool);
164
166
174 vtkSetMacro(UseContinuousCellRange, vtkTypeBool);
175 vtkGetMacro(UseContinuousCellRange, vtkTypeBool);
176 vtkBooleanMacro(UseContinuousCellRange, vtkTypeBool);
178
180
187 VTK_DEPRECATED_IN_9_3_0("Please use SetOutputPointsPrecision instead.")
188 void SetPointsDataTypeToDouble();
189
190 VTK_DEPRECATED_IN_9_3_0("Please use SetOutputPointsPrecision instead.")
191 void SetPointsDataTypeToFloat();
192
193 VTK_DEPRECATED_IN_9_3_0("Please use SetOutputPointsPrecision instead.")
194 void SetPointsDataType(int type);
195
196 VTK_DEPRECATED_IN_9_3_0("Please use GetOutputPointsPrecision instead.")
197 int GetPointsDataType();
199
201
206 vtkSetMacro(Invert, bool);
207 vtkGetMacro(Invert, bool);
208 vtkBooleanMacro(Invert, bool);
210
212
217 vtkSetMacro(OutputPointsPrecision, int);
218 vtkGetMacro(OutputPointsPrecision, int);
220
222
235 int Lower(double s) const;
236 int Upper(double s) const;
237 int Between(double s) const;
239protected:
241 ~vtkThreshold() override;
242
243 // Usual data generation method
245
246 int FillInputPortInformation(int port, vtkInformation* info) override;
247
248 double LowerThreshold;
249 double UpperThreshold;
250 vtkTypeBool AllScalars = 1;
251 vtkTypeBool UseContinuousCellRange = 0;
252 bool Invert = false;
253 int AttributeMode = -1;
255 int SelectedComponent = 0;
256 int OutputPointsPrecision = DEFAULT_PRECISION;
257
258 int (vtkThreshold::*ThresholdFunction)(double s) const = &vtkThreshold::Between;
259
260 template <typename TScalarArray>
262 struct EvaluateCellsWorker;
263
264 template <typename TScalarsArray>
265 int EvaluateComponents(TScalarsArray& scalars, vtkIdType id);
266 template <typename TScalarsArray>
267 int EvaluateCell(TScalarsArray& scalars, const vtkIdType* cellPts, vtkIdType numCellPts);
268 template <typename TScalarsArray>
269 int EvaluateCell(TScalarsArray& scalars, int c, const vtkIdType* cellPts, vtkIdType numCellPts);
270
271private:
272 vtkThreshold(const vtkThreshold&) = delete;
273 void operator=(const vtkThreshold&) = delete;
274
275 int NumberOfComponents;
276};
277
278VTK_ABI_NAMESPACE_END
279#endif
abstract superclass for arrays of numeric data
list of point or cell ids
Definition vtkIdList.h:23
a simple class to control print indentation
Definition vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
extracts cells where scalar value in cell satisfies threshold criterion
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetThresholdFunction(int function)
Get/Set the threshold method, defining which threshold bounds to use.
void SetComponentModeToUseAny()
Control how the decision of in / out is made with multi-component data.
ThresholdType
Possible values for the threshold function:
void SetComponentModeToUseAll()
Control how the decision of in / out is made with multi-component data.
const char * GetComponentModeAsString()
Control how the decision of in / out is made with multi-component data.
int GetThresholdFunction()
Get/Set the threshold method, defining which threshold bounds to use.
static vtkThreshold * New()
Superclass for algorithms that produce only unstructured grid as output.
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_DEPRECATED_IN_9_3_0(reason)
#define VTK_COMPONENT_MODE_USE_SELECTED
#define VTK_COMPONENT_MODE_USE_ALL
#define VTK_COMPONENT_MODE_USE_ANY
int vtkIdType
Definition vtkType.h:315
#define VTK_INT_MAX
Definition vtkType.h:144