00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00043
#ifndef __vtkThreshold_h
00044
#define __vtkThreshold_h
00045
00046
#include "vtkDataSetToUnstructuredGridFilter.h"
00047
00048 #define VTK_ATTRIBUTE_MODE_DEFAULT 0
00049 #define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
00050 #define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
00051
00052 class VTK_GRAPHICS_EXPORT vtkThreshold :
public vtkDataSetToUnstructuredGridFilter
00053 {
00054
public:
00055
static vtkThreshold *
New();
00056 vtkTypeRevisionMacro(vtkThreshold,
vtkDataSetToUnstructuredGridFilter);
00057
void PrintSelf(ostream& os,
vtkIndent indent);
00058
00061
void ThresholdByLower(
float lower);
00062
00065
void ThresholdByUpper(
float upper);
00066
00069
void ThresholdBetween(
float lower,
float upper);
00070
00072
00073 vtkGetMacro(UpperThreshold,
float);
00074 vtkGetMacro(LowerThreshold,
float);
00076
00078
00084 vtkSetMacro(AttributeMode,
int);
00085 vtkGetMacro(AttributeMode,
int);
00086 void SetAttributeModeToDefault()
00087 {this->SetAttributeMode(
VTK_ATTRIBUTE_MODE_DEFAULT);};
00088 void SetAttributeModeToUsePointData()
00089 {this->SetAttributeMode(
VTK_ATTRIBUTE_MODE_USE_POINT_DATA);};
00090 void SetAttributeModeToUseCellData()
00091 {this->SetAttributeMode(
VTK_ATTRIBUTE_MODE_USE_CELL_DATA);};
00092
const char *GetAttributeModeAsString();
00094
00096
00100 vtkSetMacro(AllScalars,
int);
00101 vtkGetMacro(AllScalars,
int);
00102 vtkBooleanMacro(AllScalars,
int);
00104
00105
protected:
00106 vtkThreshold();
00107 ~vtkThreshold();
00108
00109
00110
00111
00112
friend class vtkCutMaterial;
00113
00115
00118 vtkGetStringMacro(InputScalarsSelection);
00119 virtual void SelectInputScalars(
const char *fieldName)
00120 {this->SetInputScalarsSelection(fieldName);}
00122
00123
00124
00125
void Execute();
00126
00127 int AllScalars;
00128 float LowerThreshold;
00129 float UpperThreshold;
00130 int AttributeMode;
00131
00132
00133 int (vtkThreshold::*ThresholdFunction)(
float s);
00134
00135
00136 int Lower(
float s) {
return ( s <= this->LowerThreshold ? 1 : 0 );};
00137 int Upper(
float s) {
return ( s >= this->UpperThreshold ? 1 : 0 );};
00138 int Between(
float s) {
return ( s >= this->LowerThreshold ?
00139 ( s <= this->UpperThreshold ? 1 : 0 ) : 0 );};
00140
00141 char *InputScalarsSelection;
00142 vtkSetStringMacro(InputScalarsSelection);
00143
00144
private:
00145 vtkThreshold(
const vtkThreshold&);
00146
void operator=(
const vtkThreshold&);
00147 };
00148
00149
#endif