VTK  9.5.20250915
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
151#ifndef vtkContourFilter_h
152#define vtkContourFilter_h
153
154#include "vtkFiltersCoreModule.h" // For export macro
155#include "vtkPolyDataAlgorithm.h"
156#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
157
158#include "vtkContourValues.h" // Needed for inline methods
159
160VTK_ABI_NAMESPACE_BEGIN
161
164class vtkContourGrid;
165class vtkFlyingEdges2D;
166class vtkFlyingEdges3D;
170class vtkScalarTree;
173
174class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkContourFilter : public vtkPolyDataAlgorithm
175{
176public:
178 void PrintSelf(ostream& os, vtkIndent indent) override;
179
185
187
190 void SetValue(int i, double value);
191 double GetValue(int i);
192 double* GetValues();
193 void GetValues(double* contourValues);
194 void SetNumberOfContours(int number);
195 int GetNumberOfContours();
196 void GenerateValues(int numContours, double range[2]);
197 void GenerateValues(int numContours, double rangeStart, double rangeEnd);
198 void SetContourValues(const std::vector<double>& values);
199 std::vector<double> GetContourValues();
201
206
208
220 vtkSetMacro(ComputeNormals, int);
221 vtkGetMacro(ComputeNormals, int);
222 vtkBooleanMacro(ComputeNormals, int);
224
226
234 vtkSetMacro(ComputeGradients, vtkTypeBool);
235 vtkGetMacro(ComputeGradients, vtkTypeBool);
236 vtkBooleanMacro(ComputeGradients, vtkTypeBool);
238
240
243 vtkSetMacro(ComputeScalars, vtkTypeBool);
244 vtkGetMacro(ComputeScalars, vtkTypeBool);
245 vtkBooleanMacro(ComputeScalars, vtkTypeBool);
247
249
253 vtkSetMacro(UseScalarTree, vtkTypeBool);
254 vtkGetMacro(UseScalarTree, vtkTypeBool);
255 vtkBooleanMacro(UseScalarTree, vtkTypeBool);
257
259
263 vtkGetObjectMacro(ScalarTree, vtkScalarTree);
265
267
272 vtkGetObjectMacro(Locator, vtkIncrementalPointLocator);
274
280
282
286 vtkSetMacro(ArrayComponent, int);
287 vtkGetMacro(ArrayComponent, int);
289
291
298 vtkSetMacro(GenerateTriangles, vtkTypeBool);
299 vtkGetMacro(GenerateTriangles, vtkTypeBool);
300 vtkBooleanMacro(GenerateTriangles, vtkTypeBool);
302
304
309 vtkSetMacro(OutputPointsPrecision, int);
310 vtkGetMacro(OutputPointsPrecision, int);
312
314
322 vtkSetMacro(FastMode, bool);
323 vtkGetMacro(FastMode, bool);
324 vtkBooleanMacro(FastMode, bool);
326
332 void SetInputArray(const std::string& name)
333 {
334 this->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, name.c_str());
335 }
336
337protected:
340
342
344 vtkInformationVector* outputVector) override;
346 int FillInputPortInformation(int port, vtkInformation* info) override;
347
359
369
371 vtkObject* caller, unsigned long eid, void* clientData, void* callData);
372
373private:
374 vtkContourFilter(const vtkContourFilter&) = delete;
375 void operator=(const vtkContourFilter&) = delete;
376};
377
382inline void vtkContourFilter::SetValue(int i, double value)
383{
384 this->ContourValues->SetValue(i, value);
385}
386
390inline double vtkContourFilter::GetValue(int i)
391{
392 return this->ContourValues->GetValue(i);
393}
394
400{
401 return this->ContourValues->GetValues();
402}
403
409inline void vtkContourFilter::GetValues(double* contourValues)
410{
411 this->ContourValues->GetValues(contourValues);
412}
413
420{
421 this->ContourValues->SetNumberOfContours(number);
422}
423
428{
429 return this->ContourValues->GetNumberOfContours();
430}
431
436inline void vtkContourFilter::GenerateValues(int numContours, double range[2])
437{
438 this->ContourValues->GenerateValues(numContours, range);
439}
440
445inline void vtkContourFilter::GenerateValues(int numContours, double rangeStart, double rangeEnd)
446{
447 this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
448}
449
454inline void vtkContourFilter::SetContourValues(const std::vector<double>& values)
455{
456 int numContours = static_cast<int>(values.size());
457 this->SetNumberOfContours(numContours);
458 for (int i = 0; i < numContours; i++)
459 {
460 this->SetValue(i, values[i]);
461 }
462}
463
469inline std::vector<double> vtkContourFilter::GetContourValues()
470{
471 std::vector<double> contours;
472 int numContours = this->GetNumberOfContours();
473 contours.reserve(numContours);
474 for (int i = 0; i < numContours; i++)
475 {
476 contours.push_back(this->GetValue(i));
477 }
478 return contours;
479}
480
481VTK_ABI_NAMESPACE_END
482#endif
supports function callbacks
fast generation of isosurface from 3D linear cells
generate isosurfaces/isolines from scalar values
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)
double * GetValues()
Return a pointer to a list of 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.
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:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Allocate and hold a VTK object.
Definition vtkNew.h:167
abstract base class for most VTK objects
Definition vtkObject.h:162
Superclass for algorithms that produce only polydata as output.
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:288
#define VTK_MARSHALAUTO