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 "vtkImageAlgorithm.h" 00077 00078 #define VTK_ACCUMULATION_MODE_MIN 0 00079 #define VTK_ACCUMULATION_MODE_MAX 1 00080 #define VTK_ACCUMULATION_MODE_SUM 2 00081 00082 class vtkDoubleArray; 00083 00084 class VTK_IMAGING_EXPORT vtkGaussianSplatter : public vtkImageAlgorithm 00085 { 00086 public: 00087 vtkTypeMacro(vtkGaussianSplatter,vtkImageAlgorithm); 00088 void PrintSelf(ostream& os, vtkIndent indent); 00089 00093 static vtkGaussianSplatter *New(); 00094 00096 00098 void SetSampleDimensions(int i, int j, int k); 00099 void SetSampleDimensions(int dim[3]); 00100 vtkGetVectorMacro(SampleDimensions,int,3); 00102 00104 00108 vtkSetVector6Macro(ModelBounds,double); 00109 vtkGetVectorMacro(ModelBounds,double,6); 00111 00113 00116 vtkSetClampMacro(Radius,double,0.0,1.0); 00117 vtkGetMacro(Radius,double); 00119 00121 00124 vtkSetClampMacro(ScaleFactor,double,0.0,VTK_DOUBLE_MAX); 00125 vtkGetMacro(ScaleFactor,double); 00127 00129 00131 vtkSetMacro(ExponentFactor,double); 00132 vtkGetMacro(ExponentFactor,double); 00134 00136 00139 vtkSetMacro(NormalWarping,int); 00140 vtkGetMacro(NormalWarping,int); 00141 vtkBooleanMacro(NormalWarping,int); 00143 00145 00150 vtkSetClampMacro(Eccentricity,double,0.001,VTK_DOUBLE_MAX); 00151 vtkGetMacro(Eccentricity,double); 00153 00155 00156 vtkSetMacro(ScalarWarping,int); 00157 vtkGetMacro(ScalarWarping,int); 00158 vtkBooleanMacro(ScalarWarping,int); 00160 00162 00165 vtkSetMacro(Capping,int); 00166 vtkGetMacro(Capping,int); 00167 vtkBooleanMacro(Capping,int); 00169 00171 00173 vtkSetMacro(CapValue,double); 00174 vtkGetMacro(CapValue,double); 00176 00178 00182 vtkSetClampMacro(AccumulationMode,int, 00183 VTK_ACCUMULATION_MODE_MIN,VTK_ACCUMULATION_MODE_SUM); 00184 vtkGetMacro(AccumulationMode,int); 00185 void SetAccumulationModeToMin() 00186 {this->SetAccumulationMode(VTK_ACCUMULATION_MODE_MIN);} 00187 void SetAccumulationModeToMax() 00188 {this->SetAccumulationMode(VTK_ACCUMULATION_MODE_MAX);} 00189 void SetAccumulationModeToSum() 00190 {this->SetAccumulationMode(VTK_ACCUMULATION_MODE_SUM);} 00191 const char *GetAccumulationModeAsString(); 00193 00195 00198 vtkSetMacro(NullValue,double); 00199 vtkGetMacro(NullValue,double); 00201 00203 00205 void ComputeModelBounds(vtkDataSet *input, vtkImageData *output, 00206 vtkInformation *outInfo); 00208 00209 protected: 00210 vtkGaussianSplatter(); 00211 ~vtkGaussianSplatter() {}; 00212 00213 virtual int FillInputPortInformation(int port, vtkInformation* info); 00214 virtual int RequestInformation (vtkInformation *, 00215 vtkInformationVector **, 00216 vtkInformationVector *); 00217 virtual int RequestData(vtkInformation *, 00218 vtkInformationVector **, 00219 vtkInformationVector *); 00220 void Cap(vtkDoubleArray *s); 00221 00222 int SampleDimensions[3]; // dimensions of volume to splat into 00223 double Radius; // maximum distance splat propagates (as fraction 0->1) 00224 double ExponentFactor; // scale exponent of gaussian function 00225 double ModelBounds[6]; // bounding box of splatting dimensions 00226 int NormalWarping; // on/off warping of splat via normal 00227 double Eccentricity;// elliptic distortion due to normals 00228 int ScalarWarping; // on/off warping of splat via scalar 00229 double ScaleFactor; // splat size influenced by scale factor 00230 int Capping; // Cap side of volume to close surfaces 00231 double CapValue; // value to use for capping 00232 int AccumulationMode; // how to combine scalar values 00233 00234 double Gaussian(double x[3]); 00235 double EccentricGaussian(double x[3]); 00236 double ScalarSampling(double s) 00237 {return this->ScaleFactor * s;} 00238 double PositionSampling(double) 00239 {return this->ScaleFactor;} 00240 void SetScalar(int idx, double dist2, vtkDoubleArray *newScalars); 00241 00242 //BTX 00243 private: 00244 double Radius2; 00245 double (vtkGaussianSplatter::*Sample)(double x[3]); 00246 double (vtkGaussianSplatter::*SampleFactor)(double s); 00247 char *Visited; 00248 double Eccentricity2; 00249 double *P; 00250 double *N; 00251 double S; 00252 double Origin[3]; 00253 double Spacing[3]; 00254 double SplatDistance[3]; 00255 double NullValue; 00256 //ETX 00257 00258 private: 00259 vtkGaussianSplatter(const vtkGaussianSplatter&); // Not implemented. 00260 void operator=(const vtkGaussianSplatter&); // Not implemented. 00261 }; 00262 00263 #endif 00264 00265