VTK  9.3.20240329
vtkMarchingContourFilter.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
64 #ifndef vtkMarchingContourFilter_h
65 #define vtkMarchingContourFilter_h
66 
67 #include "vtkFiltersGeneralModule.h" // For export macro
68 #include "vtkPolyDataAlgorithm.h"
69 
70 #include "vtkContourValues.h" // Needed for direct access to ContourValues
71 
72 VTK_ABI_NAMESPACE_BEGIN
74 class vtkScalarTree;
75 
76 class VTKFILTERSGENERAL_EXPORT vtkMarchingContourFilter : public vtkPolyDataAlgorithm
77 {
78 public:
80  void PrintSelf(ostream& os, vtkIndent indent) override;
81 
87 
89 
92  void SetValue(int i, double value);
93  double GetValue(int i);
94  double* GetValues();
95  void GetValues(double* contourValues);
96  void SetNumberOfContours(int number);
97  vtkIdType GetNumberOfContours();
98  void GenerateValues(int numContours, double range[2]);
99  void GenerateValues(int numContours, double rangeStart, double rangeEnd);
101 
105  vtkMTimeType GetMTime() override;
106 
108 
114  vtkSetMacro(ComputeNormals, vtkTypeBool);
115  vtkGetMacro(ComputeNormals, vtkTypeBool);
116  vtkBooleanMacro(ComputeNormals, vtkTypeBool);
118 
120 
128  vtkSetMacro(ComputeGradients, vtkTypeBool);
129  vtkGetMacro(ComputeGradients, vtkTypeBool);
130  vtkBooleanMacro(ComputeGradients, vtkTypeBool);
132 
134 
137  vtkSetMacro(ComputeScalars, vtkTypeBool);
138  vtkGetMacro(ComputeScalars, vtkTypeBool);
139  vtkBooleanMacro(ComputeScalars, vtkTypeBool);
141 
143 
146  vtkSetMacro(UseScalarTree, vtkTypeBool);
147  vtkGetMacro(UseScalarTree, vtkTypeBool);
148  vtkBooleanMacro(UseScalarTree, vtkTypeBool);
150 
152 
157  vtkGetObjectMacro(Locator, vtkIncrementalPointLocator);
159 
165 
166 protected:
169 
172 
180 
181  // special contouring for structured points
182  void StructuredPointsContour(int dim, vtkDataSet* input, vtkPolyData* output);
183  // special contouring for image data
184  void ImageContour(int dim, vtkDataSet* input, vtkPolyData* output);
185  // default if not structured data
186  void DataSetContour(vtkDataSet* input, vtkPolyData* output);
187 
188 private:
190  void operator=(const vtkMarchingContourFilter&) = delete;
191 };
192 
197 inline void vtkMarchingContourFilter::SetValue(int i, double value)
198 {
199  this->ContourValues->SetValue(i, value);
200 }
201 
206 {
207  return this->ContourValues->GetValue(i);
208 }
209 
215 {
216  return this->ContourValues->GetValues();
217 }
218 
224 inline void vtkMarchingContourFilter::GetValues(double* contourValues)
225 {
226  this->ContourValues->GetValues(contourValues);
227 }
228 
235 {
236  this->ContourValues->SetNumberOfContours(number);
237 }
238 
243 {
244  return this->ContourValues->GetNumberOfContours();
245 }
246 
251 inline void vtkMarchingContourFilter::GenerateValues(int numContours, double range[2])
252 {
253  this->ContourValues->GenerateValues(numContours, range);
254 }
255 
261  int numContours, double rangeStart, double rangeEnd)
262 {
263  this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
264 }
265 
266 VTK_ABI_NAMESPACE_END
267 #endif
helper object to manage setting and generating contour values
int GetNumberOfContours()
Return the number of contours in the.
void SetNumberOfContours(int number)
Set the number of contours to place into the list.
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
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.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:166
Abstract class in support of both point location and point insertion.
a simple class to control print indentation
Definition: vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
generate isosurfaces/isolines from scalar values
vtkMTimeType GetMTime() override
Modified GetMTime Because we delegate to vtkContourValues.
vtkIncrementalPointLocator * Locator
void CreateDefaultLocator()
Create default locator.
vtkIdType GetNumberOfContours()
Get the number of contours in the list of contour values.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void SetNumberOfContours(int number)
Set the number of contours to place into the list.
~vtkMarchingContourFilter() override
static vtkMarchingContourFilter * New()
Construct object with initial range (0,1) and single contour value of 0.0.
double GetValue(int i)
Get the ith contour value.
void SetValue(int i, double value)
Methods to set / get contour values.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
double * GetValues()
Get a pointer to an array of contour values.
void ImageContour(int dim, vtkDataSet *input, vtkPolyData *output)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void StructuredPointsContour(int dim, vtkDataSet *input, vtkPolyData *output)
void DataSetContour(vtkDataSet *input, vtkPolyData *output)
void SetLocator(vtkIncrementalPointLocator *locator)
Set / get a spatial locator for merging points.
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:181
organize data according to scalar values (used to accelerate contouring operations)
Definition: vtkScalarTree.h:44
@ info
Definition: vtkX3D.h:376
@ value
Definition: vtkX3D.h:220
@ port
Definition: vtkX3D.h:447
@ range
Definition: vtkX3D.h:238
int vtkTypeBool
Definition: vtkABI.h:64
int vtkIdType
Definition: vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270