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  }
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); }
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); }
170 
172 
177  vtkSetMacro(Invert, bool);
178  vtkGetMacro(Invert, bool);
179  vtkBooleanMacro(Invert, bool);
181 
183 
188  void SetOutputPointsPrecision(int precision);
191 
193 
207  int Lower(double s) const;
208  int Upper(double s) const;
209  int Between(double s) const;
211 protected:
213  ~vtkThreshold() override;
214 
215  // Usual data generation method
217 
219 
228  bool Invert;
229 
230  int (vtkThreshold::*ThresholdFunction)(double s) const;
231 
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
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
list of point or cell ids
Definition: vtkIdList.h:31
a simple class to control print indentation
Definition: vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
extracts cells where scalar value in cell satisfies threshold criterion
Definition: vtkThreshold.h:56
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()
void ThresholdBetween(double lower, double upper)
Criterion is cells whose scalars are between lower and upper thresholds (inclusive of the end values)...
vtkTypeBool AllScalars
Definition: vtkThreshold.h:220
void SetAttributeModeToUsePointData()
Definition: vtkThreshold.h:97
void SetPointsDataType(int type)
void SetComponentModeToUseSelected()
Definition: vtkThreshold.h:116
void SetComponentModeToUseAny()
Definition: vtkThreshold.h:118
const char * GetAttributeModeAsString()
void SetComponentModeToUseAll()
Definition: vtkThreshold.h:117
int GetOutputPointsPrecision() const
double LowerThreshold
Definition: vtkThreshold.h:221
void SetPointsDataTypeToDouble()
Set the data type of the output points (See the data types defined in vtkType.h).
Definition: vtkThreshold.h:165
void SetAttributeModeToUseCellData()
Definition: vtkThreshold.h:101
int EvaluateComponents(vtkDataArray *scalars, vtkIdType id)
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
int GetPointsDataType()
void SetPointsDataTypeToFloat()
Definition: vtkThreshold.h:166
double UpperThreshold
Definition: vtkThreshold.h:222
void SetOutputPointsPrecision(int precision)
Set/get the desired precision for the output types.
void SetAttributeModeToDefault()
Definition: vtkThreshold.h:96
void ThresholdByLower(double lower)
Criterion is cells whose scalars are less or equal to lower threshold.
static vtkThreshold * New()
int Upper(double s) const
~vtkThreshold() override
void ThresholdByUpper(double upper)
Criterion is cells whose scalars are greater or equal to upper threshold.
int Between(double s) const
int EvaluateCell(vtkDataArray *scalars, int c, vtkIdList *cellPts, int numCellPts)
int Lower(double s) const
Methods used for thresholding.
vtkTypeBool UseContinuousCellRange
Definition: vtkThreshold.h:227
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
int OutputPointsPrecision
Definition: vtkThreshold.h:226
int SelectedComponent
Definition: vtkThreshold.h:225
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_COMPONENT_MODE_USE_SELECTED
Definition: vtkThreshold.h:48
#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA
Definition: vtkThreshold.h:44
#define VTK_ATTRIBUTE_MODE_DEFAULT
Definition: vtkThreshold.h:43
#define VTK_COMPONENT_MODE_USE_ALL
Definition: vtkThreshold.h:49
#define VTK_COMPONENT_MODE_USE_ANY
Definition: vtkThreshold.h:50
#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA
Definition: vtkThreshold.h:45
int vtkIdType
Definition: vtkType.h:338
#define VTK_DOUBLE
Definition: vtkType.h:53
#define VTK_FLOAT
Definition: vtkType.h:52
#define VTK_INT_MAX
Definition: vtkType.h:155