VTK  9.1.0
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=========================================================================*/
46#ifndef vtkThreshold_h
47#define vtkThreshold_h
48
49#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_1_0
50#include "vtkFiltersCoreModule.h" // For export macro
52
53#define VTK_ATTRIBUTE_MODE_DEFAULT 0
54#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
55#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
56
57// order / values are important because of the SetClampMacro
58#define VTK_COMPONENT_MODE_USE_SELECTED 0
59#define VTK_COMPONENT_MODE_USE_ALL 1
60#define VTK_COMPONENT_MODE_USE_ANY 2
61
62class vtkDataArray;
63class vtkIdList;
64
65class VTKFILTERSCORE_EXPORT vtkThreshold : public vtkUnstructuredGridAlgorithm
66{
67public:
68 static vtkThreshold* New();
70 void PrintSelf(ostream& os, vtkIndent indent) override;
71
79 {
80 THRESHOLD_BETWEEN = 0,
82 THRESHOLD_UPPER
83 };
84
86
90 void SetThresholdFunction(int function);
93
97 VTK_DEPRECATED_IN_9_1_0("Use 'SetLowerThreshold' and 'SetThresholdFunction' instead.")
98 void ThresholdByLower(double lower);
99
103 VTK_DEPRECATED_IN_9_1_0("Use 'SetUpperThreshold' and 'SetThresholdFunction' instead.")
104 void ThresholdByUpper(double upper);
105
111 "Use 'SetLowerThreshold', 'SetUpperThreshold' and 'SetThresholdFunction' instead.")
112 void ThresholdBetween(double lower, double upper);
113
115
119 vtkSetMacro(UpperThreshold, double);
120 vtkSetMacro(LowerThreshold, double);
121 vtkGetMacro(UpperThreshold, double);
122 vtkGetMacro(LowerThreshold, double);
124
126
133 vtkSetMacro(AttributeMode, int);
134 vtkGetMacro(AttributeMode, int);
135 void SetAttributeModeToDefault() { this->SetAttributeMode(VTK_ATTRIBUTE_MODE_DEFAULT); }
137 {
138 this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_POINT_DATA);
139 }
143
145
153 vtkSetClampMacro(ComponentMode, int, VTK_COMPONENT_MODE_USE_SELECTED, VTK_COMPONENT_MODE_USE_ANY);
154 vtkGetMacro(ComponentMode, int);
156 void SetComponentModeToUseAll() { this->SetComponentMode(VTK_COMPONENT_MODE_USE_ALL); }
157 void SetComponentModeToUseAny() { this->SetComponentMode(VTK_COMPONENT_MODE_USE_ANY); }
160
162
166 vtkSetClampMacro(SelectedComponent, int, 0, VTK_INT_MAX);
167 vtkGetMacro(SelectedComponent, int);
169
171
177 vtkSetMacro(AllScalars, vtkTypeBool);
178 vtkGetMacro(AllScalars, vtkTypeBool);
179 vtkBooleanMacro(AllScalars, vtkTypeBool);
181
183
191 vtkSetMacro(UseContinuousCellRange, vtkTypeBool);
192 vtkGetMacro(UseContinuousCellRange, vtkTypeBool);
193 vtkBooleanMacro(UseContinuousCellRange, vtkTypeBool);
195
197
204 void SetPointsDataTypeToDouble() { this->SetPointsDataType(VTK_DOUBLE); }
205 void SetPointsDataTypeToFloat() { this->SetPointsDataType(VTK_FLOAT); }
206 void SetPointsDataType(int type);
209
211
216 vtkSetMacro(Invert, bool);
217 vtkGetMacro(Invert, bool);
218 vtkBooleanMacro(Invert, bool);
220
222
227 void SetOutputPointsPrecision(int precision);
230
232
245 int Lower(double s) const;
246 int Upper(double s) const;
247 int Between(double s) const;
249protected:
251 ~vtkThreshold() override;
252
253 // Usual data generation method
255
256 int FillInputPortInformation(int port, vtkInformation* info) override;
257
260 vtkTypeBool AllScalars = 1;
261 vtkTypeBool UseContinuousCellRange = 0;
262 bool Invert = false;
263 int AttributeMode = -1;
265 int SelectedComponent = 0;
266 int OutputPointsPrecision = DEFAULT_PRECISION;
267
268 int (vtkThreshold::*ThresholdFunction)(double s) const = &vtkThreshold::Between;
269
271 int EvaluateCell(vtkDataArray* scalars, vtkIdList* cellPts, int numCellPts);
272 int EvaluateCell(vtkDataArray* scalars, int c, vtkIdList* cellPts, int numCellPts);
273
274private:
275 vtkThreshold(const vtkThreshold&) = delete;
276 void operator=(const vtkThreshold&) = delete;
277};
278
279#endif
abstract superclass for arrays of numeric data
list of point or cell ids
Definition vtkIdList.h:40
a simple class to control print indentation
Definition vtkIndent.h:43
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.
int EvaluateCell(vtkDataArray *scalars, vtkIdList *cellPts, int numCellPts)
void SetAttributeModeToUsePointData()
Control how the filter works with scalar point data and cell attribute data.
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.
int GetOutputPointsPrecision() const
Set/get the desired precision for the output types.
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 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).
double UpperThreshold
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
#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA
#define VTK_ATTRIBUTE_MODE_DEFAULT
#define VTK_COMPONENT_MODE_USE_ALL
#define VTK_COMPONENT_MODE_USE_ANY
#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA
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