Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

dox/Graphics/vtkThreshold.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkThreshold.h,v $ 00005 Language: C++ 00006 00007 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 00008 All rights reserved. 00009 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notice for more information. 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 //BTX 00110 // This is temporary solution. The vtkCutMaterial must be able 00111 // to call SelectInputScalars(). 00112 friend class vtkCutMaterial; 00113 00115 00118 vtkGetStringMacro(InputScalarsSelection); 00119 virtual void SelectInputScalars(const char *fieldName) 00120 {this->SetInputScalarsSelection(fieldName);} 00122 //ETX 00123 00124 // Usual data generation method 00125 void Execute(); 00126 00127 int AllScalars; 00128 float LowerThreshold; 00129 float UpperThreshold; 00130 int AttributeMode; 00131 00132 //BTX 00133 int (vtkThreshold::*ThresholdFunction)(float s); 00134 //ETX 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&); // Not implemented. 00146 void operator=(const vtkThreshold&); // Not implemented. 00147 }; 00148 00149 #endif