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 vtkTypeMacro(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 virtual int ProcessRequest(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00148
00149 protected:
00150 vtkThreshold();
00151 ~vtkThreshold();
00152
00153
00154 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00155
00156 virtual int FillInputPortInformation(int port, vtkInformation *info);
00157
00158
00159 int AllScalars;
00160 double LowerThreshold;
00161 double UpperThreshold;
00162 int AttributeMode;
00163 int ComponentMode;
00164 int SelectedComponent;
00165 int PointsDataType;
00166
00167
00168 int (vtkThreshold::*ThresholdFunction)(double s);
00169
00170
00171 int Lower(double s) {return ( s <= this->LowerThreshold ? 1 : 0 );};
00172 int Upper(double s) {return ( s >= this->UpperThreshold ? 1 : 0 );};
00173 int Between(double s) {return ( s >= this->LowerThreshold ?
00174 ( s <= this->UpperThreshold ? 1 : 0 ) : 0 );};
00175
00176 int EvaluateComponents( vtkDataArray *scalars, vtkIdType id );
00177
00178 private:
00179 vtkThreshold(const vtkThreshold&);
00180 void operator=(const vtkThreshold&);
00181 };
00182
00183 #endif