Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | 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 =========================================================================*/
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 // order / values are important because of the SetClampMacro
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   vtkTypeRevisionMacro(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   
00138 protected:
00139   vtkThreshold();
00140   ~vtkThreshold();
00141 
00142   // Usual data generation method
00143   virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00144 
00145   virtual int FillInputPortInformation(int port, vtkInformation *info);
00146 
00147   int    AllScalars;
00148   double LowerThreshold;
00149   double UpperThreshold;
00150   int    AttributeMode;
00151   int    ComponentMode;
00152   int    SelectedComponent;
00153   
00154   //BTX
00155   int (vtkThreshold::*ThresholdFunction)(double s);
00156   //ETX
00157 
00158   int Lower(double s) {return ( s <= this->LowerThreshold ? 1 : 0 );};
00159   int Upper(double s) {return ( s >= this->UpperThreshold ? 1 : 0 );};
00160   int Between(double s) {return ( s >= this->LowerThreshold ? 
00161                                ( s <= this->UpperThreshold ? 1 : 0 ) : 0 );};
00162 
00163   int EvaluateComponents( vtkDataArray *scalars, vtkIdType id );
00164   
00165 private:
00166   vtkThreshold(const vtkThreshold&);  // Not implemented.
00167   void operator=(const vtkThreshold&);  // Not implemented.
00168 };
00169 
00170 #endif

Generated on Mon Jan 21 23:07:26 2008 for VTK by  doxygen 1.4.3-20050530