VTK  9.4.20251007
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
41#ifndef vtkThreshold_h
42#define vtkThreshold_h
43
44#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_3_0
45#include "vtkFiltersCoreModule.h" // For export macro
47
48#define VTK_ATTRIBUTE_MODE_DEFAULT 0
49#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
50#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
51
52// order / values are important because of the SetClampMacro
53#define VTK_COMPONENT_MODE_USE_SELECTED 0
54#define VTK_COMPONENT_MODE_USE_ALL 1
55#define VTK_COMPONENT_MODE_USE_ANY 2
56
57VTK_ABI_NAMESPACE_BEGIN
58class vtkDataArray;
59class vtkIdList;
60
61class VTKFILTERSCORE_EXPORT vtkThreshold : public vtkUnstructuredGridAlgorithm
62{
63public:
64 static vtkThreshold* New();
66 void PrintSelf(ostream& os, vtkIndent indent) override;
67
80
82
86 void SetThresholdFunction(int function);
89
91
95 vtkSetMacro(UpperThreshold, double);
96 vtkSetMacro(LowerThreshold, double);
97 vtkGetMacro(UpperThreshold, double);
98 vtkGetMacro(LowerThreshold, double);
100
102
109 VTK_DEPRECATED_IN_9_3_0("Please use SetInputArrayToProcess instead.")
110 vtkSetMacro(AttributeMode, int);
111
112 VTK_DEPRECATED_IN_9_3_0("This method is deprecated.")
113 vtkGetMacro(AttributeMode, int);
114
115 VTK_DEPRECATED_IN_9_3_0("Please use SetInputArrayToProcess instead.")
117
118 VTK_DEPRECATED_IN_9_3_0("Please use SetInputArrayToProcess instead.")
120
121 VTK_DEPRECATED_IN_9_3_0("Please use SetInputArrayToProcess instead.")
123
124 VTK_DEPRECATED_IN_9_3_0("This method is deprecated.")
127
129
138 vtkGetMacro(ComponentMode, int);
144
146
152 vtkSetClampMacro(SelectedComponent, int, 0, VTK_INT_MAX);
153 vtkGetMacro(SelectedComponent, int);
155
157
163 vtkSetMacro(AllScalars, vtkTypeBool);
164 vtkGetMacro(AllScalars, vtkTypeBool);
165 vtkBooleanMacro(AllScalars, vtkTypeBool);
167
169
181
183
190 VTK_DEPRECATED_IN_9_3_0("Please use SetOutputPointsPrecision instead.")
192
193 VTK_DEPRECATED_IN_9_3_0("Please use SetOutputPointsPrecision instead.")
195
196 VTK_DEPRECATED_IN_9_3_0("Please use SetOutputPointsPrecision instead.")
197 void SetPointsDataType(int type);
198
199 VTK_DEPRECATED_IN_9_3_0("Please use GetOutputPointsPrecision instead.")
202
204
209 vtkSetMacro(Invert, bool);
210 vtkGetMacro(Invert, bool);
211 vtkBooleanMacro(Invert, bool);
213
215
220 vtkSetMacro(OutputPointsPrecision, int);
221 vtkGetMacro(OutputPointsPrecision, int);
223
225
238 int Lower(double s) const;
239 int Upper(double s) const;
240 int Between(double s) const;
242protected:
244 ~vtkThreshold() override;
245
246 // Usual data generation method
248
249 int FillInputPortInformation(int port, vtkInformation* info) override;
250
255 bool Invert = false;
260
262
263 template <typename TScalarArray>
265 struct EvaluateCellsWorker;
266
267 template <typename TScalarsArray>
268 int EvaluateComponents(TScalarsArray& scalars, vtkIdType id);
269 template <typename TScalarsArray>
270 int EvaluateCell(TScalarsArray& scalars, const vtkIdType* cellPts, vtkIdType numCellPts);
271 template <typename TScalarsArray>
272 int EvaluateCell(TScalarsArray& scalars, int c, const vtkIdType* cellPts, vtkIdType numCellPts);
273
274private:
280 template <typename TScalarsArray>
281 bool ComputeMagnitude(double& magnitude, const TScalarsArray& scalars, vtkIdType id);
282
283 vtkThreshold(const vtkThreshold&) = delete;
284 void operator=(const vtkThreshold&) = delete;
285
286 int NumberOfComponents;
287};
288
289VTK_ABI_NAMESPACE_END
290#endif
list of point or cell ids
Definition vtkIdList.h:24
a simple class to control print indentation
Definition vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
int(vtkThreshold::* ThresholdFunction)(double s) const
virtual void SetComponentMode(int)
Control how the decision of in / out is made with multi-component data.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTypeBool AllScalars
void SetAttributeModeToUsePointData()
Control how the filter works with scalar point data and cell attribute data.
int EvaluateCell(TScalarsArray &scalars, const vtkIdType *cellPts, vtkIdType numCellPts)
void SetPointsDataType(int type)
Set the data type of the output points (See the data types defined in vtkType.h).
void SetThresholdFunction(int function)
Get/Set the threshold method, defining which threshold bounds to use.
void SetComponentModeToUseSelected()
Control how the decision of in / out is made with multi-component data.
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.
double LowerThreshold
void SetPointsDataTypeToDouble()
Set the data type of the output points (See the data types defined in vtkType.h).
const char * GetComponentModeAsString()
Control how the decision of in / out is made with multi-component data.
void SetAttributeModeToUseCellData()
Control how the filter works with scalar point data and cell attribute data.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
int GetPointsDataType()
Set the data type of the output points (See the data types defined in vtkType.h).
void SetPointsDataTypeToFloat()
Set the data type of the output points (See the data types defined in vtkType.h).
int EvaluateComponents(TScalarsArray &scalars, vtkIdType id)
double UpperThreshold
void SetAttributeModeToDefault()
Control how the filter works with scalar point data and cell attribute data.
int Upper(double s) const
Methods used for thresholding.
int Between(double s) const
Methods used for thresholding.
int Lower(double s) const
Methods used for thresholding.
int GetThresholdFunction()
Get/Set the threshold method, defining which threshold bounds to use.
vtkTypeBool UseContinuousCellRange
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
int OutputPointsPrecision
const char * GetAttributeModeAsString()
Control how the filter works with scalar point data and cell attribute data.
static vtkThreshold * New()
int vtkTypeBool
Definition vtkABI.h:64
#define vtkDataArray
#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