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 
46 
47 #define VTK_ATTRIBUTE_MODE_DEFAULT 0
48 #define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
49 #define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
50 
51 // order / values are important because of the SetClampMacro
52 #define VTK_COMPONENT_MODE_USE_SELECTED 0
53 #define VTK_COMPONENT_MODE_USE_ALL 1
54 #define VTK_COMPONENT_MODE_USE_ANY 2
55 
56 class vtkDataArray;
57 
59 {
60 public:
61  static vtkThreshold *New();
63  void PrintSelf(ostream& os, vtkIndent indent);
64 
67  void ThresholdByLower(double lower);
68 
71  void ThresholdByUpper(double upper);
72 
75  void ThresholdBetween(double lower, double upper);
76 
78 
79  vtkGetMacro(UpperThreshold,double);
80  vtkGetMacro(LowerThreshold,double);
82 
84 
90  vtkSetMacro(AttributeMode,int);
91  vtkGetMacro(AttributeMode,int);
93  {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_DEFAULT);};
95  {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_POINT_DATA);};
97  {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_CELL_DATA);};
98  const char *GetAttributeModeAsString();
100 
102 
108  vtkSetClampMacro(ComponentMode,int,
111  vtkGetMacro(ComponentMode,int);
113  {this->SetComponentMode(VTK_COMPONENT_MODE_USE_SELECTED);};
115  {this->SetComponentMode(VTK_COMPONENT_MODE_USE_ALL);};
117  {this->SetComponentMode(VTK_COMPONENT_MODE_USE_ANY);};
118  const char *GetComponentModeAsString();
120 
122 
124  vtkSetClampMacro(SelectedComponent,int,0,VTK_INT_MAX);
125  vtkGetMacro(SelectedComponent,int);
127 
129 
133  vtkSetMacro(AllScalars,int);
134  vtkGetMacro(AllScalars,int);
135  vtkBooleanMacro(AllScalars,int);
137 
139 
141  void SetPointsDataTypeToDouble() { this->SetPointsDataType( VTK_DOUBLE ); }
142  void SetPointsDataTypeToFloat() { this->SetPointsDataType( VTK_FLOAT ); }
143  vtkSetMacro( PointsDataType, int );
144  vtkGetMacro( PointsDataType, int );
146 
148 
149 protected:
150  vtkThreshold();
151  ~vtkThreshold();
152 
153  // Usual data generation method
155 
157 
158 
166 
167  //BTX
168  int (vtkThreshold::*ThresholdFunction)(double s);
169  //ETX
170 
171  int Lower(double s) {return ( s <= this->LowerThreshold ? 1 : 0 );};
172  int Upper(double s) {return ( s >= this->UpperThreshold ? 1 : 0 );};
173  int Between(double s) {return ( s >= this->LowerThreshold ?
174  ( s <= this->UpperThreshold ? 1 : 0 ) : 0 );};
175 
176  int EvaluateComponents( vtkDataArray *scalars, vtkIdType id );
177 
178 private:
179  vtkThreshold(const vtkThreshold&); // Not implemented.
180  void operator=(const vtkThreshold&); // Not implemented.
181 };
182 
183 #endif
double UpperThreshold
Definition: vtkThreshold.h:161
double LowerThreshold
Definition: vtkThreshold.h:160
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
#define VTK_GRAPHICS_EXPORT
Store vtkAlgorithm input/output information.
#define VTK_INT_MAX
Definition: vtkType.h:123
#define VTK_ATTRIBUTE_MODE_USE_CELL_DATA
Definition: vtkThreshold.h:49
#define VTK_ATTRIBUTE_MODE_USE_POINT_DATA
Definition: vtkThreshold.h:48
void SetPointsDataTypeToDouble()
Definition: vtkThreshold.h:141
static vtkUnstructuredGridAlgorithm * New()
virtual int FillInputPortInformation(int port, vtkInformation *info)
int vtkIdType
Definition: vtkType.h:255
void SetAttributeModeToUseCellData()
Definition: vtkThreshold.h:96
#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:58
int Upper(double s)
Definition: vtkThreshold.h:172
void SetAttributeModeToUsePointData()
Definition: vtkThreshold.h:94
int SelectedComponent
Definition: vtkThreshold.h:164
void SetPointsDataTypeToFloat()
Definition: vtkThreshold.h:142
a simple class to control print indentation
Definition: vtkIndent.h:37
#define VTK_COMPONENT_MODE_USE_SELECTED
Definition: vtkThreshold.h:52
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:53
#define VTK_COMPONENT_MODE_USE_ALL
Definition: vtkThreshold.h:53
int Lower(double s)
Definition: vtkThreshold.h:171
void PrintSelf(ostream &os, vtkIndent indent)
#define VTK_ATTRIBUTE_MODE_DEFAULT
Definition: vtkThreshold.h:47
Superclass for algorithms that produce only unstructured grid as output.
void SetComponentModeToUseSelected()
Definition: vtkThreshold.h:112
void SetComponentModeToUseAll()
Definition: vtkThreshold.h:114
int Between(double s)
Definition: vtkThreshold.h:173
#define VTK_COMPONENT_MODE_USE_ANY
Definition: vtkThreshold.h:54
Store zero or more vtkInformation instances.
virtual int ProcessRequest(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
void SetAttributeModeToDefault()
Definition: vtkThreshold.h:92
void SetComponentModeToUseAny()
Definition: vtkThreshold.h:116