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

vtkThreshold.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkThreshold.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
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 // order / values are important because of the SetClampMacro
00066 #define VTK_COMPONENT_MODE_USE_SELECTED    0
00067 #define VTK_COMPONENT_MODE_USE_ALL         1
00068 #define VTK_COMPONENT_MODE_USE_ANY         2
00069 
00070 class vtkDataArray;
00071 
00072 class VTK_GRAPHICS_EXPORT vtkThreshold : public vtkDataSetToUnstructuredGridFilter
00073 {
00074 public:
00075   static vtkThreshold *New();
00076   vtkTypeRevisionMacro(vtkThreshold,vtkDataSetToUnstructuredGridFilter);
00077   void PrintSelf(ostream& os, vtkIndent indent);
00078 
00081   void ThresholdByLower(double lower);
00082 
00085   void ThresholdByUpper(double upper);
00086 
00089   void ThresholdBetween(double lower, double upper);
00090 
00092 
00093   vtkGetMacro(UpperThreshold,double);
00094   vtkGetMacro(LowerThreshold,double);
00096 
00098 
00104   vtkSetMacro(AttributeMode,int);
00105   vtkGetMacro(AttributeMode,int);
00106   void SetAttributeModeToDefault() 
00107     {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_DEFAULT);};
00108   void SetAttributeModeToUsePointData() 
00109     {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_POINT_DATA);};
00110   void SetAttributeModeToUseCellData() 
00111     {this->SetAttributeMode(VTK_ATTRIBUTE_MODE_USE_CELL_DATA);};
00112   const char *GetAttributeModeAsString();
00114 
00116 
00122   vtkSetClampMacro(ComponentMode,int,
00123                    VTK_COMPONENT_MODE_USE_SELECTED,
00124                    VTK_COMPONENT_MODE_USE_ANY);
00125   vtkGetMacro(ComponentMode,int);
00126   void SetComponentModeToUseSelected() 
00127     {this->SetComponentMode(VTK_COMPONENT_MODE_USE_SELECTED);};
00128   void SetComponentModeToUseAll() 
00129     {this->SetComponentMode(VTK_COMPONENT_MODE_USE_ALL);};
00130   void SetComponentModeToUseAny() 
00131     {this->SetComponentMode(VTK_COMPONENT_MODE_USE_ANY);};
00132   const char *GetComponentModeAsString();
00134   
00136 
00138   vtkSetClampMacro(SelectedComponent,int,0,VTK_INT_MAX);
00139   vtkGetMacro(SelectedComponent,int);
00141   
00143 
00147   vtkSetMacro(AllScalars,int);
00148   vtkGetMacro(AllScalars,int);
00149   vtkBooleanMacro(AllScalars,int);
00151   
00153 
00156   vtkGetStringMacro(InputScalarsSelection);
00157   virtual void SelectInputScalars(const char *fieldName) 
00158     {this->SetInputScalarsSelection(fieldName);}
00160 
00161 protected:
00162   vtkThreshold();
00163   ~vtkThreshold();
00164 
00165   // Usual data generation method
00166   void Execute();
00167 
00168   int    AllScalars;
00169   double LowerThreshold;
00170   double UpperThreshold;
00171   int    AttributeMode;
00172   int    ComponentMode;
00173   int    SelectedComponent;
00174   
00175   //BTX
00176   int (vtkThreshold::*ThresholdFunction)(double s);
00177   //ETX
00178 
00179   int Lower(double s) {return ( s <= this->LowerThreshold ? 1 : 0 );};
00180   int Upper(double s) {return ( s >= this->UpperThreshold ? 1 : 0 );};
00181   int Between(double s) {return ( s >= this->LowerThreshold ? 
00182                                ( s <= this->UpperThreshold ? 1 : 0 ) : 0 );};
00183 
00184   char *InputScalarsSelection;
00185   vtkSetStringMacro(InputScalarsSelection);
00186 
00187   int EvaluateComponents( vtkDataArray *scalars, vtkIdType id );
00188   
00189 private:
00190   vtkThreshold(const vtkThreshold&);  // Not implemented.
00191   void operator=(const vtkThreshold&);  // Not implemented.
00192 };
00193 
00194 #endif