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 
00040 
00060 #ifndef __vtkEncodedGradientEstimator_h
00061 #define __vtkEncodedGradientEstimator_h
00062 
00063 #include "vtkObject.h"
00064 #include "vtkMultiThreader.h"
00065 #include "vtkImageData.h"
00066 #include "vtkDirectionEncoder.h"
00067 
00068 class VTK_EXPORT vtkEncodedGradientEstimator : public vtkObject
00069 {
00070 public:
00071   vtkTypeMacro(vtkEncodedGradientEstimator,vtkObject);
00072   void PrintSelf( ostream& os, vtkIndent index );
00073 
00075   vtkSetObjectMacro( Input, vtkImageData );
00076   vtkGetObjectMacro( Input, vtkImageData );
00077 
00079   vtkSetMacro( GradientMagnitudeScale, float );
00080   vtkGetMacro( GradientMagnitudeScale, float );
00081   vtkSetMacro( GradientMagnitudeBias, float );
00082   vtkGetMacro( GradientMagnitudeBias, float );
00083 
00086   vtkSetClampMacro( BoundsClip, int, 0, 1 );
00087   vtkGetMacro( BoundsClip, int );
00088   vtkBooleanMacro( BoundsClip, int );
00089   
00093   vtkSetVector6Macro( Bounds, int );
00094   vtkGetVectorMacro(  Bounds, int, 6 );
00095 
00097   void  Update( void );
00098 
00100   unsigned short  *GetEncodedNormals( void ); 
00101 
00103   int   GetEncodedNormalIndex( int xyz_index );
00104   int   GetEncodedNormalIndex( int x_index, int y_index, int z_index );
00105 
00107   unsigned char *GetGradientMagnitudes(void);
00108 
00111   vtkSetClampMacro( NumberOfThreads, int, 1, VTK_MAX_THREADS );
00112   vtkGetMacro( NumberOfThreads, int );
00113 
00116   void SetDirectionEncoder( vtkDirectionEncoder *direnc );
00117   vtkGetObjectMacro( DirectionEncoder, vtkDirectionEncoder );
00118 
00123   vtkSetMacro( ComputeGradientMagnitudes, int );
00124   vtkGetMacro( ComputeGradientMagnitudes, int );
00125   vtkBooleanMacro( ComputeGradientMagnitudes, int );
00126 
00131   vtkSetMacro( CylinderClip, int );
00132   vtkGetMacro( CylinderClip, int );
00133   vtkBooleanMacro( CylinderClip, int );
00134 
00136   vtkGetMacro( LastUpdateTimeInSeconds, float );
00137   vtkGetMacro( LastUpdateTimeInCPUSeconds, float );
00138 
00139   vtkGetMacro( UseCylinderClip, int );
00140   int *GetCircleLimits() { return this->CircleLimits; };
00141 
00148   void SetZeroNormalThreshold( float v );
00149   vtkGetMacro( ZeroNormalThreshold, float );
00150 
00153   vtkSetClampMacro( ZeroPad, int, 0, 1 );
00154   vtkGetMacro( ZeroPad, int );
00155   vtkBooleanMacro( ZeroPad, int );
00156   
00157   
00158   
00159   
00160   
00161   
00162 
00163   
00164   vtkImageData         *Input;
00165 
00166   
00167   unsigned short        *EncodedNormals;
00168   int                   EncodedNormalsSize[3];
00169 
00170   
00171   unsigned char         *GradientMagnitudes;
00172 
00173   
00174   vtkTimeStamp          BuildTime;
00175 
00176   vtkGetVectorMacro( InputSize, int, 3 );
00177   vtkGetVectorMacro( InputAspect, float, 3 );
00178 
00179 protected:
00180   vtkEncodedGradientEstimator();
00181   ~vtkEncodedGradientEstimator();
00182   vtkEncodedGradientEstimator(const vtkEncodedGradientEstimator&) {};
00183   void operator=(const vtkEncodedGradientEstimator&) {};
00184 
00185   
00186   int                        NumberOfThreads;
00187 
00188   vtkMultiThreader           *Threader;
00189 
00190   vtkDirectionEncoder        *DirectionEncoder;
00191 
00192   virtual void               UpdateNormals( void ) = 0;
00193 
00194   float                      GradientMagnitudeScale;
00195   float                      GradientMagnitudeBias;
00196 
00197   float                      LastUpdateTimeInSeconds;
00198   float                      LastUpdateTimeInCPUSeconds;
00199 
00200   float                      ZeroNormalThreshold;
00201 
00202   int                        CylinderClip;
00203   int                        *CircleLimits;
00204   int                        CircleLimitsSize;
00205   int                        UseCylinderClip;
00206   void                       ComputeCircleLimits( int size );
00207   
00208   int                        BoundsClip;
00209   int                        Bounds[6];
00210 
00211   int                        InputSize[3];
00212   float                      InputAspect[3];
00213 
00214   int                        ComputeGradientMagnitudes;
00215   
00216   int                        ZeroPad;
00217   
00218 }; 
00219 
00220 
00221 #endif
00222