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 =========================================================================*/
52 #ifndef vtkThreshold_h
53 #define vtkThreshold_h
54 
55 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_1_0
56 #include "vtkFiltersCoreModule.h" // For export macro
58 
59 #define VTK_ATTRIBUTE_MODE_DEFAULT 0
60 #define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
61 #define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
62 
63 // order / values are important because of the SetClampMacro
64 #define VTK_COMPONENT_MODE_USE_SELECTED 0
65 #define VTK_COMPONENT_MODE_USE_ALL 1
66 #define VTK_COMPONENT_MODE_USE_ANY 2
67 
68 class vtkDataArray;
69 class vtkIdList;
70 
71 class VTKFILTERSCORE_EXPORT vtkThreshold : public vtkUnstructuredGridAlgorithm
72 {
73 public:
74  static vtkThreshold* New();
76  void PrintSelf(ostream& os, vtkIndent indent) override;
77 
85  {
86  THRESHOLD_BETWEEN = 0,
88  THRESHOLD_UPPER
89  };
90 
92 
96  void SetThresholdFunction(int function);
99 
103  VTK_DEPRECATED_IN_9_1_0("Use 'SetLowerThreshold' and 'SetThresholdFunction' instead.")
104  void ThresholdByLower(double lower);
105 
109  VTK_DEPRECATED_IN_9_1_0("Use 'SetUpperThreshold' and 'SetThresholdFunction' instead.")
110  void ThresholdByUpper(double upper);
111 
117  "Use 'SetLowerThreshold', 'SetUpperThreshold' and 'SetThresholdFunction' instead.")
118  void ThresholdBetween(double lower, double upper);
119 
121 
125  vtkSetMacro(UpperThreshold, double);
126  vtkSetMacro(LowerThreshold, double);
127  vtkGetMacro(UpperThreshold, double);
128  vtkGetMacro(LowerThreshold, double);
130 
132 
139  vtkSetMacro(AttributeMode, int);
140  vtkGetMacro(AttributeMode, int);
141  void SetAttributeModeToDefault() { this->SetAttributeMode(VTK_ATTRIBUTE_MODE_DEFAULT); }
143  {
144  this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_POINT_DATA);
145  }
149 
151 
159  vtkSetClampMacro(ComponentMode, int, VTK_COMPONENT_MODE_USE_SELECTED, VTK_COMPONENT_MODE_USE_ANY);
160  vtkGetMacro(ComponentMode, int);
162  void SetComponentModeToUseAll() { this->SetComponentMode(VTK_COMPONENT_MODE_USE_ALL); }
163  void SetComponentModeToUseAny() { this->SetComponentMode(VTK_COMPONENT_MODE_USE_ANY); }
166 
168 
172  vtkSetClampMacro(SelectedComponent, int, 0, VTK_INT_MAX);
173  vtkGetMacro(SelectedComponent, int);
175 
177 
183  vtkSetMacro(AllScalars, vtkTypeBool);
184  vtkGetMacro(AllScalars, vtkTypeBool);
185  vtkBooleanMacro(AllScalars, vtkTypeBool);
187 
189 
197  vtkSetMacro(UseContinuousCellRange, vtkTypeBool);
198  vtkGetMacro(UseContinuousCellRange, vtkTypeBool);
199  vtkBooleanMacro(UseContinuousCellRange, vtkTypeBool);
201 
203 
210  void SetPointsDataTypeToDouble() { this->SetPointsDataType(VTK_DOUBLE); }
211  void SetPointsDataTypeToFloat() { this->SetPointsDataType(VTK_FLOAT); }
215 
217 
222  vtkSetMacro(Invert, bool);
223  vtkGetMacro(Invert, bool);
224  vtkBooleanMacro(Invert, bool);
226 
228 
233  void SetOutputPointsPrecision(int precision);
236 
238 
251  int Lower(double s) const;
252  int Upper(double s) const;
253  int Between(double s) const;
255 protected:
257  ~vtkThreshold() override;
258 
259  // Usual data generation method
261 
263 
266  vtkTypeBool AllScalars = 1;
267  vtkTypeBool UseContinuousCellRange = 0;
268  bool Invert = false;
269  int AttributeMode = -1;
270  int ComponentMode = VTK_COMPONENT_MODE_USE_SELECTED;
271  int SelectedComponent = 0;
272  int OutputPointsPrecision = DEFAULT_PRECISION;
273 
274  int (vtkThreshold::*ThresholdFunction)(double s) const = &vtkThreshold::Between;
275 
277  int EvaluateCell(vtkDataArray* scalars, vtkIdList* cellPts, int numCellPts);
278  int EvaluateCell(vtkDataArray* scalars, int c, vtkIdList* cellPts, int numCellPts);
279 
280 private:
281  vtkThreshold(const vtkThreshold&) = delete;
282  void operator=(const vtkThreshold&) = delete;
283 };
284 
285 #endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:65
list of point or cell ids
Definition: vtkIdList.h:43
a simple class to control print indentation
Definition: vtkIndent.h:49
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
extracts cells where scalar value in cell satisfies threshold criterion
Definition: vtkThreshold.h:72
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)
const char * GetComponentModeAsString()
Control how the decision of in / out is made with multi-component data.
void SetAttributeModeToUsePointData()
Control how the filter works with scalar point data and cell attribute data.
Definition: vtkThreshold.h:142
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:161
void SetComponentModeToUseAny()
Control how the decision of in / out is made with multi-component data.
Definition: vtkThreshold.h:163
const char * GetAttributeModeAsString()
Control how the filter works with scalar point data and cell attribute data.
ThresholdType
Possible values for the threshold function:
Definition: vtkThreshold.h:85
void SetComponentModeToUseAll()
Control how the decision of in / out is made with multi-component data.
Definition: vtkThreshold.h:162
int GetOutputPointsPrecision() const
Set/get the desired precision for the output types.
double LowerThreshold
Definition: vtkThreshold.h:264
void SetPointsDataTypeToDouble()
Set the data type of the output points (See the data types defined in vtkType.h).
Definition: vtkThreshold.h:210
void SetAttributeModeToUseCellData()
Control how the filter works with scalar point data and cell attribute data.
Definition: vtkThreshold.h:146
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:211
double UpperThreshold
Definition: vtkThreshold.h:265
void SetOutputPointsPrecision(int precision)
Set/get the desired precision for the output types.
static vtkThreshold * New()
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.
Superclass for algorithms that produce only unstructured grid as output.
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
@ type
Definition: vtkX3D.h:522
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_DEPRECATED_IN_9_1_0(reason)
#define VTK_COMPONENT_MODE_USE_SELECTED
Definition: vtkThreshold.h:64
#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA
Definition: vtkThreshold.h:60
#define VTK_ATTRIBUTE_MODE_DEFAULT
Definition: vtkThreshold.h:59
#define VTK_COMPONENT_MODE_USE_ALL
Definition: vtkThreshold.h:65
#define VTK_COMPONENT_MODE_USE_ANY
Definition: vtkThreshold.h:66
#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA
Definition: vtkThreshold.h:61
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