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

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