Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

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_VOLUMERENDERING_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   virtual void ReportReferences(vtkGarbageCollector*);
00184 
00185   // The number of threads to use when encoding normals
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 private:
00219   vtkEncodedGradientEstimator(const vtkEncodedGradientEstimator&);  // Not implemented.
00220   void operator=(const vtkEncodedGradientEstimator&);  // Not implemented.
00221 }; 
00222 
00223 
00224 #endif
00225 

Generated on Mon Jan 21 23:07:37 2008 for VTK by  doxygen 1.4.3-20050530