VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
172 
173 protected:
174  vtkThreshold();
175  ~vtkThreshold();
176 
177  // Usual data generation method
179 
181 
182 
191 
192  //BTX
193  int (vtkThreshold::*ThresholdFunction)(double s);
194  //ETX
195 
196  int Lower(double s) {return ( s <= this->LowerThreshold ? 1 : 0 );};
197  int Upper(double s) {return ( s >= this->UpperThreshold ? 1 : 0 );};
198  int Between(double s) {return ( s >= this->LowerThreshold ?
199  ( s <= this->UpperThreshold ? 1 : 0 ) : 0 );};
200 
201  int EvaluateComponents( vtkDataArray *scalars, vtkIdType id );
202  int EvaluateCell( vtkDataArray *scalars, vtkIdList* cellPts, int numCellPts );
203  int EvaluateCell( vtkDataArray *scalars, int c, vtkIdList* cellPts, int numCellPts );
204 private:
205  vtkThreshold(const vtkThreshold&); // Not implemented.
206  void operator=(const vtkThreshold&); // Not implemented.
207 };
208 
209 #endif
double UpperThreshold
Definition: vtkThreshold.h:185
double LowerThreshold
Definition: vtkThreshold.h:184
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
GLuint GLuint GLsizei GLenum type
Definition: vtkgl.h:11315
Store vtkAlgorithm input/output information.
#define VTKFILTERSCORE_EXPORT
#define VTK_INT_MAX
Definition: vtkType.h:131
#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:268
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:197
void SetAttributeModeToUsePointData()
Definition: vtkThreshold.h:96
int SelectedComponent
Definition: vtkThreshold.h:188
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
const GLubyte * c
Definition: vtkgl.h:15720
list of point or cell ids
Definition: vtkIdList.h:35
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:53
#define VTK_COMPONENT_MODE_USE_ALL
Definition: vtkThreshold.h:54
int Lower(double s)
Definition: vtkThreshold.h:196
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:198
GLdouble s
Definition: vtkgl.h:11594
#define VTK_COMPONENT_MODE_USE_ANY
Definition: vtkThreshold.h:55
Store zero or more vtkInformation instances.
int UseContinuousCellRange
Definition: vtkThreshold.h:190
virtual int ProcessRequest(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
void SetAttributeModeToDefault()
Definition: vtkThreshold.h:94
int OutputPointsPrecision
Definition: vtkThreshold.h:189
void SetComponentModeToUseAny()
Definition: vtkThreshold.h:118
GLenum GLint GLint * precision
Definition: vtkgl.h:14180