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 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 "vtkDataSetToUnstructuredGridFilter.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 vtkDataSetToUnstructuredGridFilter 00059 { 00060 public: 00061 static vtkThreshold *New(); 00062 vtkTypeRevisionMacro(vtkThreshold,vtkDataSetToUnstructuredGridFilter); 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 00139 00142 vtkGetStringMacro(InputScalarsSelection); 00143 virtual void SelectInputScalars(const char *fieldName) 00144 {this->SetInputScalarsSelection(fieldName);} 00146 00147 protected: 00148 vtkThreshold(); 00149 ~vtkThreshold(); 00150 00151 // Usual data generation method 00152 void Execute(); 00153 00154 int AllScalars; 00155 double LowerThreshold; 00156 double UpperThreshold; 00157 int AttributeMode; 00158 int ComponentMode; 00159 int SelectedComponent; 00160 00161 //BTX 00162 int (vtkThreshold::*ThresholdFunction)(double s); 00163 //ETX 00164 00165 int Lower(double s) {return ( s <= this->LowerThreshold ? 1 : 0 );}; 00166 int Upper(double s) {return ( s >= this->UpperThreshold ? 1 : 0 );}; 00167 int Between(double s) {return ( s >= this->LowerThreshold ? 00168 ( s <= this->UpperThreshold ? 1 : 0 ) : 0 );}; 00169 00170 char *InputScalarsSelection; 00171 vtkSetStringMacro(InputScalarsSelection); 00172 00173 int EvaluateComponents( vtkDataArray *scalars, vtkIdType id ); 00174 00175 private: 00176 vtkThreshold(const vtkThreshold&); // Not implemented. 00177 void operator=(const vtkThreshold&); // Not implemented. 00178 }; 00179 00180 #endif