VTK  9.3.0
vtkImageMarchingCubes.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
36 #ifndef vtkImageMarchingCubes_h
37 #define vtkImageMarchingCubes_h
38 
39 #include "vtkFiltersGeneralModule.h" // For export macro
40 #include "vtkPolyDataAlgorithm.h"
41 
42 #include "vtkContourValues.h" // Needed for direct access to ContourValues
43 
44 VTK_ABI_NAMESPACE_BEGIN
45 class vtkCellArray;
46 class vtkFloatArray;
47 class vtkImageData;
48 class vtkPoints;
49 
50 class VTKFILTERSGENERAL_EXPORT vtkImageMarchingCubes : public vtkPolyDataAlgorithm
51 {
52 public:
55  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
58 
61  void SetValue(int i, double value);
62  double GetValue(int i);
63  double* GetValues();
64  void GetValues(double* contourValues);
65  void SetNumberOfContours(int number);
66  vtkIdType GetNumberOfContours();
67  void GenerateValues(int numContours, double range[2]);
68  void GenerateValues(int numContours, double rangeStart, double rangeEnd);
70 
74  vtkMTimeType GetMTime() override;
75 
77 
80  vtkSetMacro(ComputeScalars, vtkTypeBool);
81  vtkGetMacro(ComputeScalars, vtkTypeBool);
82  vtkBooleanMacro(ComputeScalars, vtkTypeBool);
84 
86 
91  vtkSetMacro(ComputeNormals, vtkTypeBool);
92  vtkGetMacro(ComputeNormals, vtkTypeBool);
93  vtkBooleanMacro(ComputeNormals, vtkTypeBool);
95 
97 
104  vtkSetMacro(ComputeGradients, vtkTypeBool);
105  vtkGetMacro(ComputeGradients, vtkTypeBool);
106  vtkBooleanMacro(ComputeGradients, vtkTypeBool);
108 
109  // Should be protected, but the templated functions need these
114 
120 
121  vtkIdType GetLocatorPoint(int cellX, int cellY, int edge);
122  void AddLocatorPoint(int cellX, int cellY, int edge, vtkIdType ptId);
124 
126 
131  vtkSetMacro(InputMemoryLimit, vtkIdType);
132  vtkGetMacro(InputMemoryLimit, vtkIdType);
134 
135 protected:
138 
141 
143 
149 
153 
154  void March(vtkImageData* inData, int chunkMin, int chunkMax, int numContours, double* values);
155  void InitializeLocator(int min0, int max0, int min1, int max1);
157  vtkIdType* GetLocatorPointer(int cellX, int cellY, int edge);
158 
159 private:
161  void operator=(const vtkImageMarchingCubes&) = delete;
162 };
163 
168 inline void vtkImageMarchingCubes::SetValue(int i, double value)
169 {
170  this->ContourValues->SetValue(i, value);
171 }
172 
177 {
178  return this->ContourValues->GetValue(i);
179 }
180 
186 {
187  return this->ContourValues->GetValues();
188 }
189 
195 inline void vtkImageMarchingCubes::GetValues(double* contourValues)
196 {
197  this->ContourValues->GetValues(contourValues);
198 }
199 
206 {
207  this->ContourValues->SetNumberOfContours(number);
208 }
209 
214 {
215  return this->ContourValues->GetNumberOfContours();
216 }
217 
222 inline void vtkImageMarchingCubes::GenerateValues(int numContours, double range[2])
223 {
224  this->ContourValues->GenerateValues(numContours, range);
225 }
226 
232  int numContours, double rangeStart, double rangeEnd)
233 {
234  this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
235 }
236 
237 VTK_ABI_NAMESPACE_END
238 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:185
helper object to manage setting and generating contour values
int GetNumberOfContours()
Return the number of contours in the.
void SetNumberOfContours(int number)
Set the number of contours to place into the list.
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
void SetValue(int i, double value)
Set the ith contour value.
double GetValue(int i)
Get the ith contour value.
double * GetValues()
Return a pointer to a list of contour values.
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:40
topologically and geometrically regular array of data
Definition: vtkImageData.h:52
generate isosurface(s) from volume/images
vtkIdType GetNumberOfContours()
Get the number of contours in the list of contour values.
static vtkImageMarchingCubes * New()
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void March(vtkImageData *inData, int chunkMin, int chunkMax, int numContours, double *values)
vtkIdType * GetLocatorPointer(int cellX, int cellY, int edge)
vtkContourValues * ContourValues
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void AddLocatorPoint(int cellX, int cellY, int edge, vtkIdType ptId)
double GetValue(int i)
Get the ith contour value.
vtkMTimeType GetMTime() override
Because we delegate to vtkContourValues & refer to vtkImplicitFunction.
double * GetValues()
Get a pointer to an array of contour values.
~vtkImageMarchingCubes() override
void InitializeLocator(int min0, int max0, int min1, int max1)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetValue(int i, double value)
Methods to set contour values.
void SetNumberOfContours(int number)
Set the number of contours to place into the list.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
vtkIdType GetLocatorPoint(int cellX, int cellY, int edge)
a simple class to control print indentation
Definition: vtkIndent.h:38
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate 3D points
Definition: vtkPoints.h:38
Superclass for algorithms that produce only polydata as output.
@ info
Definition: vtkX3D.h:376
@ value
Definition: vtkX3D.h:220
@ port
Definition: vtkX3D.h:447
@ range
Definition: vtkX3D.h:238
int vtkTypeBool
Definition: vtkABI.h:64
int vtkIdType
Definition: vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270