Graphics/vtkThreshold.h Source File

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