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 =========================================================================*/
42 #ifndef vtkThreshold_h
43 #define vtkThreshold_h
44 
45 #include "vtkFiltersCoreModule.h" // For export macro
47 
48 #define VTK_ATTRIBUTE_MODE_DEFAULT 0
49 #define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
50 #define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
51 
52 // order / values are important because of the SetClampMacro
53 #define VTK_COMPONENT_MODE_USE_SELECTED 0
54 #define VTK_COMPONENT_MODE_USE_ALL 1
55 #define VTK_COMPONENT_MODE_USE_ANY 2
56 
57 class vtkDataArray;
58 class vtkIdList;
59 
61 {
62 public:
63  static vtkThreshold *New();
65  void PrintSelf(ostream& os, vtkIndent indent);
66 
69  void ThresholdByLower(double lower);
70 
73  void ThresholdByUpper(double upper);
74 
77  void ThresholdBetween(double lower, double upper);
78 
80 
81  vtkGetMacro(UpperThreshold,double);
82  vtkGetMacro(LowerThreshold,double);
84 
86 
92  vtkSetMacro(AttributeMode,int);
93  vtkGetMacro(AttributeMode,int);
95  {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_DEFAULT);};
97  {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_POINT_DATA);};
99  {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_CELL_DATA);};
100  const char *GetAttributeModeAsString();
102 
104 
110  vtkSetClampMacro(ComponentMode,int,
113  vtkGetMacro(ComponentMode,int);
115  {this->SetComponentMode(VTK_COMPONENT_MODE_USE_SELECTED);};
117  {this->SetComponentMode(VTK_COMPONENT_MODE_USE_ALL);};
119  {this->SetComponentMode(VTK_COMPONENT_MODE_USE_ANY);};
120  const char *GetComponentModeAsString();
122 
124 
126  vtkSetClampMacro(SelectedComponent,int,0,VTK_INT_MAX);
127  vtkGetMacro(SelectedComponent,int);
129 
131 
135  vtkSetMacro(AllScalars,int);
136  vtkGetMacro(AllScalars,int);
137  vtkBooleanMacro(AllScalars,int);
139 
141 
147  vtkSetMacro(UseContinuousCellRange,int);
148  vtkGetMacro(UseContinuousCellRange,int);
149  vtkBooleanMacro(UseContinuousCellRange,int);
151 
153 
157  void SetPointsDataTypeToDouble() { this->SetPointsDataType( VTK_DOUBLE ); }
158  void SetPointsDataTypeToFloat() { this->SetPointsDataType( VTK_FLOAT ); }
159  void SetPointsDataType(int type);
160  int GetPointsDataType();
162 
164 
167  void SetOutputPointsPrecision(int precision);
168  int GetOutputPointsPrecision() const;
170 
171 protected:
172  vtkThreshold();
173  ~vtkThreshold();
174 
175  // Usual data generation method
177 
179 
180 
189 
190  //BTX
191  int (vtkThreshold::*ThresholdFunction)(double s);
192  //ETX
193 
194  int Lower(double s) {return ( s <= this->LowerThreshold ? 1 : 0 );};
195  int Upper(double s) {return ( s >= this->UpperThreshold ? 1 : 0 );};
196  int Between(double s) {return ( s >= this->LowerThreshold ?
197  ( s <= this->UpperThreshold ? 1 : 0 ) : 0 );};
198 
199  int EvaluateComponents( vtkDataArray *scalars, vtkIdType id );
200  int EvaluateCell( vtkDataArray *scalars, vtkIdList* cellPts, int numCellPts );
201  int EvaluateCell( vtkDataArray *scalars, int c, vtkIdList* cellPts, int numCellPts );
202 private:
203  vtkThreshold(const vtkThreshold&); // Not implemented.
204  void operator=(const vtkThreshold&); // Not implemented.
205 };
206 
207 #endif
double UpperThreshold
Definition: vtkThreshold.h:183
double LowerThreshold
Definition: vtkThreshold.h:182
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Store vtkAlgorithm input/output information.
#define VTKFILTERSCORE_EXPORT
#define VTK_INT_MAX
Definition: vtkType.h:132
#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA
Definition: vtkThreshold.h:50
#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA
Definition: vtkThreshold.h:49
void SetPointsDataTypeToDouble()
Definition: vtkThreshold.h:157
static vtkUnstructuredGridAlgorithm * New()
virtual int FillInputPortInformation(int port, vtkInformation *info)
int vtkIdType
Definition: vtkType.h:275
void SetAttributeModeToUseCellData()
Definition: vtkThreshold.h:98
#define VTK_DOUBLE
Definition: vtkType.h:36
#define VTK_FLOAT
Definition: vtkType.h:35
extracts cells where scalar value in cell satisfies threshold criterion
Definition: vtkThreshold.h:60
int Upper(double s)
Definition: vtkThreshold.h:195
void SetAttributeModeToUsePointData()
Definition: vtkThreshold.h:96
int SelectedComponent
Definition: vtkThreshold.h:186
void SetPointsDataTypeToFloat()
Definition: vtkThreshold.h:158
a simple class to control print indentation
Definition: vtkIndent.h:38
#define VTK_COMPONENT_MODE_USE_SELECTED
Definition: vtkThreshold.h:53
list of point or cell ids
Definition: vtkIdList.h:35
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
#define VTK_COMPONENT_MODE_USE_ALL
Definition: vtkThreshold.h:54
int Lower(double s)
Definition: vtkThreshold.h:194
void PrintSelf(ostream &os, vtkIndent indent)
#define VTK_ATTRIBUTE_MODE_DEFAULT
Definition: vtkThreshold.h:48
Superclass for algorithms that produce only unstructured grid as output.
void SetComponentModeToUseSelected()
Definition: vtkThreshold.h:114
void SetComponentModeToUseAll()
Definition: vtkThreshold.h:116
int Between(double s)
Definition: vtkThreshold.h:196
#define VTK_COMPONENT_MODE_USE_ANY
Definition: vtkThreshold.h:55
Store zero or more vtkInformation instances.
int UseContinuousCellRange
Definition: vtkThreshold.h:188
void SetAttributeModeToDefault()
Definition: vtkThreshold.h:94
int OutputPointsPrecision
Definition: vtkThreshold.h:187
void SetComponentModeToUseAny()
Definition: vtkThreshold.h:118