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

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 =========================================================================*/
00056 #ifndef __vtkThreshold_h
00057 #define __vtkThreshold_h
00058 
00059 #include "vtkDataSetToUnstructuredGridFilter.h"
00060 
00061 #define VTK_ATTRIBUTE_MODE_DEFAULT 0
00062 #define VTK_ATTRIBUTE_MODE_USE_POINT_DATA 1
00063 #define VTK_ATTRIBUTE_MODE_USE_CELL_DATA 2
00064 
00065 class VTK_GRAPHICS_EXPORT vtkThreshold : public vtkDataSetToUnstructuredGridFilter
00066 {
00067 public:
00068   static vtkThreshold *New();
00069   vtkTypeRevisionMacro(vtkThreshold,vtkDataSetToUnstructuredGridFilter);
00070   void PrintSelf(ostream& os, vtkIndent indent);
00071 
00074   void ThresholdByLower(float lower);
00075 
00078   void ThresholdByUpper(float upper);
00079 
00082   void ThresholdBetween(float lower, float upper);
00083 
00085 
00086   vtkGetMacro(UpperThreshold,float);
00087   vtkGetMacro(LowerThreshold,float);
00089 
00091 
00097   vtkSetMacro(AttributeMode,int);
00098   vtkGetMacro(AttributeMode,int);
00099   void SetAttributeModeToDefault() 
00100     {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_DEFAULT);};
00101   void SetAttributeModeToUsePointData() 
00102     {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_POINT_DATA);};
00103   void SetAttributeModeToUseCellData() 
00104     {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_CELL_DATA);};
00105   const char *GetAttributeModeAsString();
00107 
00109 
00113   vtkSetMacro(AllScalars,int);
00114   vtkGetMacro(AllScalars,int);
00115   vtkBooleanMacro(AllScalars,int);
00117   
00118 protected:
00119   vtkThreshold();
00120   ~vtkThreshold();
00121 
00122 //BTX
00123   // This is temporary solution. The vtkCutMaterial must be able
00124   // to call SelectInputScalars().
00125   friend class vtkCutMaterial;
00126 
00128 
00131   vtkGetStringMacro(InputScalarsSelection);
00132   virtual void SelectInputScalars(const char *fieldName) 
00133     {this->SetInputScalarsSelection(fieldName);}
00135 //ETX
00136   
00137   // Usual data generation method
00138   void Execute();
00139 
00140   int   AllScalars;
00141   float LowerThreshold;
00142   float UpperThreshold;
00143   int   AttributeMode;
00144 
00145   //BTX
00146   int (vtkThreshold::*ThresholdFunction)(float s);
00147   //ETX
00148 
00149   int Lower(float s) {return ( s <= this->LowerThreshold ? 1 : 0 );};
00150   int Upper(float s) {return ( s >= this->UpperThreshold ? 1 : 0 );};
00151   int Between(float s) {return ( s >= this->LowerThreshold ? 
00152                                ( s <= this->UpperThreshold ? 1 : 0 ) : 0 );};
00153 
00154   char *InputScalarsSelection;
00155   vtkSetStringMacro(InputScalarsSelection);
00156 
00157 private:
00158   vtkThreshold(const vtkThreshold&);  // Not implemented.
00159   void operator=(const vtkThreshold&);  // Not implemented.
00160 };
00161 
00162 #endif