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) VTK_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() VTK_OVERRIDE;
74 
76 
79  vtkSetMacro(ComputeScalars, int);
80  vtkGetMacro(ComputeScalars, int);
81  vtkBooleanMacro(ComputeScalars, int);
83 
85 
90  vtkSetMacro(ComputeNormals, int);
91  vtkGetMacro(ComputeNormals, int);
92  vtkBooleanMacro(ComputeNormals, int);
94 
96 
103  vtkSetMacro(ComputeGradients, int);
104  vtkGetMacro(ComputeGradients, int);
105  vtkBooleanMacro(ComputeGradients, int);
107 
108  // Should be protected, but the templated functions need these
109  int ComputeScalars;
110  int ComputeNormals;
111  int ComputeGradients;
112  int NeedGradients;
113 
114  vtkCellArray *Triangles;
115  vtkFloatArray *Scalars;
116  vtkPoints *Points;
117  vtkFloatArray *Normals;
118  vtkFloatArray *Gradients;
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() VTK_OVERRIDE;
137 
138  int NumberOfSlicesPerChunk;
139  vtkIdType InputMemoryLimit;
140 
141  vtkContourValues *ContourValues;
142 
143  vtkIdType *LocatorPointIds;
144  int LocatorDimX;
145  int LocatorDimY;
146  int LocatorMinX;
147  int LocatorMinY;
148 
149  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
150  int FillInputPortInformation(int port, vtkInformation *info) VTK_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:
159  vtkImageMarchingCubes(const vtkImageMarchingCubes&) VTK_DELETE_FUNCTION;
160  void operator=(const vtkImageMarchingCubes&) VTK_DELETE_FUNCTION;
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
double * GetValues()
Get a pointer to an array of contour values.
helper object to manage setting and generating contour values
void SetNumberOfContours(int number)
Set the number of contours to place into the list.
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:35
int vtkIdType
Definition: vtkType.h:345
generate isosurface(s) from volume/images
static vtkPolyDataAlgorithm * New()
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:33
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
virtual vtkMTimeType GetMTime()
Return this object's modified time.
int GetNumberOfContours()
Get the number of contours in the list of contour values.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
object to represent cell connectivity
Definition: vtkCellArray.h:44
Store zero or more vtkInformation instances.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
double GetValue(int i)
Get the ith contour value.
void SetValue(int i, double value)
Set the ith contour value.
represent and manipulate 3D points
Definition: vtkPoints.h:33
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.