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
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:155
vtkThreshold::SetAttributeModeToDefault
void SetAttributeModeToDefault()
Definition: vtkThreshold.h:96
VTK_ATTRIBUTE_MODE_USE_POINT_DATA
#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA
Definition: vtkThreshold.h:44
vtkX3D::type
@ type
Definition: vtkX3D.h:522
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkThreshold::SetComponentModeToUseAny
void SetComponentModeToUseAny()
Definition: vtkThreshold.h:118
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
VTK_COMPONENT_MODE_USE_ALL
#define VTK_COMPONENT_MODE_USE_ALL
Definition: vtkThreshold.h:49
vtkThreshold::AllScalars
vtkTypeBool AllScalars
Definition: vtkThreshold.h:220
vtkThreshold::LowerThreshold
double LowerThreshold
Definition: vtkThreshold.h:221
vtkThreshold::SetAttributeModeToUsePointData
void SetAttributeModeToUsePointData()
Definition: vtkThreshold.h:97
vtkThreshold::SelectedComponent
int SelectedComponent
Definition: vtkThreshold.h:225
vtkThreshold::SetPointsDataTypeToFloat
void SetPointsDataTypeToFloat()
Definition: vtkThreshold.h:166
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
vtkThreshold::SetPointsDataTypeToDouble
void SetPointsDataTypeToDouble()
Set the data type of the output points (See the data types defined in vtkType.h).
Definition: vtkThreshold.h:165
vtkX3D::port
@ port
Definition: vtkX3D.h:453
vtkThreshold::SetComponentModeToUseSelected
void SetComponentModeToUseSelected()
Definition: vtkThreshold.h:116
vtkThreshold::UseContinuousCellRange
vtkTypeBool UseContinuousCellRange
Definition: vtkThreshold.h:227
vtkThreshold::Invert
bool Invert
Definition: vtkThreshold.h:228
vtkUnstructuredGridAlgorithm::RequestData
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
vtkThreshold::SetComponentModeToUseAll
void SetComponentModeToUseAll()
Definition: vtkThreshold.h:117
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkThreshold
extracts cells where scalar value in cell satisfies threshold criterion
Definition: vtkThreshold.h:55
vtkThreshold::SetAttributeModeToUseCellData
void SetAttributeModeToUseCellData()
Definition: vtkThreshold.h:101
VTK_FLOAT
#define VTK_FLOAT
Definition: vtkType.h:52
VTK_DOUBLE
#define VTK_DOUBLE
Definition: vtkType.h:53
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:30
vtkUnstructuredGridAlgorithm::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkThreshold::AttributeMode
int AttributeMode
Definition: vtkThreshold.h:223
VTK_ATTRIBUTE_MODE_DEFAULT
#define VTK_ATTRIBUTE_MODE_DEFAULT
Definition: vtkThreshold.h:43
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkX3D::info
@ info
Definition: vtkX3D.h:382
VTK_ATTRIBUTE_MODE_USE_CELL_DATA
#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA
Definition: vtkThreshold.h:45
VTK_COMPONENT_MODE_USE_SELECTED
#define VTK_COMPONENT_MODE_USE_SELECTED
Definition: vtkThreshold.h:48
vtkUnstructuredGridAlgorithm::New
static vtkUnstructuredGridAlgorithm * New()
vtkThreshold::OutputPointsPrecision
int OutputPointsPrecision
Definition: vtkThreshold.h:226
vtkUnstructuredGridAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkUnstructuredGridAlgorithm.h
vtkUnstructuredGridAlgorithm
Superclass for algorithms that produce only unstructured grid as output.
Definition: vtkUnstructuredGridAlgorithm.h:40
vtkThreshold::ComponentMode
int ComponentMode
Definition: vtkThreshold.h:224
vtkThreshold::UpperThreshold
double UpperThreshold
Definition: vtkThreshold.h:222
VTK_COMPONENT_MODE_USE_ANY
#define VTK_COMPONENT_MODE_USE_ANY
Definition: vtkThreshold.h:50
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69