VTK  9.7.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
42 #ifndef vtkContourFilter_h
43 #define vtkContourFilter_h
44 
45 #include "vtkFiltersCoreModule.h" // For export macro
46 #include "vtkPolyDataAlgorithm.h"
47 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
48 
49 #include "vtkContourValues.h" // Needed for inline methods
50 
51 VTK_ABI_NAMESPACE_BEGIN
52 
53 class vtkCallbackCommand;
55 class vtkContourGrid;
56 class vtkFlyingEdges2D;
57 class vtkFlyingEdges3D;
61 class vtkScalarTree;
64 
65 class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkContourFilter : public vtkPolyDataAlgorithm
66 {
67 public:
69  void PrintSelf(ostream& os, vtkIndent indent) override;
70 
75  static vtkContourFilter* New();
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);
86  int GetNumberOfContours();
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 
96  vtkMTimeType GetMTime() override;
97 
99 
111  vtkSetMacro(ComputeNormals, int);
112  vtkGetMacro(ComputeNormals, int);
113  vtkBooleanMacro(ComputeNormals, int);
115 
117 
125  vtkSetMacro(ComputeGradients, vtkTypeBool);
126  vtkGetMacro(ComputeGradients, vtkTypeBool);
127  vtkBooleanMacro(ComputeGradients, vtkTypeBool);
129 
131 
134  vtkSetMacro(ComputeScalars, vtkTypeBool);
135  vtkGetMacro(ComputeScalars, vtkTypeBool);
136  vtkBooleanMacro(ComputeScalars, vtkTypeBool);
138 
140 
144  vtkSetMacro(UseScalarTree, vtkTypeBool);
145  vtkGetMacro(UseScalarTree, vtkTypeBool);
146  vtkBooleanMacro(UseScalarTree, vtkTypeBool);
148 
150 
153  virtual void SetScalarTree(vtkScalarTree*);
154  vtkGetObjectMacro(ScalarTree, vtkScalarTree);
156 
158 
162  void SetLocator(vtkIncrementalPointLocator* locator);
163  vtkGetObjectMacro(Locator, vtkIncrementalPointLocator);
165 
170  void CreateDefaultLocator();
171 
173 
177  vtkSetMacro(ArrayComponent, int);
178  vtkGetMacro(ArrayComponent, int);
180 
182 
189  vtkSetMacro(GenerateTriangles, vtkTypeBool);
190  vtkGetMacro(GenerateTriangles, vtkTypeBool);
191  vtkBooleanMacro(GenerateTriangles, vtkTypeBool);
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 
224  {
226  }
227 
228 protected:
230  ~vtkContourFilter() override;
231 
232  void ReportReferences(vtkGarbageCollector*) override;
233 
234  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
235  vtkInformationVector* outputVector) override;
237  int FillInputPortInformation(int port, vtkInformation* info) override;
238 
249  bool FastMode;
250 
260 
261  static void InternalProgressCallbackFunction(
262  vtkObject* caller, unsigned long eid, void* clientData, void* callData);
263 
264 private:
265  vtkContourFilter(const vtkContourFilter&) = delete;
266  void operator=(const vtkContourFilter&) = delete;
267 };
268 
273 inline void vtkContourFilter::SetValue(int i, double value)
274 {
275  this->ContourValues->SetValue(i, value);
276 }
277 
281 inline double vtkContourFilter::GetValue(int i)
282 {
283  return this->ContourValues->GetValue(i);
284 }
285 
291 {
292  return this->ContourValues->GetValues();
293 }
294 
300 inline 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 
327 inline void vtkContourFilter::GenerateValues(int numContours, double range[2])
328 {
329  this->ContourValues->GenerateValues(numContours, range);
330 }
331 
336 inline void vtkContourFilter::GenerateValues(int numContours, double rangeStart, double rangeEnd)
337 {
338  this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
339 }
340 
345 inline 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 
360 inline 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 
372 VTK_ABI_NAMESPACE_END
373 #endif
generate isosurface from 3D image data (volume)
abstract base class for most VTK objects
Definition: vtkObject.h:52
generate isosurfaces/isolines from scalar values (specialized for unstructured grids) ...
vtkTypeBool UseScalarTree
vtkIncrementalPointLocator * Locator
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
generate isosurface from structured grids
vtkNew< vtkContourValues > ContourValues
void ReportReferences(vtkGarbageCollector *) override
void SetNumberOfContours(int number)
Set the number of contours to place into the list.
Abstract class in support of both point location and point insertion.
void SetInputArray(const std::string &name)
Sets the name of the input array to be used for generating the isosurfaces.
vtkNew< vtkCallbackCommand > InternalProgressCallbackCommand
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
double GetValue(int i)
Get the ith contour value.
void SetInputArrayToProcess(const char *name, int fieldAssociation, int component=vtkArrayComponents::AllComponents)
Set the input data arrays that this algorithm will process.
Detect and break reference loops.
generate isosurface from structured points
vtkNew< vtkGridSynchronizedTemplates3D > GridSynchronizedTemplates
vtkNew< vtkContour3DLinearGrid > Contour3DLinearGrid
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:64
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
void SetValue(int i, double value)
Methods to set / get contour values.
fast generation of isosurface from 3D linear cells
double * GetValues()
Return a pointer to a list of contour values.
supports function callbacks
Superclass for algorithms that produce only polydata as output.
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
generate isosurfaces/isolines from scalar values
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkTypeBool ComputeScalars
int GetNumberOfContours()
Get the number of contours in the list of contour values.
generate isoline(s) from a structured points (image) dataset
virtual vtkMTimeType GetMTime()
Return this object's modified time.
vtkScalarTree * ScalarTree
vtkNew< vtkFlyingEdges3D > FlyingEdges3D
organize data according to scalar values (used to accelerate contouring operations) ...
Definition: vtkScalarTree.h:43
#define vtkContourFilter
Definition: vtkmContour.h:31
vtkTypeBool GenerateTriangles
generate isosurface from rectilinear grid
std::vector< double > GetContourValues()
Convenience method to get all of the contour values at once.
vtkNew< vtkContourGrid > ContourGrid
double GetValue(int i)
Get the ith contour value.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkTypeBool ComputeGradients
Store zero or more vtkInformation instances.
int GetNumberOfContours()
Return the number of contours in the.
vtkNew< vtkSynchronizedTemplates2D > SynchronizedTemplates2D
vtkNew< vtkFlyingEdges2D > FlyingEdges2D
#define VTK_MARSHALAUTO
generate isoline(s) from a structured points set
void SetValue(int i, double value)
Set the ith contour value.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
double * GetValues()
Get a pointer to an array of contour values.
void SetNumberOfContours(int number)
Set the number of contours to place into the list.
vtkNew< vtkRectilinearSynchronizedTemplates > RectilinearSynchronizedTemplates
void SetContourValues(const std::vector< double > &values)
Convenience method to set all of the contour values at once.
vtkNew< vtkSynchronizedTemplates3D > SynchronizedTemplates3D