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
00061 #ifndef __vtkEncodedGradientEstimator_h
00062 #define __vtkEncodedGradientEstimator_h
00063
00064 #include "vtkObject.h"
00065 #include "vtkMultiThreader.h"
00066 #include "vtkImageData.h"
00067 #include "vtkDirectionEncoder.h"
00068
00069 class VTK_RENDERING_EXPORT vtkEncodedGradientEstimator : public vtkObject
00070 {
00071 public:
00072 vtkTypeMacro(vtkEncodedGradientEstimator,vtkObject);
00073 void PrintSelf( ostream& os, vtkIndent index );
00074
00076
00077 vtkSetObjectMacro( Input, vtkImageData );
00078 vtkGetObjectMacro( Input, vtkImageData );
00080
00082
00083 vtkSetMacro( GradientMagnitudeScale, float );
00084 vtkGetMacro( GradientMagnitudeScale, float );
00085 vtkSetMacro( GradientMagnitudeBias, float );
00086 vtkGetMacro( GradientMagnitudeBias, float );
00088
00090
00092 vtkSetClampMacro( BoundsClip, int, 0, 1 );
00093 vtkGetMacro( BoundsClip, int );
00094 vtkBooleanMacro( BoundsClip, int );
00096
00098
00101 vtkSetVector6Macro( Bounds, int );
00102 vtkGetVectorMacro( Bounds, int, 6 );
00104
00106 void Update( void );
00107
00109 unsigned short *GetEncodedNormals( void );
00110
00112
00113 int GetEncodedNormalIndex( int xyz_index );
00114 int GetEncodedNormalIndex( int x_index, int y_index, int z_index );
00116
00118 unsigned char *GetGradientMagnitudes(void);
00119
00121
00123 vtkSetClampMacro( NumberOfThreads, int, 1, VTK_MAX_THREADS );
00124 vtkGetMacro( NumberOfThreads, int );
00126
00128
00130 void SetDirectionEncoder( vtkDirectionEncoder *direnc );
00131 vtkGetObjectMacro( DirectionEncoder, vtkDirectionEncoder );
00133
00135
00139 vtkSetMacro( ComputeGradientMagnitudes, int );
00140 vtkGetMacro( ComputeGradientMagnitudes, int );
00141 vtkBooleanMacro( ComputeGradientMagnitudes, int );
00143
00145
00149 vtkSetMacro( CylinderClip, int );
00150 vtkGetMacro( CylinderClip, int );
00151 vtkBooleanMacro( CylinderClip, int );
00153
00155
00156 vtkGetMacro( LastUpdateTimeInSeconds, float );
00157 vtkGetMacro( LastUpdateTimeInCPUSeconds, float );
00159
00160 vtkGetMacro( UseCylinderClip, int );
00161 int *GetCircleLimits() { return this->CircleLimits; };
00162
00164
00170 void SetZeroNormalThreshold( float v );
00171 vtkGetMacro( ZeroNormalThreshold, float );
00173
00175
00177 vtkSetClampMacro( ZeroPad, int, 0, 1 );
00178 vtkGetMacro( ZeroPad, int );
00179 vtkBooleanMacro( ZeroPad, int );
00181
00182
00183
00184
00185
00186
00187
00188
00189 vtkImageData *Input;
00190
00191
00192 unsigned short *EncodedNormals;
00193 int EncodedNormalsSize[3];
00194
00195
00196 unsigned char *GradientMagnitudes;
00197
00198
00199 vtkTimeStamp BuildTime;
00200
00201
00202 vtkGetVectorMacro( InputSize, int, 3 );
00203 vtkGetVectorMacro( InputAspect, float, 3 );
00204
00205
00206 protected:
00207 vtkEncodedGradientEstimator();
00208 ~vtkEncodedGradientEstimator();
00209
00210
00211 int NumberOfThreads;
00212
00213 vtkMultiThreader *Threader;
00214
00215 vtkDirectionEncoder *DirectionEncoder;
00216
00217 virtual void UpdateNormals( void ) = 0;
00218
00219 float GradientMagnitudeScale;
00220 float GradientMagnitudeBias;
00221
00222 float LastUpdateTimeInSeconds;
00223 float LastUpdateTimeInCPUSeconds;
00224
00225 float ZeroNormalThreshold;
00226
00227 int CylinderClip;
00228 int *CircleLimits;
00229 int CircleLimitsSize;
00230 int UseCylinderClip;
00231 void ComputeCircleLimits( int size );
00232
00233 int BoundsClip;
00234 int Bounds[6];
00235
00236 int InputSize[3];
00237 float InputAspect[3];
00238
00239 int ComputeGradientMagnitudes;
00240
00241 int ZeroPad;
00242
00243 private:
00244 vtkEncodedGradientEstimator(const vtkEncodedGradientEstimator&);
00245 void operator=(const vtkEncodedGradientEstimator&);
00246 };
00247
00248
00249 #endif
00250