VTK  9.2.5
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 =========================================================================*/
58 #ifndef vtkImageMarchingCubes_h
59 #define vtkImageMarchingCubes_h
60 
61 #include "vtkFiltersGeneralModule.h" // For export macro
62 #include "vtkPolyDataAlgorithm.h"
63 
64 #include "vtkContourValues.h" // Needed for direct access to ContourValues
65 
66 class vtkCellArray;
67 class vtkFloatArray;
68 class vtkImageData;
69 class vtkPoints;
70 
71 class VTKFILTERSGENERAL_EXPORT vtkImageMarchingCubes : public vtkPolyDataAlgorithm
72 {
73 public:
76  void PrintSelf(ostream& os, vtkIndent indent) override;
77 
79 
82  void SetValue(int i, double value);
83  double GetValue(int i);
84  double* GetValues();
85  void GetValues(double* contourValues);
86  void SetNumberOfContours(int number);
87  vtkIdType GetNumberOfContours();
88  void GenerateValues(int numContours, double range[2]);
89  void GenerateValues(int numContours, double rangeStart, double rangeEnd);
91 
95  vtkMTimeType GetMTime() override;
96 
98 
101  vtkSetMacro(ComputeScalars, vtkTypeBool);
102  vtkGetMacro(ComputeScalars, vtkTypeBool);
103  vtkBooleanMacro(ComputeScalars, vtkTypeBool);
105 
107 
112  vtkSetMacro(ComputeNormals, vtkTypeBool);
113  vtkGetMacro(ComputeNormals, vtkTypeBool);
114  vtkBooleanMacro(ComputeNormals, vtkTypeBool);
116 
118 
125  vtkSetMacro(ComputeGradients, vtkTypeBool);
126  vtkGetMacro(ComputeGradients, vtkTypeBool);
127  vtkBooleanMacro(ComputeGradients, vtkTypeBool);
129 
130  // Should be protected, but the templated functions need these
135 
141 
142  vtkIdType GetLocatorPoint(int cellX, int cellY, int edge);
143  void AddLocatorPoint(int cellX, int cellY, int edge, vtkIdType ptId);
145 
147 
152  vtkSetMacro(InputMemoryLimit, vtkIdType);
153  vtkGetMacro(InputMemoryLimit, vtkIdType);
155 
156 protected:
159 
162 
164 
170 
174 
175  void March(vtkImageData* inData, int chunkMin, int chunkMax, int numContours, double* values);
176  void InitializeLocator(int min0, int max0, int min1, int max1);
178  vtkIdType* GetLocatorPointer(int cellX, int cellY, int edge);
179 
180 private:
182  void operator=(const vtkImageMarchingCubes&) = delete;
183 };
184 
189 inline void vtkImageMarchingCubes::SetValue(int i, double value)
190 {
191  this->ContourValues->SetValue(i, value);
192 }
193 
198 {
199  return this->ContourValues->GetValue(i);
200 }
201 
207 {
208  return this->ContourValues->GetValues();
209 }
210 
216 inline void vtkImageMarchingCubes::GetValues(double* contourValues)
217 {
218  this->ContourValues->GetValues(contourValues);
219 }
220 
227 {
228  this->ContourValues->SetNumberOfContours(number);
229 }
230 
235 {
236  return this->ContourValues->GetNumberOfContours();
237 }
238 
243 inline void vtkImageMarchingCubes::GenerateValues(int numContours, double range[2])
244 {
245  this->ContourValues->GenerateValues(numContours, range);
246 }
247 
253  int numContours, double rangeStart, double rangeEnd)
254 {
255  this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
256 }
257 
258 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:296
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
topologically and geometrically regular array of data
Definition: vtkImageData.h:163
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:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate 3D points
Definition: vtkPoints.h:149
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