VTK  9.0.1
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 =========================================================================*/
37 #ifndef vtkThreshold_h
38 #define vtkThreshold_h
39 
40 #include "vtkFiltersCoreModule.h" // For export macro
42 
43 #define VTK_ATTRIBUTE_MODE_DEFAULT 0
44 #define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
45 #define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
46 
47 // order / values are important because of the SetClampMacro
48 #define VTK_COMPONENT_MODE_USE_SELECTED 0
49 #define VTK_COMPONENT_MODE_USE_ALL 1
50 #define VTK_COMPONENT_MODE_USE_ANY 2
51 
52 class vtkDataArray;
53 class vtkIdList;
54 
55 class VTKFILTERSCORE_EXPORT vtkThreshold : public vtkUnstructuredGridAlgorithm
56 {
57 public:
58  static vtkThreshold* New();
60  void PrintSelf(ostream& os, vtkIndent indent) override;
61 
65  void ThresholdByLower(double lower);
66 
70  void ThresholdByUpper(double upper);
71 
76  void ThresholdBetween(double lower, double upper);
77 
79 
82  vtkGetMacro(UpperThreshold, double);
83  vtkGetMacro(LowerThreshold, double);
85 
87 
94  vtkSetMacro(AttributeMode, int);
95  vtkGetMacro(AttributeMode, int);
96  void SetAttributeModeToDefault() { this->SetAttributeMode(VTK_ATTRIBUTE_MODE_DEFAULT); }
98  {
99  this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_POINT_DATA);
100  }
102  const char* GetAttributeModeAsString();
104 
106 
114  vtkSetClampMacro(ComponentMode, int, VTK_COMPONENT_MODE_USE_SELECTED, VTK_COMPONENT_MODE_USE_ANY);
115  vtkGetMacro(ComponentMode, int);
117  void SetComponentModeToUseAll() { this->SetComponentMode(VTK_COMPONENT_MODE_USE_ALL); }
118  void SetComponentModeToUseAny() { this->SetComponentMode(VTK_COMPONENT_MODE_USE_ANY); }
119  const char* GetComponentModeAsString();
121 
123 
127  vtkSetClampMacro(SelectedComponent, int, 0, VTK_INT_MAX);
128  vtkGetMacro(SelectedComponent, int);
130 
132 
138  vtkSetMacro(AllScalars, vtkTypeBool);
139  vtkGetMacro(AllScalars, vtkTypeBool);
140  vtkBooleanMacro(AllScalars, vtkTypeBool);
142 
144 
152  vtkSetMacro(UseContinuousCellRange, vtkTypeBool);
153  vtkGetMacro(UseContinuousCellRange, vtkTypeBool);
154  vtkBooleanMacro(UseContinuousCellRange, vtkTypeBool);
156 
158 
165  void SetPointsDataTypeToDouble() { this->SetPointsDataType(VTK_DOUBLE); }
166  void SetPointsDataTypeToFloat() { this->SetPointsDataType(VTK_FLOAT); }
167  void SetPointsDataType(int type);
168  int GetPointsDataType();
170 
172 
177  vtkSetMacro(Invert, bool);
178  vtkGetMacro(Invert, bool);
179  vtkBooleanMacro(Invert, bool);
181 
183 
188  void SetOutputPointsPrecision(int precision);
189  int GetOutputPointsPrecision() const;
191 
193 
207  int Lower(double s) const;
208  int Upper(double s) const;
209  int Between(double s) const;
211 protected:
212  vtkThreshold();
213  ~vtkThreshold() override;
214 
215  // Usual data generation method
217 
218  int FillInputPortInformation(int port, vtkInformation* info) override;
219 
228  bool Invert;
229 
230  int (vtkThreshold::*ThresholdFunction)(double s) const;
231 
232  int EvaluateComponents(vtkDataArray* scalars, vtkIdType id);
233  int EvaluateCell(vtkDataArray* scalars, vtkIdList* cellPts, int numCellPts);
234  int EvaluateCell(vtkDataArray* scalars, int c, vtkIdList* cellPts, int numCellPts);
235 
236 private:
237  vtkThreshold(const vtkThreshold&) = delete;
238  void operator=(const vtkThreshold&) = delete;
239 };
240 
241 #endif
double UpperThreshold
Definition: vtkThreshold.h:222
double LowerThreshold
Definition: vtkThreshold.h:221
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
Store vtkAlgorithm input/output information.
#define VTK_INT_MAX
Definition: vtkType.h:155
#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA
Definition: vtkThreshold.h:45
#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA
Definition: vtkThreshold.h:44
void SetPointsDataTypeToDouble()
Set the data type of the output points (See the data types defined in vtkType.h). ...
Definition: vtkThreshold.h:165
static vtkUnstructuredGridAlgorithm * New()
int vtkIdType
Definition: vtkType.h:338
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void SetAttributeModeToUseCellData()
Control how the filter works with scalar point data and cell attribute data.
Definition: vtkThreshold.h:101
vtkTypeBool AllScalars
Definition: vtkThreshold.h:220
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_DOUBLE
Definition: vtkType.h:53
#define VTK_FLOAT
Definition: vtkType.h:52
extracts cells where scalar value in cell satisfies threshold criterion
Definition: vtkThreshold.h:55
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetAttributeModeToUsePointData()
Control how the filter works with scalar point data and cell attribute data.
Definition: vtkThreshold.h:97
int SelectedComponent
Definition: vtkThreshold.h:225
void SetPointsDataTypeToFloat()
Set the data type of the output points (See the data types defined in vtkType.h). ...
Definition: vtkThreshold.h:166
a simple class to control print indentation
Definition: vtkIndent.h:33
#define VTK_COMPONENT_MODE_USE_SELECTED
Definition: vtkThreshold.h:48
list of point or cell ids
Definition: vtkIdList.h:30
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
#define VTK_COMPONENT_MODE_USE_ALL
Definition: vtkThreshold.h:49
#define VTK_ATTRIBUTE_MODE_DEFAULT
Definition: vtkThreshold.h:43
Superclass for algorithms that produce only unstructured grid as output.
void SetComponentModeToUseSelected()
Control how the decision of in / out is made with multi-component data.
Definition: vtkThreshold.h:116
vtkTypeBool UseContinuousCellRange
Definition: vtkThreshold.h:227
void SetComponentModeToUseAll()
Control how the decision of in / out is made with multi-component data.
Definition: vtkThreshold.h:117
#define VTK_COMPONENT_MODE_USE_ANY
Definition: vtkThreshold.h:50
Store zero or more vtkInformation instances.
void SetAttributeModeToDefault()
Control how the filter works with scalar point data and cell attribute data.
Definition: vtkThreshold.h:96
int OutputPointsPrecision
Definition: vtkThreshold.h:226
void SetComponentModeToUseAny()
Control how the decision of in / out is made with multi-component data.
Definition: vtkThreshold.h:118