VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkImplicitModeller.h 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 =========================================================================*/ 00092 #ifndef __vtkImplicitModeller_h 00093 #define __vtkImplicitModeller_h 00094 00095 #include "vtkImageAlgorithm.h" 00096 00097 #define VTK_VOXEL_MODE 0 00098 #define VTK_CELL_MODE 1 00099 00100 class vtkDataArray; 00101 class vtkExtractGeometry; 00102 class vtkMultiThreader; 00103 00104 class VTK_HYBRID_EXPORT vtkImplicitModeller : public vtkImageAlgorithm 00105 { 00106 public: 00107 vtkTypeMacro(vtkImplicitModeller,vtkImageAlgorithm); 00108 void PrintSelf(ostream& os, vtkIndent indent); 00109 00113 static vtkImplicitModeller *New(); 00114 00117 double ComputeModelBounds(vtkDataSet *input = NULL); 00118 00120 00121 vtkGetVectorMacro(SampleDimensions,int,3); 00122 void SetSampleDimensions(int i, int j, int k); 00123 void SetSampleDimensions(int dim[3]); 00125 00127 00129 vtkSetClampMacro(MaximumDistance,double,0.0,1.0); 00130 vtkGetMacro(MaximumDistance,double); 00132 00134 00136 vtkSetVector6Macro(ModelBounds,double); 00137 vtkGetVectorMacro(ModelBounds,double,6); 00139 00141 00145 vtkSetMacro(AdjustBounds,int); 00146 vtkGetMacro(AdjustBounds,int); 00147 vtkBooleanMacro(AdjustBounds,int); 00149 00151 00154 vtkSetClampMacro(AdjustDistance,double,-1.0,1.0); 00155 vtkGetMacro(AdjustDistance,double); 00157 00159 00161 vtkSetMacro(Capping,int); 00162 vtkGetMacro(Capping,int); 00163 vtkBooleanMacro(Capping,int); 00165 00167 00169 void SetCapValue(double value); 00170 vtkGetMacro(CapValue,double); 00172 00174 00182 vtkSetMacro(ScaleToMaximumDistance, int); 00183 vtkGetMacro(ScaleToMaximumDistance, int); 00184 vtkBooleanMacro(ScaleToMaximumDistance,int); 00186 00188 00193 vtkSetClampMacro(ProcessMode, int, 0, 1); 00194 vtkGetMacro(ProcessMode, int); 00195 void SetProcessModeToPerVoxel() {this->SetProcessMode(VTK_VOXEL_MODE);} 00196 void SetProcessModeToPerCell() {this->SetProcessMode(VTK_CELL_MODE);} 00197 const char *GetProcessModeAsString(void); 00199 00201 00203 vtkSetMacro(LocatorMaxLevel,int); 00204 vtkGetMacro(LocatorMaxLevel,int); 00206 00208 00209 vtkSetClampMacro( NumberOfThreads, int, 1, VTK_MAX_THREADS ); 00210 vtkGetMacro( NumberOfThreads, int ); 00212 00214 00215 void SetOutputScalarType(int type); 00216 vtkGetMacro(OutputScalarType,int); 00217 void SetOutputScalarTypeToFloat(){this->SetOutputScalarType(VTK_FLOAT);}; 00218 void SetOutputScalarTypeToDouble(){this->SetOutputScalarType(VTK_DOUBLE);}; 00219 void SetOutputScalarTypeToInt(){this->SetOutputScalarType(VTK_INT);}; 00220 void SetOutputScalarTypeToUnsignedInt() 00221 {this->SetOutputScalarType(VTK_UNSIGNED_INT);}; 00222 void SetOutputScalarTypeToLong(){this->SetOutputScalarType(VTK_LONG);}; 00223 void SetOutputScalarTypeToUnsignedLong() 00224 {this->SetOutputScalarType(VTK_UNSIGNED_LONG);}; 00225 void SetOutputScalarTypeToShort(){this->SetOutputScalarType(VTK_SHORT);}; 00226 void SetOutputScalarTypeToUnsignedShort() 00227 {this->SetOutputScalarType(VTK_UNSIGNED_SHORT);}; 00228 void SetOutputScalarTypeToUnsignedChar() 00229 {this->SetOutputScalarType(VTK_UNSIGNED_CHAR);}; 00230 void SetOutputScalarTypeToChar() 00231 {this->SetOutputScalarType(VTK_CHAR);}; 00233 00238 void StartAppend(); 00239 00245 void Append(vtkDataSet *input); 00246 00248 void EndAppend(); 00249 00250 // See the vtkAlgorithm for a desciption of what these do 00251 int ProcessRequest(vtkInformation*, 00252 vtkInformationVector**, 00253 vtkInformationVector*); 00254 00255 protected: 00256 vtkImplicitModeller(); 00257 ~vtkImplicitModeller(); 00258 00259 double GetScalarTypeMax(int type); 00260 00261 virtual int RequestInformation (vtkInformation *, 00262 vtkInformationVector **, 00263 vtkInformationVector *); 00264 virtual int RequestData (vtkInformation *, 00265 vtkInformationVector **, vtkInformationVector *); 00266 00267 void StartAppend(int internal); 00268 void Cap(vtkDataArray *s); 00269 00270 vtkMultiThreader *Threader; 00271 int NumberOfThreads; 00272 00273 int SampleDimensions[3]; 00274 double MaximumDistance; 00275 double ModelBounds[6]; 00276 int Capping; 00277 double CapValue; 00278 int DataAppended; 00279 int AdjustBounds; 00280 double AdjustDistance; 00281 int ProcessMode; 00282 int LocatorMaxLevel; 00283 int OutputScalarType; 00284 int ScaleToMaximumDistance; 00285 00286 // flag to limit to one ComputeModelBounds per StartAppend 00287 int BoundsComputed; 00288 00289 // the max distance computed during that one call 00290 double InternalMaxDistance; 00291 00292 virtual int FillInputPortInformation(int, vtkInformation*); 00293 00294 private: 00295 vtkImplicitModeller(const vtkImplicitModeller&); // Not implemented. 00296 void operator=(const vtkImplicitModeller&); // Not implemented. 00297 }; 00298 00299 #endif 00300 00301