Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class 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 
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 =========================================================================*/
00015 
00033 #ifndef __vtkEncodedGradientEstimator_h
00034 #define __vtkEncodedGradientEstimator_h
00035 
00036 #include "vtkObject.h"
00037 
00038 class vtkImageData;
00039 class vtkDirectionEncoder;
00040 class vtkMultiThreader;
00041 
00042 class VTK_RENDERING_EXPORT vtkEncodedGradientEstimator : public vtkObject
00043 {
00044 public:
00045   vtkTypeRevisionMacro(vtkEncodedGradientEstimator,vtkObject);
00046   void PrintSelf( ostream& os, vtkIndent indent );
00047 
00049 
00050   virtual void SetInput(vtkImageData*);
00051   vtkGetObjectMacro( Input, vtkImageData );
00053 
00055 
00056   vtkSetMacro( GradientMagnitudeScale, float );
00057   vtkGetMacro( GradientMagnitudeScale, float );
00058   vtkSetMacro( GradientMagnitudeBias, float );
00059   vtkGetMacro( GradientMagnitudeBias, float );
00061 
00063 
00065   vtkSetClampMacro( BoundsClip, int, 0, 1 );
00066   vtkGetMacro( BoundsClip, int );
00067   vtkBooleanMacro( BoundsClip, int );
00069   
00071 
00074   vtkSetVector6Macro( Bounds, int );
00075   vtkGetVectorMacro(  Bounds, int, 6 );
00077 
00079   void  Update( void );
00080 
00082   unsigned short  *GetEncodedNormals( void ); 
00083 
00085 
00086   int   GetEncodedNormalIndex( int xyz_index );
00087   int   GetEncodedNormalIndex( int x_index, int y_index, int z_index );
00089 
00091   unsigned char *GetGradientMagnitudes(void);
00092 
00094 
00096   vtkSetClampMacro( NumberOfThreads, int, 1, VTK_MAX_THREADS );
00097   vtkGetMacro( NumberOfThreads, int );
00099 
00101 
00103   void SetDirectionEncoder( vtkDirectionEncoder *direnc );
00104   vtkGetObjectMacro( DirectionEncoder, vtkDirectionEncoder );
00106 
00108 
00112   vtkSetMacro( ComputeGradientMagnitudes, int );
00113   vtkGetMacro( ComputeGradientMagnitudes, int );
00114   vtkBooleanMacro( ComputeGradientMagnitudes, int );
00116 
00118 
00122   vtkSetMacro( CylinderClip, int );
00123   vtkGetMacro( CylinderClip, int );
00124   vtkBooleanMacro( CylinderClip, int );
00126 
00128 
00129   vtkGetMacro( LastUpdateTimeInSeconds, float );
00130   vtkGetMacro( LastUpdateTimeInCPUSeconds, float );
00132 
00133   vtkGetMacro( UseCylinderClip, int );
00134   int *GetCircleLimits() { return this->CircleLimits; };
00135 
00137 
00143   void SetZeroNormalThreshold( float v );
00144   vtkGetMacro( ZeroNormalThreshold, float );
00146 
00148 
00150   vtkSetClampMacro( ZeroPad, int, 0, 1 );
00151   vtkGetMacro( ZeroPad, int );
00152   vtkBooleanMacro( ZeroPad, int );
00154   
00155   
00156   // These variables should be protected but are being
00157   // made public to be accessible to the templated function.
00158   // We used to have the templated function as a friend, but
00159   // this does not work with all compilers
00160 
00161   // The input scalar data on which the normals are computed
00162   vtkImageData         *Input;
00163 
00164   // The encoded normals (2 bytes) and the size of the encoded normals
00165   unsigned short        *EncodedNormals;
00166   int                   EncodedNormalsSize[3];
00167 
00168   // The magnitude of the gradient array and the size of this array
00169   unsigned char         *GradientMagnitudes;
00170 
00171   // The time at which the normals were last built
00172   vtkTimeStamp          BuildTime;
00173 
00174 //BTX
00175   vtkGetVectorMacro( InputSize, int, 3 );
00176   vtkGetVectorMacro( InputAspect, float, 3 );
00177 //ETX
00178   
00179 protected:
00180   vtkEncodedGradientEstimator();
00181   ~vtkEncodedGradientEstimator();
00182 
00183   // The number of threads to use when encoding normals
00184   int                        NumberOfThreads;
00185 
00186   vtkMultiThreader           *Threader;
00187 
00188   vtkDirectionEncoder        *DirectionEncoder;
00189 
00190   virtual void               UpdateNormals( void ) = 0;
00191 
00192   float                      GradientMagnitudeScale;
00193   float                      GradientMagnitudeBias;
00194 
00195   float                      LastUpdateTimeInSeconds;
00196   float                      LastUpdateTimeInCPUSeconds;
00197 
00198   float                      ZeroNormalThreshold;
00199 
00200   int                        CylinderClip;
00201   int                        *CircleLimits;
00202   int                        CircleLimitsSize;
00203   int                        UseCylinderClip;
00204   void                       ComputeCircleLimits( int size );
00205   
00206   int                        BoundsClip;
00207   int                        Bounds[6];
00208 
00209   int                        InputSize[3];
00210   float                      InputAspect[3];
00211 
00212   int                        ComputeGradientMagnitudes;
00213   
00214   int                        ZeroPad;
00215   
00216 private:
00217   vtkEncodedGradientEstimator(const vtkEncodedGradientEstimator&);  // Not implemented.
00218   void operator=(const vtkEncodedGradientEstimator&);  // Not implemented.
00219 }; 
00220 
00221 
00222 #endif
00223