VTK  9.6.1
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#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
48
49#include "vtkContourValues.h" // Needed for inline methods
50
51VTK_ABI_NAMESPACE_BEGIN
52
55class vtkContourGrid;
61class vtkScalarTree;
64
65class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkContourFilter : public vtkPolyDataAlgorithm
66{
67public:
69 void PrintSelf(ostream& os, vtkIndent indent) override;
70
76
78
81 void SetValue(int i, double value);
82 double GetValue(int i);
83 double* GetValues();
84 void GetValues(double* contourValues);
85 void SetNumberOfContours(int number);
87 void GenerateValues(int numContours, double range[2]);
88 void GenerateValues(int numContours, double rangeStart, double rangeEnd);
89 void SetContourValues(const std::vector<double>& values);
90 std::vector<double> GetContourValues();
92
97
99
111 vtkSetMacro(ComputeNormals, int);
112 vtkGetMacro(ComputeNormals, int);
113 vtkBooleanMacro(ComputeNormals, int);
115
117
127 vtkBooleanMacro(ComputeGradients, vtkTypeBool);
129
131
136 vtkBooleanMacro(ComputeScalars, vtkTypeBool);
138
140
146 vtkBooleanMacro(UseScalarTree, vtkTypeBool);
148
150
154 vtkGetObjectMacro(ScalarTree, vtkScalarTree);
156
158
165
171
173
177 vtkSetMacro(ArrayComponent, int);
178 vtkGetMacro(ArrayComponent, int);
180
182
193
195
200 vtkSetMacro(OutputPointsPrecision, int);
201 vtkGetMacro(OutputPointsPrecision, int);
203
205
213 vtkSetMacro(FastMode, bool);
214 vtkGetMacro(FastMode, bool);
215 vtkBooleanMacro(FastMode, bool);
217
223 void SetInputArray(const std::string& name)
224 {
226 }
227
228protected:
231
233
235 vtkInformationVector* outputVector) override;
237 int FillInputPortInformation(int port, vtkInformation* info) override;
238
250
260
262 vtkObject* caller, unsigned long eid, void* clientData, void* callData);
263
264private:
265 vtkContourFilter(const vtkContourFilter&) = delete;
266 void operator=(const vtkContourFilter&) = delete;
267};
268
273inline void vtkContourFilter::SetValue(int i, double value)
274{
275 this->ContourValues->SetValue(i, value);
276}
277
281inline double vtkContourFilter::GetValue(int i)
282{
283 return this->ContourValues->GetValue(i);
284}
285
291{
292 return this->ContourValues->GetValues();
293}
294
300inline void vtkContourFilter::GetValues(double* contourValues)
301{
302 this->ContourValues->GetValues(contourValues);
303}
304
311{
312 this->ContourValues->SetNumberOfContours(number);
313}
314
319{
320 return this->ContourValues->GetNumberOfContours();
321}
322
327inline void vtkContourFilter::GenerateValues(int numContours, double range[2])
328{
329 this->ContourValues->GenerateValues(numContours, range);
330}
331
336inline void vtkContourFilter::GenerateValues(int numContours, double rangeStart, double rangeEnd)
337{
338 this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
339}
340
345inline void vtkContourFilter::SetContourValues(const std::vector<double>& values)
346{
347 int numContours = static_cast<int>(values.size());
348 this->SetNumberOfContours(numContours);
349 for (int i = 0; i < numContours; i++)
350 {
351 this->SetValue(i, values[i]);
352 }
353}
354
360inline std::vector<double> vtkContourFilter::GetContourValues()
361{
362 std::vector<double> contours;
363 int numContours = this->GetNumberOfContours();
364 contours.reserve(numContours);
365 for (int i = 0; i < numContours; i++)
366 {
367 contours.push_back(this->GetValue(i));
368 }
369 return contours;
370}
371
372VTK_ABI_NAMESPACE_END
373#endif
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
~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
void SetInputArrayToProcess(const char *name, int fieldAssociation, int component=vtkArrayComponents::AllComponents)
Set the input data arrays that this algorithm will process.
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:323
#define VTK_MARSHALAUTO
#define vtkContourFilter
Definition vtkmContour.h:31