VTK  9.1.0
vtkImageMarchingCubes.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkImageMarchingCubes.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=========================================================================*/
45#ifndef vtkImageMarchingCubes_h
46#define vtkImageMarchingCubes_h
47
48#include "vtkFiltersGeneralModule.h" // For export macro
50
51#include "vtkContourValues.h" // Needed for direct access to ContourValues
52
53class vtkCellArray;
54class vtkFloatArray;
55class vtkImageData;
56class vtkPoints;
57
58class VTKFILTERSGENERAL_EXPORT vtkImageMarchingCubes : public vtkPolyDataAlgorithm
59{
60public:
63 void PrintSelf(ostream& os, vtkIndent indent) override;
64
66
69 void SetValue(int i, double value);
70 double GetValue(int i);
71 double* GetValues();
72 void GetValues(double* contourValues);
73 void SetNumberOfContours(int number);
74 vtkIdType GetNumberOfContours();
75 void GenerateValues(int numContours, double range[2]);
76 void GenerateValues(int numContours, double rangeStart, double rangeEnd);
78
83
85
88 vtkSetMacro(ComputeScalars, vtkTypeBool);
89 vtkGetMacro(ComputeScalars, vtkTypeBool);
90 vtkBooleanMacro(ComputeScalars, vtkTypeBool);
92
94
99 vtkSetMacro(ComputeNormals, vtkTypeBool);
100 vtkGetMacro(ComputeNormals, vtkTypeBool);
101 vtkBooleanMacro(ComputeNormals, vtkTypeBool);
103
105
112 vtkSetMacro(ComputeGradients, vtkTypeBool);
113 vtkGetMacro(ComputeGradients, vtkTypeBool);
114 vtkBooleanMacro(ComputeGradients, vtkTypeBool);
116
117 // Should be protected, but the templated functions need these
122
128
129 vtkIdType GetLocatorPoint(int cellX, int cellY, int edge);
130 void AddLocatorPoint(int cellX, int cellY, int edge, vtkIdType ptId);
132
134
139 vtkSetMacro(InputMemoryLimit, vtkIdType);
140 vtkGetMacro(InputMemoryLimit, vtkIdType);
142
143protected:
146
149
151
157
161
162 void March(vtkImageData* inData, int chunkMin, int chunkMax, int numContours, double* values);
163 void InitializeLocator(int min0, int max0, int min1, int max1);
165 vtkIdType* GetLocatorPointer(int cellX, int cellY, int edge);
166
167private:
169 void operator=(const vtkImageMarchingCubes&) = delete;
170};
171
176inline void vtkImageMarchingCubes::SetValue(int i, double value)
177{
178 this->ContourValues->SetValue(i, value);
179}
180
185{
186 return this->ContourValues->GetValue(i);
187}
188
194{
195 return this->ContourValues->GetValues();
196}
197
203inline void vtkImageMarchingCubes::GetValues(double* contourValues)
204{
205 this->ContourValues->GetValues(contourValues);
206}
207
214{
215 this->ContourValues->SetNumberOfContours(number);
216}
217
222{
223 return this->ContourValues->GetNumberOfContours();
224}
225
230inline void vtkImageMarchingCubes::GenerateValues(int numContours, double range[2])
231{
232 this->ContourValues->GenerateValues(numContours, range);
233}
234
240 int numContours, double rangeStart, double rangeEnd)
241{
242 this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
243}
244
245#endif
object to represent cell connectivity
Definition: vtkCellArray.h:190
helper object to manage setting and generating contour values
double * GetValues()
Return a pointer to a list of contour values.
int GetNumberOfContours()
Return the number of contours in the.
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
void SetNumberOfContours(const int number)
Set the number of contours to place into the list.
void SetValue(int i, double value)
Set the ith contour value.
double GetValue(int i)
Get the ith contour value.
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:45
topologically and geometrically regular array of data
Definition: vtkImageData.h:57
generate isosurface(s) from volume/images
vtkIdType GetNumberOfContours()
Get the number of contours in the list of contour values.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void March(vtkImageData *inData, int chunkMin, int chunkMax, int numContours, double *values)
vtkContourValues * ContourValues
static vtkImageMarchingCubes * New()
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void AddLocatorPoint(int cellX, int cellY, int edge, vtkIdType ptId)
vtkIdType * GetLocatorPointer(int cellX, int cellY, int edge)
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:43
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate 3D points
Definition: vtkPoints.h:43
Superclass for algorithms that produce only polydata as output.
@ info
Definition: vtkX3D.h:382
@ value
Definition: vtkX3D.h:226
@ port
Definition: vtkX3D.h:453
@ range
Definition: vtkX3D.h:244
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287