VTK  9.3.1
vtkEncodedGradientEstimator.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 
22 #ifndef vtkEncodedGradientEstimator_h
23 #define vtkEncodedGradientEstimator_h
24 
25 #include "vtkObject.h"
26 #include "vtkRenderingVolumeModule.h" // For export macro
27 #include "vtkThreads.h" // for VTK_MAX_THREADS
28 
29 VTK_ABI_NAMESPACE_BEGIN
30 class vtkImageData;
32 class vtkMultiThreader;
33 
34 class VTKRENDERINGVOLUME_EXPORT vtkEncodedGradientEstimator : public vtkObject
35 {
36 public:
38  void PrintSelf(ostream& os, vtkIndent indent) override;
39 
41 
49  virtual void SetInputData(vtkImageData*);
50  vtkGetObjectMacro(InputData, vtkImageData);
52 
54 
57  vtkSetMacro(GradientMagnitudeScale, float);
58  vtkGetMacro(GradientMagnitudeScale, float);
59  vtkSetMacro(GradientMagnitudeBias, float);
60  vtkGetMacro(GradientMagnitudeBias, float);
62 
64 
68  vtkSetClampMacro(BoundsClip, vtkTypeBool, 0, 1);
69  vtkGetMacro(BoundsClip, vtkTypeBool);
70  vtkBooleanMacro(BoundsClip, vtkTypeBool);
72 
74 
79  vtkSetVector6Macro(Bounds, int);
80  vtkGetVectorMacro(Bounds, int, 6);
82 
86  void Update();
87 
91  unsigned short* GetEncodedNormals();
92 
94 
97  int GetEncodedNormalIndex(vtkIdType xyzIndex);
98  int GetEncodedNormalIndex(int xIndex, int yIndex, int zIndex);
100 
104  unsigned char* GetGradientMagnitudes();
105 
107 
111  vtkSetClampMacro(NumberOfThreads, int, 1, VTK_MAX_THREADS);
112  vtkGetMacro(NumberOfThreads, int);
114 
116 
120  void SetDirectionEncoder(vtkDirectionEncoder* direnc);
121  vtkGetObjectMacro(DirectionEncoder, vtkDirectionEncoder);
123 
125 
131  vtkSetMacro(ComputeGradientMagnitudes, vtkTypeBool);
132  vtkGetMacro(ComputeGradientMagnitudes, vtkTypeBool);
133  vtkBooleanMacro(ComputeGradientMagnitudes, vtkTypeBool);
135 
137 
142  vtkSetMacro(CylinderClip, vtkTypeBool);
143  vtkGetMacro(CylinderClip, vtkTypeBool);
144  vtkBooleanMacro(CylinderClip, vtkTypeBool);
146 
148 
151  vtkGetMacro(LastUpdateTimeInSeconds, float);
152  vtkGetMacro(LastUpdateTimeInCPUSeconds, float);
154 
155  vtkGetMacro(UseCylinderClip, int);
156  int* GetCircleLimits() { return this->CircleLimits; }
157 
159 
167  void SetZeroNormalThreshold(float v);
168  vtkGetMacro(ZeroNormalThreshold, float);
170 
172 
176  vtkSetClampMacro(ZeroPad, vtkTypeBool, 0, 1);
177  vtkGetMacro(ZeroPad, vtkTypeBool);
178  vtkBooleanMacro(ZeroPad, vtkTypeBool);
180 
181  // These variables should be protected but are being
182  // made public to be accessible to the templated function.
183  // We used to have the templated function as a friend, but
184  // this does not work with all compilers
185 
186  // The input scalar data on which the normals are computed
188 
189  // The encoded normals (2 bytes) and the size of the encoded normals
190  unsigned short* EncodedNormals;
191  int EncodedNormalsSize[3];
192 
193  // The magnitude of the gradient array and the size of this array
194  unsigned char* GradientMagnitudes;
195 
196  // The time at which the normals were last built
198 
199  vtkGetVectorMacro(InputSize, int, 3);
200  vtkGetVectorMacro(InputAspect, float, 3);
201 
202 protected:
204  ~vtkEncodedGradientEstimator() override;
205 
206  void ReportReferences(vtkGarbageCollector*) override;
207 
208  // The number of threads to use when encoding normals
210 
212 
214 
215  virtual void UpdateNormals() = 0;
216 
219 
222 
224 
229  void ComputeCircleLimits(int size);
230 
232  int Bounds[6];
233 
234  int InputSize[3];
235  float InputAspect[3];
236 
238 
240 
241 private:
243  void operator=(const vtkEncodedGradientEstimator&) = delete;
244 };
245 
246 VTK_ABI_NAMESPACE_END
247 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:51
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:24
int vtkIdType
Definition: vtkType.h:315
Detect and break reference loops.
int vtkTypeBool
Definition: vtkABI.h:64
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void ReportReferences(vtkGarbageCollector *)
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
Superclass for gradient estimation.