VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkGaussianSplatter.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 =========================================================================*/ 00073 #ifndef vtkGaussianSplatter_h 00074 #define vtkGaussianSplatter_h 00075 00076 #include "vtkImagingHybridModule.h" // For export macro 00077 #include "vtkImageAlgorithm.h" 00078 00079 #define VTK_ACCUMULATION_MODE_MIN 0 00080 #define VTK_ACCUMULATION_MODE_MAX 1 00081 #define VTK_ACCUMULATION_MODE_SUM 2 00082 00083 class vtkDoubleArray; 00084 class vtkCompositeDataSet; 00085 00086 class VTKIMAGINGHYBRID_EXPORT vtkGaussianSplatter : public vtkImageAlgorithm 00087 { 00088 public: 00089 vtkTypeMacro(vtkGaussianSplatter,vtkImageAlgorithm); 00090 void PrintSelf(ostream& os, vtkIndent indent); 00091 00095 static vtkGaussianSplatter *New(); 00096 00098 00100 void SetSampleDimensions(int i, int j, int k); 00101 void SetSampleDimensions(int dim[3]); 00102 vtkGetVectorMacro(SampleDimensions,int,3); 00104 00106 00110 vtkSetVector6Macro(ModelBounds,double); 00111 vtkGetVectorMacro(ModelBounds,double,6); 00113 00115 00118 vtkSetClampMacro(Radius,double,0.0,1.0); 00119 vtkGetMacro(Radius,double); 00121 00123 00126 vtkSetClampMacro(ScaleFactor,double,0.0,VTK_DOUBLE_MAX); 00127 vtkGetMacro(ScaleFactor,double); 00129 00131 00133 vtkSetMacro(ExponentFactor,double); 00134 vtkGetMacro(ExponentFactor,double); 00136 00138 00141 vtkSetMacro(NormalWarping,int); 00142 vtkGetMacro(NormalWarping,int); 00143 vtkBooleanMacro(NormalWarping,int); 00145 00147 00152 vtkSetClampMacro(Eccentricity,double,0.001,VTK_DOUBLE_MAX); 00153 vtkGetMacro(Eccentricity,double); 00155 00157 00158 vtkSetMacro(ScalarWarping,int); 00159 vtkGetMacro(ScalarWarping,int); 00160 vtkBooleanMacro(ScalarWarping,int); 00162 00164 00167 vtkSetMacro(Capping,int); 00168 vtkGetMacro(Capping,int); 00169 vtkBooleanMacro(Capping,int); 00171 00173 00175 vtkSetMacro(CapValue,double); 00176 vtkGetMacro(CapValue,double); 00178 00180 00184 vtkSetClampMacro(AccumulationMode,int, 00185 VTK_ACCUMULATION_MODE_MIN,VTK_ACCUMULATION_MODE_SUM); 00186 vtkGetMacro(AccumulationMode,int); 00187 void SetAccumulationModeToMin() 00188 {this->SetAccumulationMode(VTK_ACCUMULATION_MODE_MIN);} 00189 void SetAccumulationModeToMax() 00190 {this->SetAccumulationMode(VTK_ACCUMULATION_MODE_MAX);} 00191 void SetAccumulationModeToSum() 00192 {this->SetAccumulationMode(VTK_ACCUMULATION_MODE_SUM);} 00193 const char *GetAccumulationModeAsString(); 00195 00197 00200 vtkSetMacro(NullValue,double); 00201 vtkGetMacro(NullValue,double); 00203 00205 00207 void ComputeModelBounds(vtkDataSet *input, vtkImageData *output, 00208 vtkInformation *outInfo); 00209 void ComputeModelBounds(vtkCompositeDataSet *input, vtkImageData *output, 00210 vtkInformation *outInfo); 00212 00213 protected: 00214 vtkGaussianSplatter(); 00215 ~vtkGaussianSplatter() {} 00216 00217 virtual int FillInputPortInformation(int port, vtkInformation* info); 00218 virtual int RequestInformation (vtkInformation *, 00219 vtkInformationVector **, 00220 vtkInformationVector *); 00221 virtual int RequestData(vtkInformation *, 00222 vtkInformationVector **, 00223 vtkInformationVector *); 00224 void Cap(vtkDoubleArray *s); 00225 00226 int SampleDimensions[3]; // dimensions of volume to splat into 00227 double Radius; // maximum distance splat propagates (as fraction 0->1) 00228 double ExponentFactor; // scale exponent of gaussian function 00229 double ModelBounds[6]; // bounding box of splatting dimensions 00230 int NormalWarping; // on/off warping of splat via normal 00231 double Eccentricity;// elliptic distortion due to normals 00232 int ScalarWarping; // on/off warping of splat via scalar 00233 double ScaleFactor; // splat size influenced by scale factor 00234 int Capping; // Cap side of volume to close surfaces 00235 double CapValue; // value to use for capping 00236 int AccumulationMode; // how to combine scalar values 00237 00238 double Gaussian(double x[3]); 00239 double EccentricGaussian(double x[3]); 00240 double ScalarSampling(double s) 00241 {return this->ScaleFactor * s;} 00242 double PositionSampling(double) 00243 {return this->ScaleFactor;} 00244 void SetScalar(int idx, double dist2, vtkDoubleArray *newScalars); 00245 00246 //BTX 00247 private: 00248 double Radius2; 00249 double (vtkGaussianSplatter::*Sample)(double x[3]); 00250 double (vtkGaussianSplatter::*SampleFactor)(double s); 00251 char *Visited; 00252 double Eccentricity2; 00253 double *P; 00254 double *N; 00255 double S; 00256 double Origin[3]; 00257 double Spacing[3]; 00258 double SplatDistance[3]; 00259 double NullValue; 00260 //ETX 00261 00262 private: 00263 vtkGaussianSplatter(const vtkGaussianSplatter&); // Not implemented. 00264 void operator=(const vtkGaussianSplatter&); // Not implemented. 00265 }; 00266 00267 #endif 00268 00269