Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Rendering/vtkEncodedGradientEstimator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkEncodedGradientEstimator.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00016 
00047 #ifndef __vtkEncodedGradientEstimator_h
00048 #define __vtkEncodedGradientEstimator_h
00049 
00050 #include "vtkObject.h"
00051 
00052 class vtkImageData;
00053 class vtkDirectionEncoder;
00054 class vtkMultiThreader;
00055 
00056 class VTK_RENDERING_EXPORT vtkEncodedGradientEstimator : public vtkObject
00057 {
00058 public:
00059   vtkTypeRevisionMacro(vtkEncodedGradientEstimator,vtkObject);
00060   void PrintSelf( ostream& os, vtkIndent indent );
00061 
00063 
00064   virtual void SetInput(vtkImageData*);
00065   vtkGetObjectMacro( Input, vtkImageData );
00067 
00069 
00070   vtkSetMacro( GradientMagnitudeScale, float );
00071   vtkGetMacro( GradientMagnitudeScale, float );
00072   vtkSetMacro( GradientMagnitudeBias, float );
00073   vtkGetMacro( GradientMagnitudeBias, float );
00075 
00077 
00079   vtkSetClampMacro( BoundsClip, int, 0, 1 );
00080   vtkGetMacro( BoundsClip, int );
00081   vtkBooleanMacro( BoundsClip, int );
00083   
00085 
00088   vtkSetVector6Macro( Bounds, int );
00089   vtkGetVectorMacro(  Bounds, int, 6 );
00091 
00093   void  Update( void );
00094 
00096   unsigned short  *GetEncodedNormals( void ); 
00097 
00099 
00100   int   GetEncodedNormalIndex( int xyz_index );
00101   int   GetEncodedNormalIndex( int x_index, int y_index, int z_index );
00103 
00105   unsigned char *GetGradientMagnitudes(void);
00106 
00108 
00110   vtkSetClampMacro( NumberOfThreads, int, 1, VTK_MAX_THREADS );
00111   vtkGetMacro( NumberOfThreads, int );
00113 
00115 
00117   void SetDirectionEncoder( vtkDirectionEncoder *direnc );
00118   vtkGetObjectMacro( DirectionEncoder, vtkDirectionEncoder );
00120 
00122 
00126   vtkSetMacro( ComputeGradientMagnitudes, int );
00127   vtkGetMacro( ComputeGradientMagnitudes, int );
00128   vtkBooleanMacro( ComputeGradientMagnitudes, int );
00130 
00132 
00136   vtkSetMacro( CylinderClip, int );
00137   vtkGetMacro( CylinderClip, int );
00138   vtkBooleanMacro( CylinderClip, int );
00140 
00142 
00143   vtkGetMacro( LastUpdateTimeInSeconds, float );
00144   vtkGetMacro( LastUpdateTimeInCPUSeconds, float );
00146 
00147   vtkGetMacro( UseCylinderClip, int );
00148   int *GetCircleLimits() { return this->CircleLimits; };
00149 
00151 
00157   void SetZeroNormalThreshold( float v );
00158   vtkGetMacro( ZeroNormalThreshold, float );
00160 
00162 
00164   vtkSetClampMacro( ZeroPad, int, 0, 1 );
00165   vtkGetMacro( ZeroPad, int );
00166   vtkBooleanMacro( ZeroPad, int );
00168   
00169   
00170   // These variables should be protected but are being
00171   // made public to be accessible to the templated function.
00172   // We used to have the templated function as a friend, but
00173   // this does not work with all compilers
00174 
00175   // The input scalar data on which the normals are computed
00176   vtkImageData         *Input;
00177 
00178   // The encoded normals (2 bytes) and the size of the encoded normals
00179   unsigned short        *EncodedNormals;
00180   int                   EncodedNormalsSize[3];
00181 
00182   // The magnitude of the gradient array and the size of this array
00183   unsigned char         *GradientMagnitudes;
00184 
00185   // The time at which the normals were last built
00186   vtkTimeStamp          BuildTime;
00187 
00188 //BTX
00189   vtkGetVectorMacro( InputSize, int, 3 );
00190   vtkGetVectorMacro( InputAspect, float, 3 );
00191 //ETX
00192   
00193 protected:
00194   vtkEncodedGradientEstimator();
00195   ~vtkEncodedGradientEstimator();
00196 
00197   // The number of threads to use when encoding normals
00198   int                        NumberOfThreads;
00199 
00200   vtkMultiThreader           *Threader;
00201 
00202   vtkDirectionEncoder        *DirectionEncoder;
00203 
00204   virtual void               UpdateNormals( void ) = 0;
00205 
00206   float                      GradientMagnitudeScale;
00207   float                      GradientMagnitudeBias;
00208 
00209   float                      LastUpdateTimeInSeconds;
00210   float                      LastUpdateTimeInCPUSeconds;
00211 
00212   float                      ZeroNormalThreshold;
00213 
00214   int                        CylinderClip;
00215   int                        *CircleLimits;
00216   int                        CircleLimitsSize;
00217   int                        UseCylinderClip;
00218   void                       ComputeCircleLimits( int size );
00219   
00220   int                        BoundsClip;
00221   int                        Bounds[6];
00222 
00223   int                        InputSize[3];
00224   float                      InputAspect[3];
00225 
00226   int                        ComputeGradientMagnitudes;
00227   
00228   int                        ZeroPad;
00229   
00230 private:
00231   vtkEncodedGradientEstimator(const vtkEncodedGradientEstimator&);  // Not implemented.
00232   void operator=(const vtkEncodedGradientEstimator&);  // Not implemented.
00233 }; 
00234 
00235 
00236 #endif
00237