00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00042 #ifndef __vtkThreshold_h
00043 #define __vtkThreshold_h
00044
00045 #include "vtkUnstructuredGridAlgorithm.h"
00046
00047 #define VTK_ATTRIBUTE_MODE_DEFAULT 0
00048 #define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
00049 #define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
00050
00051
00052 #define VTK_COMPONENT_MODE_USE_SELECTED 0
00053 #define VTK_COMPONENT_MODE_USE_ALL 1
00054 #define VTK_COMPONENT_MODE_USE_ANY 2
00055
00056 class vtkDataArray;
00057
00058 class VTK_GRAPHICS_EXPORT vtkThreshold : public vtkUnstructuredGridAlgorithm
00059 {
00060 public:
00061 static vtkThreshold *New();
00062 vtkTypeRevisionMacro(vtkThreshold,vtkUnstructuredGridAlgorithm);
00063 void PrintSelf(ostream& os, vtkIndent indent);
00064
00067 void ThresholdByLower(double lower);
00068
00071 void ThresholdByUpper(double upper);
00072
00075 void ThresholdBetween(double lower, double upper);
00076
00078
00079 vtkGetMacro(UpperThreshold,double);
00080 vtkGetMacro(LowerThreshold,double);
00082
00084
00090 vtkSetMacro(AttributeMode,int);
00091 vtkGetMacro(AttributeMode,int);
00092 void SetAttributeModeToDefault()
00093 {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_DEFAULT);};
00094 void SetAttributeModeToUsePointData()
00095 {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_POINT_DATA);};
00096 void SetAttributeModeToUseCellData()
00097 {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_CELL_DATA);};
00098 const char *GetAttributeModeAsString();
00100
00102
00108 vtkSetClampMacro(ComponentMode,int,
00109 VTK_COMPONENT_MODE_USE_SELECTED,
00110 VTK_COMPONENT_MODE_USE_ANY);
00111 vtkGetMacro(ComponentMode,int);
00112 void SetComponentModeToUseSelected()
00113 {this->SetComponentMode(VTK_COMPONENT_MODE_USE_SELECTED);};
00114 void SetComponentModeToUseAll()
00115 {this->SetComponentMode(VTK_COMPONENT_MODE_USE_ALL);};
00116 void SetComponentModeToUseAny()
00117 {this->SetComponentMode(VTK_COMPONENT_MODE_USE_ANY);};
00118 const char *GetComponentModeAsString();
00120
00122
00124 vtkSetClampMacro(SelectedComponent,int,0,VTK_INT_MAX);
00125 vtkGetMacro(SelectedComponent,int);
00127
00129
00133 vtkSetMacro(AllScalars,int);
00134 vtkGetMacro(AllScalars,int);
00135 vtkBooleanMacro(AllScalars,int);
00137
00139
00141 void SetPointsDataTypeToDouble() { this->SetPointsDataType( VTK_DOUBLE ); }
00142 void SetPointsDataTypeToFloat() { this->SetPointsDataType( VTK_FLOAT ); }
00143 vtkSetMacro( PointsDataType, int );
00144 vtkGetMacro( PointsDataType, int );
00146
00147 protected:
00148 vtkThreshold();
00149 ~vtkThreshold();
00150
00151
00152 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00153
00154 virtual int FillInputPortInformation(int port, vtkInformation *info);
00155
00156 int AllScalars;
00157 double LowerThreshold;
00158 double UpperThreshold;
00159 int AttributeMode;
00160 int ComponentMode;
00161 int SelectedComponent;
00162 int PointsDataType;
00163
00164
00165 int (vtkThreshold::*ThresholdFunction)(double s);
00166
00167
00168 int Lower(double s) {return ( s <= this->LowerThreshold ? 1 : 0 );};
00169 int Upper(double s) {return ( s >= this->UpperThreshold ? 1 : 0 );};
00170 int Between(double s) {return ( s >= this->LowerThreshold ?
00171 ( s <= this->UpperThreshold ? 1 : 0 ) : 0 );};
00172
00173 int EvaluateComponents( vtkDataArray *scalars, vtkIdType id );
00174
00175 private:
00176 vtkThreshold(const vtkThreshold&);
00177 void operator=(const vtkThreshold&);
00178 };
00179
00180 #endif