VTK  9.0.1
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 "vtkObject.h"
38 #include "vtkRenderingVolumeModule.h" // For export macro
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) override;
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, vtkTypeBool, 0, 1);
79  vtkGetMacro(BoundsClip, vtkTypeBool);
80  vtkBooleanMacro(BoundsClip, vtkTypeBool);
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, vtkTypeBool);
142  vtkGetMacro(ComputeGradientMagnitudes, vtkTypeBool);
143  vtkBooleanMacro(ComputeGradientMagnitudes, vtkTypeBool);
145 
147 
152  vtkSetMacro(CylinderClip, vtkTypeBool);
153  vtkGetMacro(CylinderClip, vtkTypeBool);
154  vtkBooleanMacro(CylinderClip, vtkTypeBool);
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, vtkTypeBool, 0, 1);
187  vtkGetMacro(ZeroPad, vtkTypeBool);
188  vtkBooleanMacro(ZeroPad, vtkTypeBool);
190 
191  // These variables should be protected but are being
192  // made public to be accessible to the templated function.
193  // We used to have the templated function as a friend, but
194  // this does not work with all compilers
195 
196  // The input scalar data on which the normals are computed
198 
199  // The encoded normals (2 bytes) and the size of the encoded normals
200  unsigned short* EncodedNormals;
201  int EncodedNormalsSize[3];
202 
203  // The magnitude of the gradient array and the size of this array
204  unsigned char* GradientMagnitudes;
205 
206  // The time at which the normals were last built
208 
209  vtkGetVectorMacro(InputSize, int, 3);
210  vtkGetVectorMacro(InputAspect, float, 3);
211 
212 protected:
214  ~vtkEncodedGradientEstimator() override;
215 
216  void ReportReferences(vtkGarbageCollector*) override;
217 
218  // The number of threads to use when encoding normals
220 
222 
224 
225  virtual void UpdateNormals(void) = 0;
226 
229 
232 
234 
239  void ComputeCircleLimits(int size);
240 
242  int Bounds[6];
243 
244  int InputSize[3];
245  float InputAspect[3];
246 
248 
250 
251 private:
253  void operator=(const vtkEncodedGradientEstimator&) = delete;
254 };
255 
256 #endif
vtkEncodedGradientEstimator::InputData
vtkImageData * InputData
Definition: vtkEncodedGradientEstimator.h:188
vtkEncodedGradientEstimator::CircleLimits
int * CircleLimits
Definition: vtkEncodedGradientEstimator.h:236
vtkEncodedGradientEstimator::EncodedNormals
unsigned short * EncodedNormals
Definition: vtkEncodedGradientEstimator.h:200
vtkEncodedGradientEstimator::NumberOfThreads
int NumberOfThreads
Definition: vtkEncodedGradientEstimator.h:219
vtkEncodedGradientEstimator::DirectionEncoder
vtkDirectionEncoder * DirectionEncoder
Definition: vtkEncodedGradientEstimator.h:223
vtkEncodedGradientEstimator::GradientMagnitudeScale
float GradientMagnitudeScale
Definition: vtkEncodedGradientEstimator.h:227
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkObjectBase::ReportReferences
virtual void ReportReferences(vtkGarbageCollector *)
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:32
vtkEncodedGradientEstimator::GradientMagnitudeBias
float GradientMagnitudeBias
Definition: vtkEncodedGradientEstimator.h:228
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkEncodedGradientEstimator::Threader
vtkMultiThreader * Threader
Definition: vtkEncodedGradientEstimator.h:221
vtkEncodedGradientEstimator::ZeroPad
vtkTypeBool ZeroPad
Definition: vtkEncodedGradientEstimator.h:249
vtkEncodedGradientEstimator::UseCylinderClip
int UseCylinderClip
Definition: vtkEncodedGradientEstimator.h:238
vtkMultiThreader
A class for performing multithreaded execution.
Definition: vtkMultiThreader.h:77
vtkEncodedGradientEstimator
Superclass for gradient estimation.
Definition: vtkEncodedGradientEstimator.h:44
vtkEncodedGradientEstimator::LastUpdateTimeInSeconds
float LastUpdateTimeInSeconds
Definition: vtkEncodedGradientEstimator.h:230
vtkEncodedGradientEstimator::LastUpdateTimeInCPUSeconds
float LastUpdateTimeInCPUSeconds
Definition: vtkEncodedGradientEstimator.h:231
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:41
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkEncodedGradientEstimator::CircleLimitsSize
int CircleLimitsSize
Definition: vtkEncodedGradientEstimator.h:237
vtkEncodedGradientEstimator::BuildTime
vtkTimeStamp BuildTime
Definition: vtkEncodedGradientEstimator.h:207
vtkX3D::size
@ size
Definition: vtkX3D.h:259
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkEncodedGradientEstimator::CylinderClip
vtkTypeBool CylinderClip
Definition: vtkEncodedGradientEstimator.h:235
vtkGarbageCollector
Detect and break reference loops.
Definition: vtkGarbageCollector.h:94
vtkObject.h
vtkEncodedGradientEstimator::GetCircleLimits
int * GetCircleLimits()
Definition: vtkEncodedGradientEstimator.h:166
vtkEncodedGradientEstimator::ZeroNormalThreshold
float ZeroNormalThreshold
Definition: vtkEncodedGradientEstimator.h:233
vtkEncodedGradientEstimator::BoundsClip
vtkTypeBool BoundsClip
Definition: vtkEncodedGradientEstimator.h:241
vtkDirectionEncoder
encode a direction into a one or two byte value
Definition: vtkDirectionEncoder.h:39
vtkEncodedGradientEstimator::ComputeGradientMagnitudes
vtkTypeBool ComputeGradientMagnitudes
Definition: vtkEncodedGradientEstimator.h:247
vtkEncodedGradientEstimator::GradientMagnitudes
unsigned char * GradientMagnitudes
Definition: vtkEncodedGradientEstimator.h:204
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69