VTK
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=========================================================================*/
43#ifndef vtkThreshold_h
44#define vtkThreshold_h
45
46#include "vtkFiltersCoreModule.h" // For export macro
48
49#define VTK_ATTRIBUTE_MODE_DEFAULT 0
50#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
51#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
52
53// order / values are important because of the SetClampMacro
54#define VTK_COMPONENT_MODE_USE_SELECTED 0
55#define VTK_COMPONENT_MODE_USE_ALL 1
56#define VTK_COMPONENT_MODE_USE_ANY 2
57
58class vtkDataArray;
59class vtkIdList;
60
61class VTKFILTERSCORE_EXPORT vtkThreshold : public vtkUnstructuredGridAlgorithm
62{
63public:
64 static vtkThreshold *New();
66 void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
67
71 void ThresholdByLower(double lower);
72
76 void ThresholdByUpper(double upper);
77
82 void ThresholdBetween(double lower, double upper);
83
85
88 vtkGetMacro(UpperThreshold,double);
89 vtkGetMacro(LowerThreshold,double);
91
93
100 vtkSetMacro(AttributeMode,int);
101 vtkGetMacro(AttributeMode,int);
103 {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_DEFAULT);};
105 {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_POINT_DATA);};
107 {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_CELL_DATA);};
110
112
120 vtkSetClampMacro(ComponentMode,int,
123 vtkGetMacro(ComponentMode,int);
125 {this->SetComponentMode(VTK_COMPONENT_MODE_USE_SELECTED);};
127 {this->SetComponentMode(VTK_COMPONENT_MODE_USE_ALL);};
129 {this->SetComponentMode(VTK_COMPONENT_MODE_USE_ANY);};
132
134
138 vtkSetClampMacro(SelectedComponent,int,0,VTK_INT_MAX);
139 vtkGetMacro(SelectedComponent,int);
141
143
149 vtkSetMacro(AllScalars,int);
150 vtkGetMacro(AllScalars,int);
151 vtkBooleanMacro(AllScalars,int);
153
155
163 vtkSetMacro(UseContinuousCellRange,int);
164 vtkGetMacro(UseContinuousCellRange,int);
165 vtkBooleanMacro(UseContinuousCellRange,int);
167
169
176 void SetPointsDataTypeToDouble() { this->SetPointsDataType( VTK_DOUBLE ); }
177 void SetPointsDataTypeToFloat() { this->SetPointsDataType( VTK_FLOAT ); }
181
183
188 void SetOutputPointsPrecision(int precision);
191
192protected:
194 ~vtkThreshold() VTK_OVERRIDE;
195
196 // Usual data generation method
197 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
198
199 int FillInputPortInformation(int port, vtkInformation *info) VTK_OVERRIDE;
200
201
202 int AllScalars;
203 double LowerThreshold;
204 double UpperThreshold;
205 int AttributeMode;
206 int ComponentMode;
207 int SelectedComponent;
208 int OutputPointsPrecision;
209 int UseContinuousCellRange;
210
211 int (vtkThreshold::*ThresholdFunction)(double s);
212
213 int Lower(double s) {return ( s <= this->LowerThreshold ? 1 : 0 );};
214 int Upper(double s) {return ( s >= this->UpperThreshold ? 1 : 0 );};
215 int Between(double s) {return ( s >= this->LowerThreshold ?
216 ( s <= this->UpperThreshold ? 1 : 0 ) : 0 );};
217
219 int EvaluateCell( vtkDataArray *scalars, vtkIdList* cellPts, int numCellPts );
220 int EvaluateCell( vtkDataArray *scalars, int c, vtkIdList* cellPts, int numCellPts );
221private:
222 vtkThreshold(const vtkThreshold&) VTK_DELETE_FUNCTION;
223 void operator=(const vtkThreshold&) VTK_DELETE_FUNCTION;
224};
225
226#endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
list of point or cell ids
Definition: vtkIdList.h:37
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
extracts cells where scalar value in cell satisfies threshold criterion
Definition: vtkThreshold.h:62
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)
int Upper(double s)
Definition: vtkThreshold.h:214
void ThresholdBetween(double lower, double upper)
Criterion is cells whose scalars are between lower and upper thresholds (inclusive of the end values)...
void SetAttributeModeToUsePointData()
Definition: vtkThreshold.h:104
void SetPointsDataType(int type)
void SetComponentModeToUseSelected()
Definition: vtkThreshold.h:124
void SetComponentModeToUseAny()
Definition: vtkThreshold.h:128
void SetComponentModeToUseAll()
Definition: vtkThreshold.h:126
int GetOutputPointsPrecision() const
void SetPointsDataTypeToDouble()
Set the data type of the output points (See the data types defined in vtkType.h).
Definition: vtkThreshold.h:176
const char * GetComponentModeAsString()
void SetAttributeModeToUseCellData()
Definition: vtkThreshold.h:106
int EvaluateComponents(vtkDataArray *scalars, vtkIdType id)
int GetPointsDataType()
void SetPointsDataTypeToFloat()
Definition: vtkThreshold.h:177
void SetOutputPointsPrecision(int precision)
Set/get the desired precision for the output types.
void SetAttributeModeToDefault()
Definition: vtkThreshold.h:102
void ThresholdByLower(double lower)
Criterion is cells whose scalars are less or equal to lower threshold.
~vtkThreshold() override
int Between(double s)
Definition: vtkThreshold.h:215
void ThresholdByUpper(double upper)
Criterion is cells whose scalars are greater or equal to upper threshold.
int EvaluateCell(vtkDataArray *scalars, int c, vtkIdList *cellPts, int numCellPts)
const char * GetAttributeModeAsString()
static vtkThreshold * New()
Superclass for algorithms that produce only unstructured grid as output.
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
@ type
Definition: vtkX3D.h:516
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
#define VTK_COMPONENT_MODE_USE_SELECTED
Definition: vtkThreshold.h:54
#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA
Definition: vtkThreshold.h:50
#define VTK_ATTRIBUTE_MODE_DEFAULT
Definition: vtkThreshold.h:49
#define VTK_COMPONENT_MODE_USE_ALL
Definition: vtkThreshold.h:55
#define VTK_COMPONENT_MODE_USE_ANY
Definition: vtkThreshold.h:56
#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA
Definition: vtkThreshold.h:51
int vtkIdType
Definition: vtkType.h:287
#define VTK_DOUBLE
Definition: vtkType.h:59
#define VTK_FLOAT
Definition: vtkType.h:58
#define VTK_INT_MAX
Definition: vtkType.h:153