VTK  9.4.20251007
vtkContourFilter.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
41
42#ifndef vtkContourFilter_h
43#define vtkContourFilter_h
44
45#include "vtkFiltersCoreModule.h" // For export macro
47
48#include "vtkContourValues.h" // Needed for inline methods
49
50VTK_ABI_NAMESPACE_BEGIN
51
54class vtkContourGrid;
60class vtkScalarTree;
63
64class VTKFILTERSCORE_EXPORT vtkContourFilter : public vtkPolyDataAlgorithm
65{
66public:
68 void PrintSelf(ostream& os, vtkIndent indent) override;
69
75
77
80 void SetValue(int i, double value);
81 double GetValue(int i);
82 double* GetValues();
83 void GetValues(double* contourValues);
84 void SetNumberOfContours(int number);
86 void GenerateValues(int numContours, double range[2]);
87 void GenerateValues(int numContours, double rangeStart, double rangeEnd);
88 void SetContourValues(const std::vector<double>& values);
89 std::vector<double> GetContourValues();
91
96
98
110 vtkSetMacro(ComputeNormals, int);
111 vtkGetMacro(ComputeNormals, int);
112 vtkBooleanMacro(ComputeNormals, int);
114
116
126 vtkBooleanMacro(ComputeGradients, vtkTypeBool);
128
130
135 vtkBooleanMacro(ComputeScalars, vtkTypeBool);
137
139
145 vtkBooleanMacro(UseScalarTree, vtkTypeBool);
147
149
153 vtkGetObjectMacro(ScalarTree, vtkScalarTree);
155
157
164
170
172
176 vtkSetMacro(ArrayComponent, int);
177 vtkGetMacro(ArrayComponent, int);
179
181
192
194
199 vtkSetMacro(OutputPointsPrecision, int);
200 vtkGetMacro(OutputPointsPrecision, int);
202
204
212 vtkSetMacro(FastMode, bool);
213 vtkGetMacro(FastMode, bool);
214 vtkBooleanMacro(FastMode, bool);
216
222 void SetInputArray(const std::string& name)
223 {
225 }
226
227protected:
230
232
234 vtkInformationVector* outputVector) override;
236 int FillInputPortInformation(int port, vtkInformation* info) override;
237
249
259
261 vtkObject* caller, unsigned long eid, void* clientData, void* callData);
262
263private:
264 vtkContourFilter(const vtkContourFilter&) = delete;
265 void operator=(const vtkContourFilter&) = delete;
266};
267
272inline void vtkContourFilter::SetValue(int i, double value)
273{
274 this->ContourValues->SetValue(i, value);
275}
276
280inline double vtkContourFilter::GetValue(int i)
281{
282 return this->ContourValues->GetValue(i);
283}
284
290{
291 return this->ContourValues->GetValues();
292}
293
299inline void vtkContourFilter::GetValues(double* contourValues)
300{
301 this->ContourValues->GetValues(contourValues);
302}
303
310{
311 this->ContourValues->SetNumberOfContours(number);
312}
313
318{
319 return this->ContourValues->GetNumberOfContours();
320}
321
326inline void vtkContourFilter::GenerateValues(int numContours, double range[2])
327{
328 this->ContourValues->GenerateValues(numContours, range);
329}
330
335inline void vtkContourFilter::GenerateValues(int numContours, double rangeStart, double rangeEnd)
336{
337 this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
338}
339
344inline void vtkContourFilter::SetContourValues(const std::vector<double>& values)
345{
346 int numContours = static_cast<int>(values.size());
347 this->SetNumberOfContours(numContours);
348 for (int i = 0; i < numContours; i++)
349 {
350 this->SetValue(i, values[i]);
351 }
352}
353
359inline std::vector<double> vtkContourFilter::GetContourValues()
360{
361 std::vector<double> contours;
362 int numContours = this->GetNumberOfContours();
363 contours.reserve(numContours);
364 for (int i = 0; i < numContours; i++)
365 {
366 contours.push_back(this->GetValue(i));
367 }
368 return contours;
369}
370
371VTK_ABI_NAMESPACE_END
372#endif
virtual void SetInputArrayToProcess(int idx, int port, int connection, int fieldAssociation, const char *name)
Set the input data arrays that this algorithm will process.
supports function callbacks
fast generation of isosurface from 3D linear cells
std::vector< double > GetContourValues()
Convenience method to get all of the contour values at once.
vtkNew< vtkContourValues > ContourValues
void SetLocator(vtkIncrementalPointLocator *locator)
Set / get a spatial locator for merging points.
void SetContourValues(const std::vector< double > &values)
Convenience method to set all of the contour values at once.
void ReportReferences(vtkGarbageCollector *) override
double GetValue(int i)
Get the ith contour value.
vtkTypeBool UseScalarTree
vtkNew< vtkRectilinearSynchronizedTemplates > RectilinearSynchronizedTemplates
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkMTimeType GetMTime() override
Modified GetMTime Because we delegate to vtkContourValues.
vtkNew< vtkSynchronizedTemplates3D > SynchronizedTemplates3D
vtkNew< vtkGridSynchronizedTemplates3D > GridSynchronizedTemplates
vtkNew< vtkFlyingEdges3D > FlyingEdges3D
void SetNumberOfContours(int number)
Set the number of contours to place into the list.
vtkNew< vtkCallbackCommand > InternalProgressCallbackCommand
vtkTypeBool ComputeScalars
int GetNumberOfContours()
Get the number of contours in the list of contour values.
void CreateDefaultLocator()
Create default locator.
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
vtkTypeBool ComputeGradients
vtkIncrementalPointLocator * Locator
void SetValue(int i, double value)
Methods to set / get contour values.
virtual void SetScalarTree(vtkScalarTree *)
Enable the use of a scalar tree to accelerate contour extraction.
static vtkContourFilter * New()
Construct object with initial range (0,1) and single contour value of 0.0.
vtkNew< vtkSynchronizedTemplates2D > SynchronizedTemplates2D
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
~vtkContourFilter() override
static void InternalProgressCallbackFunction(vtkObject *caller, unsigned long eid, void *clientData, void *callData)
vtkTypeBool GenerateTriangles
vtkScalarTree * ScalarTree
double * GetValues()
Get a pointer to an array of contour values.
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkNew< vtkContour3DLinearGrid > Contour3DLinearGrid
vtkNew< vtkFlyingEdges2D > FlyingEdges2D
void SetInputArray(const std::string &name)
Sets the name of the input array to be used for generating the isosurfaces.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
vtkNew< vtkContourGrid > ContourGrid
generate isosurfaces/isolines from scalar values (specialized for unstructured grids)
generate isoline(s) from a structured points (image) dataset
generate isosurface from 3D image data (volume)
Detect and break reference loops.
generate isosurface from structured grids
Abstract class in support of both point location and point insertion.
a simple class to control print indentation
Definition vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Allocate and hold a VTK object.
Definition vtkNew.h:58
generate isosurface from rectilinear grid
organize data according to scalar values (used to accelerate contouring operations)
generate isoline(s) from a structured points set
generate isosurface from structured points
int vtkTypeBool
Definition vtkABI.h:64
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270