VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkGaussianSplatter.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 =========================================================================*/ 00070 #ifndef __vtkGaussianSplatter_h 00071 #define __vtkGaussianSplatter_h 00072 00073 #include "vtkImageAlgorithm.h" 00074 00075 #define VTK_ACCUMULATION_MODE_MIN 0 00076 #define VTK_ACCUMULATION_MODE_MAX 1 00077 #define VTK_ACCUMULATION_MODE_SUM 2 00078 00079 class vtkDoubleArray; 00080 00081 class VTK_IMAGING_EXPORT vtkGaussianSplatter : public vtkImageAlgorithm 00082 { 00083 public: 00084 vtkTypeRevisionMacro(vtkGaussianSplatter,vtkImageAlgorithm); 00085 void PrintSelf(ostream& os, vtkIndent indent); 00086 00090 static vtkGaussianSplatter *New(); 00091 00093 00095 void SetSampleDimensions(int i, int j, int k); 00096 void SetSampleDimensions(int dim[3]); 00097 vtkGetVectorMacro(SampleDimensions,int,3); 00099 00101 00105 vtkSetVector6Macro(ModelBounds,double); 00106 vtkGetVectorMacro(ModelBounds,double,6); 00108 00110 00113 vtkSetClampMacro(Radius,double,0.0,1.0); 00114 vtkGetMacro(Radius,double); 00116 00118 00121 vtkSetClampMacro(ScaleFactor,double,0.0,VTK_DOUBLE_MAX); 00122 vtkGetMacro(ScaleFactor,double); 00124 00126 00128 vtkSetMacro(ExponentFactor,double); 00129 vtkGetMacro(ExponentFactor,double); 00131 00133 00136 vtkSetMacro(NormalWarping,int); 00137 vtkGetMacro(NormalWarping,int); 00138 vtkBooleanMacro(NormalWarping,int); 00140 00142 00147 vtkSetClampMacro(Eccentricity,double,0.001,VTK_DOUBLE_MAX); 00148 vtkGetMacro(Eccentricity,double); 00150 00152 00153 vtkSetMacro(ScalarWarping,int); 00154 vtkGetMacro(ScalarWarping,int); 00155 vtkBooleanMacro(ScalarWarping,int); 00157 00159 00162 vtkSetMacro(Capping,int); 00163 vtkGetMacro(Capping,int); 00164 vtkBooleanMacro(Capping,int); 00166 00168 00170 vtkSetMacro(CapValue,double); 00171 vtkGetMacro(CapValue,double); 00173 00175 00179 vtkSetClampMacro(AccumulationMode,int, 00180 VTK_ACCUMULATION_MODE_MIN,VTK_ACCUMULATION_MODE_SUM); 00181 vtkGetMacro(AccumulationMode,int); 00182 void SetAccumulationModeToMin() 00183 {this->SetAccumulationMode(VTK_ACCUMULATION_MODE_MIN);} 00184 void SetAccumulationModeToMax() 00185 {this->SetAccumulationMode(VTK_ACCUMULATION_MODE_MAX);} 00186 void SetAccumulationModeToSum() 00187 {this->SetAccumulationMode(VTK_ACCUMULATION_MODE_SUM);} 00188 const char *GetAccumulationModeAsString(); 00190 00192 00195 vtkSetMacro(NullValue,double); 00196 vtkGetMacro(NullValue,double); 00198 00200 00202 void ComputeModelBounds(vtkDataSet *input, vtkImageData *output, 00203 vtkInformation *outInfo); 00205 00206 protected: 00207 vtkGaussianSplatter(); 00208 ~vtkGaussianSplatter() {}; 00209 00210 virtual int FillInputPortInformation(int port, vtkInformation* info); 00211 virtual int RequestInformation (vtkInformation *, 00212 vtkInformationVector **, 00213 vtkInformationVector *); 00214 virtual int RequestData(vtkInformation *, 00215 vtkInformationVector **, 00216 vtkInformationVector *); 00217 void Cap(vtkDoubleArray *s); 00218 00219 int SampleDimensions[3]; // dimensions of volume to splat into 00220 double Radius; // maximum distance splat propagates (as fraction 0->1) 00221 double ExponentFactor; // scale exponent of gaussian function 00222 double ModelBounds[6]; // bounding box of splatting dimensions 00223 int NormalWarping; // on/off warping of splat via normal 00224 double Eccentricity;// elliptic distortion due to normals 00225 int ScalarWarping; // on/off warping of splat via scalar 00226 double ScaleFactor; // splat size influenced by scale factor 00227 int Capping; // Cap side of volume to close surfaces 00228 double CapValue; // value to use for capping 00229 int AccumulationMode; // how to combine scalar values 00230 00231 double Gaussian(double x[3]); 00232 double EccentricGaussian(double x[3]); 00233 double ScalarSampling(double s) 00234 {return this->ScaleFactor * s;} 00235 double PositionSampling(double) 00236 {return this->ScaleFactor;} 00237 void SetScalar(int idx, double dist2, vtkDoubleArray *newScalars); 00238 00239 //BTX 00240 private: 00241 double Radius2; 00242 double (vtkGaussianSplatter::*Sample)(double x[3]); 00243 double (vtkGaussianSplatter::*SampleFactor)(double s); 00244 char *Visited; 00245 double Eccentricity2; 00246 double *P; 00247 double *N; 00248 double S; 00249 double Origin[3]; 00250 double Spacing[3]; 00251 double SplatDistance[3]; 00252 double NullValue; 00253 //ETX 00254 00255 private: 00256 vtkGaussianSplatter(const vtkGaussianSplatter&); // Not implemented. 00257 void operator=(const vtkGaussianSplatter&); // Not implemented. 00258 }; 00259 00260 #endif 00261 00262