VTK  9.2.6
vtkThreshold.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkThreshold.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
43#ifndef vtkThreshold_h
44#define vtkThreshold_h
45
46#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_1_0
47#include "vtkFiltersCoreModule.h" // For export macro
49
50#define VTK_ATTRIBUTE_MODE_DEFAULT 0
51#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
52#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
53
54// order / values are important because of the SetClampMacro
55#define VTK_COMPONENT_MODE_USE_SELECTED 0
56#define VTK_COMPONENT_MODE_USE_ALL 1
57#define VTK_COMPONENT_MODE_USE_ANY 2
58
59class vtkDataArray;
60class vtkIdList;
61
62class VTKFILTERSCORE_EXPORT vtkThreshold : public vtkUnstructuredGridAlgorithm
63{
64public:
65 static vtkThreshold* New();
67 void PrintSelf(ostream& os, vtkIndent indent) override;
68
76 {
77 THRESHOLD_BETWEEN = 0,
79 THRESHOLD_UPPER
80 };
81
83
87 void SetThresholdFunction(int function);
90
94 VTK_DEPRECATED_IN_9_1_0("Use 'SetLowerThreshold' and 'SetThresholdFunction' instead.")
95 void ThresholdByLower(double lower);
96
100 VTK_DEPRECATED_IN_9_1_0("Use 'SetUpperThreshold' and 'SetThresholdFunction' instead.")
101 void ThresholdByUpper(double upper);
102
108 "Use 'SetLowerThreshold', 'SetUpperThreshold' and 'SetThresholdFunction' instead.")
109 void ThresholdBetween(double lower, double upper);
110
112
116 vtkSetMacro(UpperThreshold, double);
117 vtkSetMacro(LowerThreshold, double);
118 vtkGetMacro(UpperThreshold, double);
119 vtkGetMacro(LowerThreshold, double);
121
123
130 vtkSetMacro(AttributeMode, int);
131 vtkGetMacro(AttributeMode, int);
132 void SetAttributeModeToDefault() { this->SetAttributeMode(VTK_ATTRIBUTE_MODE_DEFAULT); }
134 {
135 this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_POINT_DATA);
136 }
140
142
150 vtkSetClampMacro(ComponentMode, int, VTK_COMPONENT_MODE_USE_SELECTED, VTK_COMPONENT_MODE_USE_ANY);
151 vtkGetMacro(ComponentMode, int);
153 void SetComponentModeToUseAll() { this->SetComponentMode(VTK_COMPONENT_MODE_USE_ALL); }
154 void SetComponentModeToUseAny() { this->SetComponentMode(VTK_COMPONENT_MODE_USE_ANY); }
157
159
163 vtkSetClampMacro(SelectedComponent, int, 0, VTK_INT_MAX);
164 vtkGetMacro(SelectedComponent, int);
166
168
174 vtkSetMacro(AllScalars, vtkTypeBool);
175 vtkGetMacro(AllScalars, vtkTypeBool);
176 vtkBooleanMacro(AllScalars, vtkTypeBool);
178
180
188 vtkSetMacro(UseContinuousCellRange, vtkTypeBool);
189 vtkGetMacro(UseContinuousCellRange, vtkTypeBool);
190 vtkBooleanMacro(UseContinuousCellRange, vtkTypeBool);
192
194
201 void SetPointsDataTypeToDouble() { this->SetPointsDataType(VTK_DOUBLE); }
202 void SetPointsDataTypeToFloat() { this->SetPointsDataType(VTK_FLOAT); }
203 void SetPointsDataType(int type);
206
208
213 vtkSetMacro(Invert, bool);
214 vtkGetMacro(Invert, bool);
215 vtkBooleanMacro(Invert, bool);
217
219
224 void SetOutputPointsPrecision(int precision);
227
229
242 int Lower(double s) const;
243 int Upper(double s) const;
244 int Between(double s) const;
246protected:
248 ~vtkThreshold() override;
249
250 // Usual data generation method
252
253 int FillInputPortInformation(int port, vtkInformation* info) override;
254
257 vtkTypeBool AllScalars = 1;
258 vtkTypeBool UseContinuousCellRange = 0;
259 bool Invert = false;
260 int AttributeMode = -1;
262 int SelectedComponent = 0;
263 int OutputPointsPrecision = DEFAULT_PRECISION;
264
265 int (vtkThreshold::*ThresholdFunction)(double s) const = &vtkThreshold::Between;
266
268 int EvaluateCell(vtkDataArray* scalars, vtkIdList* cellPts, int numCellPts);
269 int EvaluateCell(vtkDataArray* scalars, int c, vtkIdList* cellPts, int numCellPts);
270
271private:
272 vtkThreshold(const vtkThreshold&) = delete;
273 void operator=(const vtkThreshold&) = delete;
274};
275
276#endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:56
list of point or cell ids
Definition: vtkIdList.h:34
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
extracts cells where scalar value in cell satisfies threshold criterion
Definition: vtkThreshold.h:63
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int EvaluateCell(vtkDataArray *scalars, vtkIdList *cellPts, int numCellPts)
void SetAttributeModeToUsePointData()
Control how the filter works with scalar point data and cell attribute data.
Definition: vtkThreshold.h:133
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.
Definition: vtkThreshold.h:152
void SetComponentModeToUseAny()
Control how the decision of in / out is made with multi-component data.
Definition: vtkThreshold.h:154
ThresholdType
Possible values for the threshold function:
Definition: vtkThreshold.h:76
void SetComponentModeToUseAll()
Control how the decision of in / out is made with multi-component data.
Definition: vtkThreshold.h:153
int GetOutputPointsPrecision() const
Set/get the desired precision for the output types.
double LowerThreshold
Definition: vtkThreshold.h:255
void SetPointsDataTypeToDouble()
Set the data type of the output points (See the data types defined in vtkType.h).
Definition: vtkThreshold.h:201
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.
Definition: vtkThreshold.h:137
int EvaluateComponents(vtkDataArray *scalars, vtkIdType id)
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).
Definition: vtkThreshold.h:202
double UpperThreshold
Definition: vtkThreshold.h:256
void SetOutputPointsPrecision(int precision)
Set/get the desired precision for the output types.
int Upper(double s) const
Methods used for thresholding.
~vtkThreshold() override
int Between(double s) const
Methods used for thresholding.
int EvaluateCell(vtkDataArray *scalars, int c, vtkIdList *cellPts, int numCellPts)
int Lower(double s) const
Methods used for thresholding.
int GetThresholdFunction()
Get/Set the threshold method, defining which threshold bounds to use.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
const char * GetAttributeModeAsString()
Control how the filter works with scalar point data and cell attribute data.
static vtkThreshold * New()
Superclass for algorithms that produce only unstructured grid as output.
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_DEPRECATED_IN_9_1_0(reason)
#define VTK_COMPONENT_MODE_USE_SELECTED
Definition: vtkThreshold.h:55
#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA
Definition: vtkThreshold.h:51
#define VTK_ATTRIBUTE_MODE_DEFAULT
Definition: vtkThreshold.h:50
#define VTK_COMPONENT_MODE_USE_ALL
Definition: vtkThreshold.h:56
#define VTK_COMPONENT_MODE_USE_ANY
Definition: vtkThreshold.h:57
#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA
Definition: vtkThreshold.h:52
int vtkIdType
Definition: vtkType.h:332
#define VTK_DOUBLE
Definition: vtkType.h:55
#define VTK_FLOAT
Definition: vtkType.h:54
#define VTK_INT_MAX
Definition: vtkType.h:155