VTK
vtkEncodedGradientEstimator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkEncodedGradientEstimator.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
34 #ifndef vtkEncodedGradientEstimator_h
35 #define vtkEncodedGradientEstimator_h
36 
37 #include "vtkRenderingVolumeModule.h" // For export macro
38 #include "vtkObject.h"
39 
40 class vtkImageData;
42 class vtkMultiThreader;
43 
44 class VTKRENDERINGVOLUME_EXPORT vtkEncodedGradientEstimator : public vtkObject
45 {
46 public:
48  void PrintSelf( ostream& os, vtkIndent indent );
49 
51 
59  virtual void SetInputData(vtkImageData*);
60  vtkGetObjectMacro( InputData, vtkImageData );
62 
64 
67  vtkSetMacro( GradientMagnitudeScale, float );
68  vtkGetMacro( GradientMagnitudeScale, float );
69  vtkSetMacro( GradientMagnitudeBias, float );
70  vtkGetMacro( GradientMagnitudeBias, float );
72 
74 
78  vtkSetClampMacro( BoundsClip, int, 0, 1 );
79  vtkGetMacro( BoundsClip, int );
80  vtkBooleanMacro( BoundsClip, int );
82 
84 
89  vtkSetVector6Macro( Bounds, int );
90  vtkGetVectorMacro( Bounds, int, 6 );
92 
96  void Update( void );
97 
101  unsigned short *GetEncodedNormals( void );
102 
104 
107  int GetEncodedNormalIndex( vtkIdType xyz_index );
108  int GetEncodedNormalIndex( int x_index, int y_index, int z_index );
110 
114  unsigned char *GetGradientMagnitudes(void);
115 
117 
121  vtkSetClampMacro( NumberOfThreads, int, 1, VTK_MAX_THREADS );
122  vtkGetMacro( NumberOfThreads, int );
124 
126 
130  void SetDirectionEncoder( vtkDirectionEncoder *direnc );
131  vtkGetObjectMacro( DirectionEncoder, vtkDirectionEncoder );
133 
135 
141  vtkSetMacro( ComputeGradientMagnitudes, int );
142  vtkGetMacro( ComputeGradientMagnitudes, int );
143  vtkBooleanMacro( ComputeGradientMagnitudes, int );
145 
147 
152  vtkSetMacro( CylinderClip, int );
153  vtkGetMacro( CylinderClip, int );
154  vtkBooleanMacro( CylinderClip, int );
156 
158 
161  vtkGetMacro( LastUpdateTimeInSeconds, float );
162  vtkGetMacro( LastUpdateTimeInCPUSeconds, float );
164 
165  vtkGetMacro( UseCylinderClip, int );
166  int *GetCircleLimits() { return this->CircleLimits; };
167 
169 
177  void SetZeroNormalThreshold( float v );
178  vtkGetMacro( ZeroNormalThreshold, float );
180 
182 
186  vtkSetClampMacro( ZeroPad, int, 0, 1 );
187  vtkGetMacro( ZeroPad, int );
188  vtkBooleanMacro( ZeroPad, int );
190 
191 
192  // These variables should be protected but are being
193  // made public to be accessible to the templated function.
194  // We used to have the templated function as a friend, but
195  // this does not work with all compilers
196 
197  // The input scalar data on which the normals are computed
199 
200  // The encoded normals (2 bytes) and the size of the encoded normals
201  unsigned short *EncodedNormals;
202  int EncodedNormalsSize[3];
203 
204  // The magnitude of the gradient array and the size of this array
205  unsigned char *GradientMagnitudes;
206 
207  // The time at which the normals were last built
209 
210  vtkGetVectorMacro( InputSize, int, 3 );
211  vtkGetVectorMacro( InputAspect, float, 3 );
212 
213 protected:
216 
217  void ReportReferences(vtkGarbageCollector*) VTK_OVERRIDE;
218 
219  // The number of threads to use when encoding normals
220  int NumberOfThreads;
221 
222  vtkMultiThreader *Threader;
223 
224  vtkDirectionEncoder *DirectionEncoder;
225 
226  virtual void UpdateNormals( void ) = 0;
227 
228  float GradientMagnitudeScale;
229  float GradientMagnitudeBias;
230 
231  float LastUpdateTimeInSeconds;
232  float LastUpdateTimeInCPUSeconds;
233 
234  float ZeroNormalThreshold;
235 
236  int CylinderClip;
237  int *CircleLimits;
238  int CircleLimitsSize;
239  int UseCylinderClip;
240  void ComputeCircleLimits( int size );
241 
242  int BoundsClip;
243  int Bounds[6];
244 
245  int InputSize[3];
246  float InputAspect[3];
247 
248  int ComputeGradientMagnitudes;
249 
250  int ZeroPad;
251 
252 private:
253  vtkEncodedGradientEstimator(const vtkEncodedGradientEstimator&) VTK_DELETE_FUNCTION;
254  void operator=(const vtkEncodedGradientEstimator&) VTK_DELETE_FUNCTION;
255 };
256 
257 
258 #endif
259 
abstract base class for most VTK objects
Definition: vtkObject.h:59
encode a direction into a one or two byte value
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
A class for performing multithreaded execution.
record modification and/or execution time
Definition: vtkTimeStamp.h:35
virtual void Update()
Updates the extensions string.
int vtkIdType
Definition: vtkType.h:287
Detect and break reference loops.
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void ReportReferences(vtkGarbageCollector *)
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
Superclass for gradient estimation.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.