VTK  9.3.1
vtkMarchingCubes.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
38 #ifndef vtkMarchingCubes_h
39 #define vtkMarchingCubes_h
40 
41 #include "vtkFiltersCoreModule.h" // For export macro
42 #include "vtkPolyDataAlgorithm.h"
43 
44 #include "vtkContourValues.h" // Needed for direct access to ContourValues
45 
46 VTK_ABI_NAMESPACE_BEGIN
48 
49 class VTKFILTERSCORE_EXPORT vtkMarchingCubes : public vtkPolyDataAlgorithm
50 {
51 public:
52  static vtkMarchingCubes* New();
54  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
56  // Methods to set contour values
57  void SetValue(int i, double value);
58  double GetValue(int i);
59  double* GetValues();
60  void GetValues(double* contourValues);
61  void SetNumberOfContours(int number);
62  vtkIdType GetNumberOfContours();
63  void GenerateValues(int numContours, double range[2]);
64  void GenerateValues(int numContours, double rangeStart, double rangeEnd);
65 
66  // Because we delegate to vtkContourValues
67  vtkMTimeType GetMTime() override;
68 
70 
76  vtkSetMacro(ComputeNormals, vtkTypeBool);
77  vtkGetMacro(ComputeNormals, vtkTypeBool);
78  vtkBooleanMacro(ComputeNormals, vtkTypeBool);
80 
82 
90  vtkSetMacro(ComputeGradients, vtkTypeBool);
91  vtkGetMacro(ComputeGradients, vtkTypeBool);
92  vtkBooleanMacro(ComputeGradients, vtkTypeBool);
94 
96 
99  vtkSetMacro(ComputeScalars, vtkTypeBool);
100  vtkGetMacro(ComputeScalars, vtkTypeBool);
101  vtkBooleanMacro(ComputeScalars, vtkTypeBool);
103 
105 
109  void SetLocator(vtkIncrementalPointLocator* locator);
110  vtkGetObjectMacro(Locator, vtkIncrementalPointLocator);
112 
117  void CreateDefaultLocator();
118 
119 protected:
121  ~vtkMarchingCubes() override;
122 
124  int FillInputPortInformation(int port, vtkInformation* info) override;
125 
131 
132 private:
133  vtkMarchingCubes(const vtkMarchingCubes&) = delete;
134  void operator=(const vtkMarchingCubes&) = delete;
135 };
136 
141 inline void vtkMarchingCubes::SetValue(int i, double value)
142 {
143  this->ContourValues->SetValue(i, value);
144 }
145 
149 inline double vtkMarchingCubes::GetValue(int i)
150 {
151  return this->ContourValues->GetValue(i);
152 }
153 
159 {
160  return this->ContourValues->GetValues();
161 }
162 
168 inline void vtkMarchingCubes::GetValues(double* contourValues)
169 {
170  this->ContourValues->GetValues(contourValues);
171 }
172 
179 {
180  this->ContourValues->SetNumberOfContours(number);
181 }
182 
187 {
188  return this->ContourValues->GetNumberOfContours();
189 }
190 
195 inline void vtkMarchingCubes::GenerateValues(int numContours, double range[2])
196 {
197  this->ContourValues->GenerateValues(numContours, range);
198 }
199 
204 inline void vtkMarchingCubes::GenerateValues(int numContours, double rangeStart, double rangeEnd)
205 {
206  this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
207 }
208 
209 VTK_ABI_NAMESPACE_END
210 #endif
helper object to manage setting and generating contour values
void SetValue(int i, double value)
Set a particular contour value at contour number i.
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
vtkTypeBool ComputeScalars
Abstract class in support of both point location and point insertion.
vtkTypeBool ComputeNormals
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
int vtkIdType
Definition: vtkType.h:315
double GetValue(int i)
Get the ith contour value.
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:64
double * GetValues()
Get a pointer to an array of contour values.
double * GetValues()
Return a pointer to a list of contour values.
vtkIncrementalPointLocator * Locator
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:28
generate isosurface(s) from volume
virtual vtkMTimeType GetMTime()
Return this object's modified time.
void SetNumberOfContours(int number)
Set the number of contours to place into the list.
vtkIdType GetNumberOfContours()
Get the number of contours in the list of contour values.
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
vtkTypeBool ComputeGradients
double GetValue(int i)
Get the ith contour value.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
Store zero or more vtkInformation instances.
int GetNumberOfContours()
Return the number of contours in the.
void SetValue(int i, double value)
Set the ith contour value.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetNumberOfContours(int number)
Set the number of contours to place into the list.
vtkContourValues * ContourValues