VTK  9.2.6
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 =========================================================================*/
48 #ifndef vtkImageMarchingCubes_h
49 #define vtkImageMarchingCubes_h
50 
51 #include "vtkFiltersGeneralModule.h" // For export macro
52 #include "vtkPolyDataAlgorithm.h"
53 
54 #include "vtkContourValues.h" // Needed for direct access to ContourValues
55 
56 class vtkCellArray;
57 class vtkFloatArray;
58 class vtkImageData;
59 class vtkPoints;
60 
61 class VTKFILTERSGENERAL_EXPORT vtkImageMarchingCubes : public vtkPolyDataAlgorithm
62 {
63 public:
66  void PrintSelf(ostream& os, vtkIndent indent) override;
67 
69 
72  void SetValue(int i, double value);
73  double GetValue(int i);
74  double* GetValues();
75  void GetValues(double* contourValues);
76  void SetNumberOfContours(int number);
77  vtkIdType GetNumberOfContours();
78  void GenerateValues(int numContours, double range[2]);
79  void GenerateValues(int numContours, double rangeStart, double rangeEnd);
81 
85  vtkMTimeType GetMTime() override;
86 
88 
91  vtkSetMacro(ComputeScalars, vtkTypeBool);
92  vtkGetMacro(ComputeScalars, vtkTypeBool);
93  vtkBooleanMacro(ComputeScalars, vtkTypeBool);
95 
97 
102  vtkSetMacro(ComputeNormals, vtkTypeBool);
103  vtkGetMacro(ComputeNormals, vtkTypeBool);
104  vtkBooleanMacro(ComputeNormals, vtkTypeBool);
106 
108 
115  vtkSetMacro(ComputeGradients, vtkTypeBool);
116  vtkGetMacro(ComputeGradients, vtkTypeBool);
117  vtkBooleanMacro(ComputeGradients, vtkTypeBool);
119 
120  // Should be protected, but the templated functions need these
125 
131 
132  vtkIdType GetLocatorPoint(int cellX, int cellY, int edge);
133  void AddLocatorPoint(int cellX, int cellY, int edge, vtkIdType ptId);
135 
137 
142  vtkSetMacro(InputMemoryLimit, vtkIdType);
143  vtkGetMacro(InputMemoryLimit, vtkIdType);
145 
146 protected:
149 
152 
154 
160 
164 
165  void March(vtkImageData* inData, int chunkMin, int chunkMax, int numContours, double* values);
166  void InitializeLocator(int min0, int max0, int min1, int max1);
168  vtkIdType* GetLocatorPointer(int cellX, int cellY, int edge);
169 
170 private:
172  void operator=(const vtkImageMarchingCubes&) = delete;
173 };
174 
179 inline void vtkImageMarchingCubes::SetValue(int i, double value)
180 {
181  this->ContourValues->SetValue(i, value);
182 }
183 
188 {
189  return this->ContourValues->GetValue(i);
190 }
191 
197 {
198  return this->ContourValues->GetValues();
199 }
200 
206 inline void vtkImageMarchingCubes::GetValues(double* contourValues)
207 {
208  this->ContourValues->GetValues(contourValues);
209 }
210 
217 {
218  this->ContourValues->SetNumberOfContours(number);
219 }
220 
225 {
226  return this->ContourValues->GetNumberOfContours();
227 }
228 
233 inline void vtkImageMarchingCubes::GenerateValues(int numContours, double range[2])
234 {
235  this->ContourValues->GenerateValues(numContours, range);
236 }
237 
243  int numContours, double rangeStart, double rangeEnd)
244 {
245  this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
246 }
247 
248 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:196
helper object to manage setting and generating 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.
double * GetValues()
Return a pointer to a list of contour values.
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:51
topologically and geometrically regular array of data
Definition: vtkImageData.h:63
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:49
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate 3D points
Definition: vtkPoints.h:49
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