VTK  9.1.0
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#include "vtkThreads.h" // for VTK_MAX_THREADS
40
41class vtkImageData;
44
45class VTKRENDERINGVOLUME_EXPORT vtkEncodedGradientEstimator : public vtkObject
46{
47public:
49 void PrintSelf(ostream& os, vtkIndent indent) override;
50
52
60 virtual void SetInputData(vtkImageData*);
61 vtkGetObjectMacro(InputData, vtkImageData);
63
65
68 vtkSetMacro(GradientMagnitudeScale, float);
69 vtkGetMacro(GradientMagnitudeScale, float);
70 vtkSetMacro(GradientMagnitudeBias, float);
71 vtkGetMacro(GradientMagnitudeBias, float);
73
75
79 vtkSetClampMacro(BoundsClip, vtkTypeBool, 0, 1);
80 vtkGetMacro(BoundsClip, vtkTypeBool);
81 vtkBooleanMacro(BoundsClip, vtkTypeBool);
83
85
90 vtkSetVector6Macro(Bounds, int);
91 vtkGetVectorMacro(Bounds, int, 6);
93
97 void Update(void);
98
102 unsigned short* GetEncodedNormals(void);
103
105
109 int GetEncodedNormalIndex(int xIndex, int yIndex, int zIndex);
111
115 unsigned char* GetGradientMagnitudes(void);
116
118
122 vtkSetClampMacro(NumberOfThreads, int, 1, VTK_MAX_THREADS);
123 vtkGetMacro(NumberOfThreads, int);
125
127
132 vtkGetObjectMacro(DirectionEncoder, vtkDirectionEncoder);
134
136
142 vtkSetMacro(ComputeGradientMagnitudes, vtkTypeBool);
143 vtkGetMacro(ComputeGradientMagnitudes, vtkTypeBool);
144 vtkBooleanMacro(ComputeGradientMagnitudes, vtkTypeBool);
146
148
153 vtkSetMacro(CylinderClip, vtkTypeBool);
154 vtkGetMacro(CylinderClip, vtkTypeBool);
155 vtkBooleanMacro(CylinderClip, vtkTypeBool);
157
159
162 vtkGetMacro(LastUpdateTimeInSeconds, float);
163 vtkGetMacro(LastUpdateTimeInCPUSeconds, float);
165
166 vtkGetMacro(UseCylinderClip, int);
167 int* GetCircleLimits() { return this->CircleLimits; }
168
170
179 vtkGetMacro(ZeroNormalThreshold, float);
181
183
187 vtkSetClampMacro(ZeroPad, vtkTypeBool, 0, 1);
188 vtkGetMacro(ZeroPad, vtkTypeBool);
189 vtkBooleanMacro(ZeroPad, vtkTypeBool);
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
213protected:
216
218
219 // The number of threads to use when encoding normals
221
223
225
226 virtual void UpdateNormals(void) = 0;
227
230
233
235
241
243 int Bounds[6];
244
245 int InputSize[3];
246 float InputAspect[3];
247
249
251
252private:
254 void operator=(const vtkEncodedGradientEstimator&) = delete;
255};
256
257#endif
encode a direction into a one or two byte value
Superclass for gradient estimation.
void Update(void)
Recompute the encoded normals and gradient magnitudes.
void ComputeCircleLimits(int size)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void UpdateNormals(void)=0
~vtkEncodedGradientEstimator() override
virtual void SetInputData(vtkImageData *)
Set/Get the scalar input for which the normals will be calculated.
void ReportReferences(vtkGarbageCollector *) override
void SetDirectionEncoder(vtkDirectionEncoder *direnc)
Set / Get the direction encoder used to encode normal directions to fit within two bytes.
void SetZeroNormalThreshold(float v)
Set / Get the ZeroNormalThreshold - this defines the minimum magnitude of a gradient that is consider...
unsigned char * GetGradientMagnitudes(void)
Get the gradient magnitudes.
unsigned short * GetEncodedNormals(void)
Get the encoded normals.
int GetEncodedNormalIndex(int xIndex, int yIndex, int zIndex)
Get the encoded normal at an x,y,z location in the volume.
int GetEncodedNormalIndex(vtkIdType xyzIndex)
Get the encoded normal at an x,y,z location in the volume.
Detect and break reference loops.
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
a simple class to control print indentation
Definition: vtkIndent.h:113
A class for performing multithreaded execution.
abstract base class for most VTK objects
Definition: vtkObject.h:73
record modification and/or execution time
Definition: vtkTimeStamp.h:52
@ size
Definition: vtkX3D.h:259
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332