VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkEncodedGradientEstimator.h 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 "vtkRenderingVolumeModule.h" // For export macro 00037 #include "vtkObject.h" 00038 00039 class vtkImageData; 00040 class vtkDirectionEncoder; 00041 class vtkMultiThreader; 00042 00043 class VTKRENDERINGVOLUME_EXPORT vtkEncodedGradientEstimator : public vtkObject 00044 { 00045 public: 00046 vtkTypeMacro(vtkEncodedGradientEstimator,vtkObject); 00047 void PrintSelf( ostream& os, vtkIndent indent ); 00048 00050 00055 virtual void SetInputData(vtkImageData*); 00056 vtkGetObjectMacro( InputData, vtkImageData ); 00058 00060 00061 vtkSetMacro( GradientMagnitudeScale, float ); 00062 vtkGetMacro( GradientMagnitudeScale, float ); 00063 vtkSetMacro( GradientMagnitudeBias, float ); 00064 vtkGetMacro( GradientMagnitudeBias, float ); 00066 00068 00070 vtkSetClampMacro( BoundsClip, int, 0, 1 ); 00071 vtkGetMacro( BoundsClip, int ); 00072 vtkBooleanMacro( BoundsClip, int ); 00074 00076 00079 vtkSetVector6Macro( Bounds, int ); 00080 vtkGetVectorMacro( Bounds, int, 6 ); 00082 00084 void Update( void ); 00085 00087 unsigned short *GetEncodedNormals( void ); 00088 00090 00091 int GetEncodedNormalIndex( vtkIdType xyz_index ); 00092 int GetEncodedNormalIndex( int x_index, int y_index, int z_index ); 00094 00096 unsigned char *GetGradientMagnitudes(void); 00097 00099 00101 vtkSetClampMacro( NumberOfThreads, int, 1, VTK_MAX_THREADS ); 00102 vtkGetMacro( NumberOfThreads, int ); 00104 00106 00108 void SetDirectionEncoder( vtkDirectionEncoder *direnc ); 00109 vtkGetObjectMacro( DirectionEncoder, vtkDirectionEncoder ); 00111 00113 00117 vtkSetMacro( ComputeGradientMagnitudes, int ); 00118 vtkGetMacro( ComputeGradientMagnitudes, int ); 00119 vtkBooleanMacro( ComputeGradientMagnitudes, int ); 00121 00123 00127 vtkSetMacro( CylinderClip, int ); 00128 vtkGetMacro( CylinderClip, int ); 00129 vtkBooleanMacro( CylinderClip, int ); 00131 00133 00134 vtkGetMacro( LastUpdateTimeInSeconds, float ); 00135 vtkGetMacro( LastUpdateTimeInCPUSeconds, float ); 00137 00138 vtkGetMacro( UseCylinderClip, int ); 00139 int *GetCircleLimits() { return this->CircleLimits; }; 00140 00142 00148 void SetZeroNormalThreshold( float v ); 00149 vtkGetMacro( ZeroNormalThreshold, float ); 00151 00153 00155 vtkSetClampMacro( ZeroPad, int, 0, 1 ); 00156 vtkGetMacro( ZeroPad, int ); 00157 vtkBooleanMacro( ZeroPad, int ); 00159 00160 00161 // These variables should be protected but are being 00162 // made public to be accessible to the templated function. 00163 // We used to have the templated function as a friend, but 00164 // this does not work with all compilers 00165 00166 // The input scalar data on which the normals are computed 00167 vtkImageData *InputData; 00168 00169 // The encoded normals (2 bytes) and the size of the encoded normals 00170 unsigned short *EncodedNormals; 00171 int EncodedNormalsSize[3]; 00172 00173 // The magnitude of the gradient array and the size of this array 00174 unsigned char *GradientMagnitudes; 00175 00176 // The time at which the normals were last built 00177 vtkTimeStamp BuildTime; 00178 00179 //BTX 00180 vtkGetVectorMacro( InputSize, int, 3 ); 00181 vtkGetVectorMacro( InputAspect, float, 3 ); 00182 //ETX 00183 00184 protected: 00185 vtkEncodedGradientEstimator(); 00186 ~vtkEncodedGradientEstimator(); 00187 00188 virtual void ReportReferences(vtkGarbageCollector*); 00189 00190 // The number of threads to use when encoding normals 00191 int NumberOfThreads; 00192 00193 vtkMultiThreader *Threader; 00194 00195 vtkDirectionEncoder *DirectionEncoder; 00196 00197 virtual void UpdateNormals( void ) = 0; 00198 00199 float GradientMagnitudeScale; 00200 float GradientMagnitudeBias; 00201 00202 float LastUpdateTimeInSeconds; 00203 float LastUpdateTimeInCPUSeconds; 00204 00205 float ZeroNormalThreshold; 00206 00207 int CylinderClip; 00208 int *CircleLimits; 00209 int CircleLimitsSize; 00210 int UseCylinderClip; 00211 void ComputeCircleLimits( int size ); 00212 00213 int BoundsClip; 00214 int Bounds[6]; 00215 00216 int InputSize[3]; 00217 float InputAspect[3]; 00218 00219 int ComputeGradientMagnitudes; 00220 00221 int ZeroPad; 00222 00223 private: 00224 vtkEncodedGradientEstimator(const vtkEncodedGradientEstimator&); // Not implemented. 00225 void operator=(const vtkEncodedGradientEstimator&); // Not implemented. 00226 }; 00227 00228 00229 #endif 00230