00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00057 #ifndef __vtkGaussianSplatter_h
00058 #define __vtkGaussianSplatter_h
00059 
00060 #include "vtkDataSetToStructuredPointsFilter.h"
00061 
00062 #define VTK_ACCUMULATION_MODE_MIN 0
00063 #define VTK_ACCUMULATION_MODE_MAX 1
00064 #define VTK_ACCUMULATION_MODE_SUM 2
00065 
00066 class VTK_EXPORT vtkGaussianSplatter : public vtkDataSetToStructuredPointsFilter 
00067 {
00068 public:
00069   vtkTypeMacro(vtkGaussianSplatter,vtkDataSetToStructuredPointsFilter);
00070   void PrintSelf(ostream& os, vtkIndent indent);
00071 
00075   static vtkGaussianSplatter *New();
00076 
00079   void ComputeModelBounds();
00080 
00082   void SetSampleDimensions(int i, int j, int k);
00083   void SetSampleDimensions(int dim[3]);
00084   vtkGetVectorMacro(SampleDimensions,int,3);
00085 
00089   vtkSetClampMacro(Radius,float,0.0,1.0);
00090   vtkGetMacro(Radius,float);
00091 
00093   vtkSetClampMacro(ScaleFactor,float,0.0,VTK_LARGE_FLOAT);
00094   vtkGetMacro(ScaleFactor,float);
00095 
00097   vtkSetMacro(ExponentFactor,float);
00098   vtkGetMacro(ExponentFactor,float);
00099 
00103   vtkSetClampMacro(Eccentricity,float,0.001,VTK_LARGE_FLOAT);
00104   vtkGetMacro(Eccentricity,float);
00105 
00108   vtkSetVector6Macro(ModelBounds,float);
00109   vtkGetVectorMacro(ModelBounds,float,6);
00110 
00112   vtkSetMacro(NormalWarping,int);
00113   vtkGetMacro(NormalWarping,int);
00114   vtkBooleanMacro(NormalWarping,int);
00115 
00117   vtkSetMacro(ScalarWarping,int);
00118   vtkGetMacro(ScalarWarping,int);
00119   vtkBooleanMacro(ScalarWarping,int);
00120 
00123   vtkSetMacro(Capping,int);
00124   vtkGetMacro(Capping,int);
00125   vtkBooleanMacro(Capping,int);
00126   
00128   vtkSetMacro(CapValue,float);
00129   vtkGetMacro(CapValue,float);
00130 
00133   vtkSetClampMacro(AccumulationMode,int,
00134                    VTK_ACCUMULATION_MODE_MIN,VTK_ACCUMULATION_MODE_SUM);
00135   vtkGetMacro(AccumulationMode,int);
00136   void SetAccumulationModeToMin()
00137     {this->SetAccumulationMode(VTK_ACCUMULATION_MODE_MIN);}
00138   void SetAccumulationModeToMax()
00139     {this->SetAccumulationMode(VTK_ACCUMULATION_MODE_MAX);}
00140   void SetAccumulationModeToSum()
00141     {this->SetAccumulationMode(VTK_ACCUMULATION_MODE_SUM);}
00142   const char *GetAccumulationModeAsString();
00143 
00144 protected:
00145   vtkGaussianSplatter();
00146   ~vtkGaussianSplatter() {};
00147   vtkGaussianSplatter(const vtkGaussianSplatter&) {};
00148   void operator=(const vtkGaussianSplatter&) {};
00149 
00150   void Execute();
00151   void Cap(vtkScalars *s);
00152 
00153   int SampleDimensions[3]; 
00154   float Radius; 
00155   float ExponentFactor; 
00156   float ModelBounds[6]; 
00157   int NormalWarping; 
00158   float Eccentricity;
00159   int ScalarWarping; 
00160   float ScaleFactor; 
00161   int Capping; 
00162   float CapValue; 
00163   int AccumulationMode; 
00164 
00165   
00166   void SplitIJK(int i, int idir, int j, int jdir, int k, int kdir);
00167   void SplitIJ(int i, int idir, int j, int jdir, int k);
00168   void SplitIK(int i, int idir, int j, int k, int kdir);
00169   void SplitJK(int i, int j, int jdir, int k, int kdir);
00170   void SplitI(int i, int idir, int j, int k);
00171   void SplitJ(int i, int j, int jdir, int k);
00172   void SplitK(int i, int j, int k, int kdir);
00173 
00174   float Gaussian(float x[3]);  
00175   float EccentricGaussian(float x[3]);  
00176   float ScalarSampling(float s) {return this->ScaleFactor * s;};
00177   float PositionSampling(float) {return this->ScaleFactor;};
00178   void SetScalar(int idx, float dist2);
00179 
00180 
00181 private:
00182   vtkScalars *NewScalars;
00183   float Radius2;
00184   float (vtkGaussianSplatter::*Sample)(float x[3]);
00185   float (vtkGaussianSplatter::*SampleFactor)(float s);
00186   char *Visited;
00187   float Eccentricity2;
00188   float *P;
00189   float *N;
00190   float S;
00191   float Origin[3];
00192   float Spacing[3];
00193 
00194 
00195 };
00196 
00197 #endif
00198 
00199