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