VTK  9.4.20241217
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
157#include "vtkContourValues.h" // Needed for inline methods
158
159VTK_ABI_NAMESPACE_BEGIN
160
163class vtkContourGrid;
164class vtkFlyingEdges2D;
165class vtkFlyingEdges3D;
169class vtkScalarTree;
172
173class VTKFILTERSCORE_EXPORT vtkContourFilter : public vtkPolyDataAlgorithm
174{
175public:
177 void PrintSelf(ostream& os, vtkIndent indent) override;
178
184
186
189 void SetValue(int i, double value);
190 double GetValue(int i);
191 double* GetValues();
192 void GetValues(double* contourValues);
193 void SetNumberOfContours(int number);
194 int GetNumberOfContours();
195 void GenerateValues(int numContours, double range[2]);
196 void GenerateValues(int numContours, double rangeStart, double rangeEnd);
197 void SetContourValues(const std::vector<double>& values);
198 std::vector<double> GetContourValues();
200
205
207
219 vtkSetMacro(ComputeNormals, int);
220 vtkGetMacro(ComputeNormals, int);
221 vtkBooleanMacro(ComputeNormals, int);
223
225
233 vtkSetMacro(ComputeGradients, vtkTypeBool);
234 vtkGetMacro(ComputeGradients, vtkTypeBool);
235 vtkBooleanMacro(ComputeGradients, vtkTypeBool);
237
239
242 vtkSetMacro(ComputeScalars, vtkTypeBool);
243 vtkGetMacro(ComputeScalars, vtkTypeBool);
244 vtkBooleanMacro(ComputeScalars, vtkTypeBool);
246
248
252 vtkSetMacro(UseScalarTree, vtkTypeBool);
253 vtkGetMacro(UseScalarTree, vtkTypeBool);
254 vtkBooleanMacro(UseScalarTree, vtkTypeBool);
256
258
262 vtkGetObjectMacro(ScalarTree, vtkScalarTree);
264
266
271 vtkGetObjectMacro(Locator, vtkIncrementalPointLocator);
273
279
281
285 vtkSetMacro(ArrayComponent, int);
286 vtkGetMacro(ArrayComponent, int);
288
290
297 vtkSetMacro(GenerateTriangles, vtkTypeBool);
298 vtkGetMacro(GenerateTriangles, vtkTypeBool);
299 vtkBooleanMacro(GenerateTriangles, vtkTypeBool);
301
303
308 vtkSetMacro(OutputPointsPrecision, int);
309 vtkGetMacro(OutputPointsPrecision, int);
311
313
321 vtkSetMacro(FastMode, bool);
322 vtkGetMacro(FastMode, bool);
323 vtkBooleanMacro(FastMode, bool);
325
331 void SetInputArray(const std::string& name)
332 {
333 this->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, name.c_str());
334 }
335
336protected:
339
341
343 vtkInformationVector* outputVector) override;
345 int FillInputPortInformation(int port, vtkInformation* info) override;
346
358
368
370 vtkObject* caller, unsigned long eid, void* clientData, void* callData);
371
372private:
373 vtkContourFilter(const vtkContourFilter&) = delete;
374 void operator=(const vtkContourFilter&) = delete;
375};
376
381inline void vtkContourFilter::SetValue(int i, double value)
382{
383 this->ContourValues->SetValue(i, value);
384}
385
389inline double vtkContourFilter::GetValue(int i)
390{
391 return this->ContourValues->GetValue(i);
392}
393
399{
400 return this->ContourValues->GetValues();
401}
402
408inline void vtkContourFilter::GetValues(double* contourValues)
409{
410 this->ContourValues->GetValues(contourValues);
411}
412
419{
420 this->ContourValues->SetNumberOfContours(number);
421}
422
427{
428 return this->ContourValues->GetNumberOfContours();
429}
430
435inline void vtkContourFilter::GenerateValues(int numContours, double range[2])
436{
437 this->ContourValues->GenerateValues(numContours, range);
438}
439
444inline void vtkContourFilter::GenerateValues(int numContours, double rangeStart, double rangeEnd)
445{
446 this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
447}
448
453inline void vtkContourFilter::SetContourValues(const std::vector<double>& values)
454{
455 int numContours = static_cast<int>(values.size());
456 this->SetNumberOfContours(numContours);
457 for (int i = 0; i < numContours; i++)
458 {
459 this->SetValue(i, values[i]);
460 }
461}
462
468inline std::vector<double> vtkContourFilter::GetContourValues()
469{
470 std::vector<double> contours;
471 int numContours = this->GetNumberOfContours();
472 contours.reserve(numContours);
473 for (int i = 0; i < numContours; i++)
474 {
475 contours.push_back(this->GetValue(i));
476 }
477 return contours;
478}
479
480VTK_ABI_NAMESPACE_END
481#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:270