VTK
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 =========================================================================*/
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 class vtkCellArray;
45 class vtkFloatArray;
46 class vtkImageData;
47 class vtkPoints;
48 
49 class VTKFILTERSGENERAL_EXPORT vtkImageMarchingCubes : public vtkPolyDataAlgorithm
50 {
51 public:
52  static vtkImageMarchingCubes *New();
54  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
57 
60  void SetValue(int i, double value);
61  double GetValue(int i);
62  double *GetValues();
63  void GetValues(double *contourValues);
64  void SetNumberOfContours(int number);
65  int GetNumberOfContours();
66  void GenerateValues(int numContours, double range[2]);
67  void GenerateValues(int numContours, double rangeStart, double rangeEnd);
69 
73  vtkMTimeType GetMTime() override;
74 
76 
79  vtkSetMacro(ComputeScalars, vtkTypeBool);
80  vtkGetMacro(ComputeScalars, vtkTypeBool);
81  vtkBooleanMacro(ComputeScalars, vtkTypeBool);
83 
85 
90  vtkSetMacro(ComputeNormals, vtkTypeBool);
91  vtkGetMacro(ComputeNormals, vtkTypeBool);
92  vtkBooleanMacro(ComputeNormals, vtkTypeBool);
94 
96 
103  vtkSetMacro(ComputeGradients, vtkTypeBool);
104  vtkGetMacro(ComputeGradients, vtkTypeBool);
105  vtkBooleanMacro(ComputeGradients, vtkTypeBool);
107 
108  // Should be protected, but the templated functions need these
113 
119 
120  vtkIdType GetLocatorPoint(int cellX, int cellY, int edge);
121  void AddLocatorPoint(int cellX, int cellY, int edge, vtkIdType ptId);
122  void IncrementLocatorZ();
123 
125 
130  vtkSetMacro(InputMemoryLimit, vtkIdType);
131  vtkGetMacro(InputMemoryLimit, vtkIdType);
133 
134 protected:
136  ~vtkImageMarchingCubes() override;
137 
140 
142 
148 
150  int FillInputPortInformation(int port, vtkInformation *info) override;
151 
152  void March(vtkImageData *inData, int chunkMin, int chunkMax,
153  int numContours, double *values);
154  void InitializeLocator(int min0, int max0, int min1, int max1);
155  void DeleteLocator();
156  vtkIdType *GetLocatorPointer(int cellX, int cellY, int edge);
157 
158 private:
160  void operator=(const vtkImageMarchingCubes&) = delete;
161 };
162 
167 inline void vtkImageMarchingCubes::SetValue(int i, double value)
168 {this->ContourValues->SetValue(i,value);}
169 
174 {return this->ContourValues->GetValue(i);}
175 
181 {return this->ContourValues->GetValues();}
182 
188 inline void vtkImageMarchingCubes::GetValues(double *contourValues)
189 {this->ContourValues->GetValues(contourValues);}
190 
197 {this->ContourValues->SetNumberOfContours(number);}
198 
203 {return this->ContourValues->GetNumberOfContours();}
204 
209 inline void vtkImageMarchingCubes::GenerateValues(int numContours, double range[2])
210 {this->ContourValues->GenerateValues(numContours, range);}
211 
216 inline void vtkImageMarchingCubes::GenerateValues(int numContours, double
217  rangeStart, double rangeEnd)
218 {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);}
219 
220 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:33
vtkContourValues::GetValues
double * GetValues()
Return a pointer to a list of contour values.
vtkContourValues::GetNumberOfContours
int GetNumberOfContours()
Return the number of contours in the.
vtkImageMarchingCubes::SetValue
void SetValue(int i, double value)
Methods to set contour values.
Definition: vtkImageMarchingCubes.h:167
vtkImageMarchingCubes::Points
vtkPoints * Points
Definition: vtkImageMarchingCubes.h:116
vtkImageMarchingCubes::Triangles
vtkCellArray * Triangles
Definition: vtkImageMarchingCubes.h:114
vtkX3D::value
Definition: vtkX3D.h:220
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkImageMarchingCubes::GetNumberOfContours
int GetNumberOfContours()
Get the number of contours in the list of contour values.
Definition: vtkImageMarchingCubes.h:202
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:35
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkX3D::range
Definition: vtkX3D.h:238
vtkImageMarchingCubes::LocatorMinY
int LocatorMinY
Definition: vtkImageMarchingCubes.h:147
vtkImageMarchingCubes
generate isosurface(s) from volume/images
Definition: vtkImageMarchingCubes.h:49
vtkImageMarchingCubes::GetValues
double * GetValues()
Get a pointer to an array of contour values.
Definition: vtkImageMarchingCubes.h:180
vtkImageMarchingCubes::NumberOfSlicesPerChunk
int NumberOfSlicesPerChunk
Definition: vtkImageMarchingCubes.h:138
vtkPolyDataAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkImageMarchingCubes::Gradients
vtkFloatArray * Gradients
Definition: vtkImageMarchingCubes.h:118
vtkImageMarchingCubes::LocatorPointIds
vtkIdType * LocatorPointIds
Definition: vtkImageMarchingCubes.h:143
vtkImageMarchingCubes::LocatorMinX
int LocatorMinX
Definition: vtkImageMarchingCubes.h:146
vtkPolyDataAlgorithm.h
vtkX3D::port
Definition: vtkX3D.h:447
vtkImageMarchingCubes::GenerateValues
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
Definition: vtkImageMarchingCubes.h:209
vtkImageMarchingCubes::InputMemoryLimit
vtkIdType InputMemoryLimit
Definition: vtkImageMarchingCubes.h:139
vtkImageMarchingCubes::LocatorDimY
int LocatorDimY
Definition: vtkImageMarchingCubes.h:145
vtkImageMarchingCubes::Scalars
vtkFloatArray * Scalars
Definition: vtkImageMarchingCubes.h:115
vtkPolyDataAlgorithm::RequestData
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
vtkObject::GetMTime
virtual vtkMTimeType GetMTime()
Return this object's modified time.
vtkImageMarchingCubes::GetValue
double GetValue(int i)
Get the ith contour value.
Definition: vtkImageMarchingCubes.h:173
vtkContourValues
helper object to manage setting and generating contour values
Definition: vtkContourValues.h:35
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:44
vtkContourValues::GenerateValues
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
vtkContourValues::GetValue
double GetValue(int i)
Get the ith contour value.
vtkContourValues::SetValue
void SetValue(int i, double value)
Set the ith contour value.
vtkPolyDataAlgorithm::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkImageMarchingCubes::ContourValues
vtkContourValues * ContourValues
Definition: vtkImageMarchingCubes.h:141
vtkContourValues.h
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:80
vtkX3D::info
Definition: vtkX3D.h:376
vtkImageMarchingCubes::ComputeGradients
vtkTypeBool ComputeGradients
Definition: vtkImageMarchingCubes.h:111
vtkImageMarchingCubes::ComputeScalars
vtkTypeBool ComputeScalars
Definition: vtkImageMarchingCubes.h:105
vtkImageMarchingCubes::SetNumberOfContours
void SetNumberOfContours(int number)
Set the number of contours to place into the list.
Definition: vtkImageMarchingCubes.h:196
vtkImageMarchingCubes::LocatorDimX
int LocatorDimX
Definition: vtkImageMarchingCubes.h:144
vtkImageMarchingCubes::NeedGradients
int NeedGradients
Definition: vtkImageMarchingCubes.h:112
vtkContourValues::SetNumberOfContours
void SetNumberOfContours(const int number)
Set the number of contours to place into the list.
vtkImageMarchingCubes::Normals
vtkFloatArray * Normals
Definition: vtkImageMarchingCubes.h:117
vtkImageMarchingCubes::ComputeNormals
vtkTypeBool ComputeNormals
Definition: vtkImageMarchingCubes.h:110
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkPolyDataAlgorithm::New
static vtkPolyDataAlgorithm * New()
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:41