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 00085 class VTKIMAGINGHYBRID_EXPORT vtkGaussianSplatter : public vtkImageAlgorithm 00086 { 00087 public: 00088 vtkTypeMacro(vtkGaussianSplatter,vtkImageAlgorithm); 00089 void PrintSelf(ostream& os, vtkIndent indent); 00090 00094 static vtkGaussianSplatter *New(); 00095 00097 00099 void SetSampleDimensions(int i, int j, int k); 00100 void SetSampleDimensions(int dim[3]); 00101 vtkGetVectorMacro(SampleDimensions,int,3); 00103 00105 00109 vtkSetVector6Macro(ModelBounds,double); 00110 vtkGetVectorMacro(ModelBounds,double,6); 00112 00114 00117 vtkSetClampMacro(Radius,double,0.0,1.0); 00118 vtkGetMacro(Radius,double); 00120 00122 00125 vtkSetClampMacro(ScaleFactor,double,0.0,VTK_DOUBLE_MAX); 00126 vtkGetMacro(ScaleFactor,double); 00128 00130 00132 vtkSetMacro(ExponentFactor,double); 00133 vtkGetMacro(ExponentFactor,double); 00135 00137 00140 vtkSetMacro(NormalWarping,int); 00141 vtkGetMacro(NormalWarping,int); 00142 vtkBooleanMacro(NormalWarping,int); 00144 00146 00151 vtkSetClampMacro(Eccentricity,double,0.001,VTK_DOUBLE_MAX); 00152 vtkGetMacro(Eccentricity,double); 00154 00156 00157 vtkSetMacro(ScalarWarping,int); 00158 vtkGetMacro(ScalarWarping,int); 00159 vtkBooleanMacro(ScalarWarping,int); 00161 00163 00166 vtkSetMacro(Capping,int); 00167 vtkGetMacro(Capping,int); 00168 vtkBooleanMacro(Capping,int); 00170 00172 00174 vtkSetMacro(CapValue,double); 00175 vtkGetMacro(CapValue,double); 00177 00179 00183 vtkSetClampMacro(AccumulationMode,int, 00184 VTK_ACCUMULATION_MODE_MIN,VTK_ACCUMULATION_MODE_SUM); 00185 vtkGetMacro(AccumulationMode,int); 00186 void SetAccumulationModeToMin() 00187 {this->SetAccumulationMode(VTK_ACCUMULATION_MODE_MIN);} 00188 void SetAccumulationModeToMax() 00189 {this->SetAccumulationMode(VTK_ACCUMULATION_MODE_MAX);} 00190 void SetAccumulationModeToSum() 00191 {this->SetAccumulationMode(VTK_ACCUMULATION_MODE_SUM);} 00192 const char *GetAccumulationModeAsString(); 00194 00196 00199 vtkSetMacro(NullValue,double); 00200 vtkGetMacro(NullValue,double); 00202 00204 00206 void ComputeModelBounds(vtkDataSet *input, vtkImageData *output, 00207 vtkInformation *outInfo); 00209 00210 protected: 00211 vtkGaussianSplatter(); 00212 ~vtkGaussianSplatter() {} 00213 00214 virtual int FillInputPortInformation(int port, vtkInformation* info); 00215 virtual int RequestInformation (vtkInformation *, 00216 vtkInformationVector **, 00217 vtkInformationVector *); 00218 virtual int RequestData(vtkInformation *, 00219 vtkInformationVector **, 00220 vtkInformationVector *); 00221 void Cap(vtkDoubleArray *s); 00222 00223 int SampleDimensions[3]; // dimensions of volume to splat into 00224 double Radius; // maximum distance splat propagates (as fraction 0->1) 00225 double ExponentFactor; // scale exponent of gaussian function 00226 double ModelBounds[6]; // bounding box of splatting dimensions 00227 int NormalWarping; // on/off warping of splat via normal 00228 double Eccentricity;// elliptic distortion due to normals 00229 int ScalarWarping; // on/off warping of splat via scalar 00230 double ScaleFactor; // splat size influenced by scale factor 00231 int Capping; // Cap side of volume to close surfaces 00232 double CapValue; // value to use for capping 00233 int AccumulationMode; // how to combine scalar values 00234 00235 double Gaussian(double x[3]); 00236 double EccentricGaussian(double x[3]); 00237 double ScalarSampling(double s) 00238 {return this->ScaleFactor * s;} 00239 double PositionSampling(double) 00240 {return this->ScaleFactor;} 00241 void SetScalar(int idx, double dist2, vtkDoubleArray *newScalars); 00242 00243 //BTX 00244 private: 00245 double Radius2; 00246 double (vtkGaussianSplatter::*Sample)(double x[3]); 00247 double (vtkGaussianSplatter::*SampleFactor)(double s); 00248 char *Visited; 00249 double Eccentricity2; 00250 double *P; 00251 double *N; 00252 double S; 00253 double Origin[3]; 00254 double Spacing[3]; 00255 double SplatDistance[3]; 00256 double NullValue; 00257 //ETX 00258 00259 private: 00260 vtkGaussianSplatter(const vtkGaussianSplatter&); // Not implemented. 00261 void operator=(const vtkGaussianSplatter&); // Not implemented. 00262 }; 00263 00264 #endif 00265 00266