VTK  9.7.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 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
44 
45 #include "vtkContourValues.h" // Needed for direct access to ContourValues
46 
47 VTK_ABI_NAMESPACE_BEGIN
49 
50 class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkMarchingCubes : public vtkPolyDataAlgorithm
51 {
52 public:
53  static vtkMarchingCubes* New();
55  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
57  // Methods to set contour values
58  void SetValue(int i, double value);
59  double GetValue(int i);
60  double* GetValues();
61  void GetValues(double* contourValues);
62  void SetNumberOfContours(int number);
63  vtkIdType GetNumberOfContours();
64  void GenerateValues(int numContours, double range[2]);
65  void GenerateValues(int numContours, double rangeStart, double rangeEnd);
66 
67  // Because we delegate to vtkContourValues
68  vtkMTimeType GetMTime() override;
69 
71 
77  vtkSetMacro(ComputeNormals, vtkTypeBool);
78  vtkGetMacro(ComputeNormals, vtkTypeBool);
79  vtkBooleanMacro(ComputeNormals, vtkTypeBool);
81 
83 
91  vtkSetMacro(ComputeGradients, vtkTypeBool);
92  vtkGetMacro(ComputeGradients, vtkTypeBool);
93  vtkBooleanMacro(ComputeGradients, vtkTypeBool);
95 
97 
100  vtkSetMacro(ComputeScalars, vtkTypeBool);
101  vtkGetMacro(ComputeScalars, vtkTypeBool);
102  vtkBooleanMacro(ComputeScalars, vtkTypeBool);
104 
106 
110  void SetLocator(vtkIncrementalPointLocator* locator);
111  vtkGetObjectMacro(Locator, vtkIncrementalPointLocator);
113 
118  void CreateDefaultLocator();
119 
120 protected:
122  ~vtkMarchingCubes() override;
123 
125  int FillInputPortInformation(int port, vtkInformation* info) override;
126 
132 
133 private:
134  vtkMarchingCubes(const vtkMarchingCubes&) = delete;
135  void operator=(const vtkMarchingCubes&) = delete;
136 };
137 
142 inline void vtkMarchingCubes::SetValue(int i, double value)
143 {
144  this->ContourValues->SetValue(i, value);
145 }
146 
150 inline double vtkMarchingCubes::GetValue(int i)
151 {
152  return this->ContourValues->GetValue(i);
153 }
154 
160 {
161  return this->ContourValues->GetValues();
162 }
163 
169 inline void vtkMarchingCubes::GetValues(double* contourValues)
170 {
171  this->ContourValues->GetValues(contourValues);
172 }
173 
180 {
181  this->ContourValues->SetNumberOfContours(number);
182 }
183 
188 {
189  return this->ContourValues->GetNumberOfContours();
190 }
191 
196 inline void vtkMarchingCubes::GenerateValues(int numContours, double range[2])
197 {
198  this->ContourValues->GenerateValues(numContours, range);
199 }
200 
205 inline void vtkMarchingCubes::GenerateValues(int numContours, double rangeStart, double rangeEnd)
206 {
207  this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
208 }
209 
210 VTK_ABI_NAMESPACE_END
211 #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:318
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:363
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.
#define VTK_MARSHALAUTO
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