VTK  9.6.20260626
vtkSurfaceNets3D.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
196
197#ifndef vtkSurfaceNets3D_h
198#define vtkSurfaceNets3D_h
199
200#include "vtkConstrainedSmoothingFilter.h" // Perform mesh smoothing
201#include "vtkContourValues.h" // Needed for direct access to ContourValues
202#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_7_0
203#include "vtkFiltersCoreModule.h" // For export macro
204#include "vtkPolyDataAlgorithm.h"
205#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
206
207#include <vector> // For selected seeds
208
209VTK_ABI_NAMESPACE_BEGIN
210
211class vtkImageData;
212
213class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkSurfaceNets3D : public vtkPolyDataAlgorithm
214{
215public:
217
223 void PrintSelf(ostream& os, vtkIndent indent) override;
225
231
233
246 void SetValue(int i, double value) { this->Labels->SetValue(i, value); }
247 void SetLabel(int i, double value) { this->Labels->SetValue(i, value); }
249
251
254 double GetValue(int i) { return this->Labels->GetValue(i); }
255 double GetLabel(int i) { return this->Labels->GetValue(i); }
257
259
263 double* GetValues() { return this->Labels->GetValues(); }
264 double* GetLabels() { return this->Labels->GetValues(); }
266
268
273 void GetValues(double* contourValues) { this->Labels->GetValues(contourValues); }
274 void GetLabels(double* contourValues) { this->Labels->GetValues(contourValues); }
276
278
285 void SetNumberOfLabels(int number) { this->Labels->SetNumberOfContours(number); }
286 void SetNumberOfContours(int number) { this->Labels->SetNumberOfContours(number); }
288
290
293 vtkIdType GetNumberOfLabels() { return this->Labels->GetNumberOfContours(); }
294 vtkIdType GetNumberOfContours() { return this->Labels->GetNumberOfContours(); }
296
298
302 void GenerateLabels(int numLabels, double range[2])
303 {
304 this->Labels->GenerateValues(numLabels, range);
305 }
306 void GenerateValues(int numContours, double range[2])
307 {
308 this->Labels->GenerateValues(numContours, range);
309 }
310 void GenerateLabels(int numLabels, double rangeStart, double rangeEnd)
311 {
312 this->Labels->GenerateValues(numLabels, rangeStart, rangeEnd);
313 }
314 void GenerateValues(int numContours, double rangeStart, double rangeEnd)
315 {
316 this->Labels->GenerateValues(numContours, rangeStart, rangeEnd);
317 }
318
319
321
331 vtkSetMacro(BackgroundLabel, double);
332 vtkGetMacro(BackgroundLabel, double);
334
336
340 vtkSetMacro(ArrayComponent, int);
341 vtkGetMacro(ArrayComponent, int);
343
353
355
366 vtkGetMacro(OutputMeshType, int);
371
372 // The following code is used to control the smoothing process. Internally
373 // there is a vtkConstrainedSmoothingFilter that can be directly
374 // manipulated. In addition, methods that delegate to this filter are also
375 // provided.
376
378
383 vtkSetMacro(Smoothing, bool);
384 vtkGetMacro(Smoothing, bool);
385 vtkBooleanMacro(Smoothing, bool);
387
389
394 void SetNumberOfIterations(int n) { this->Smoother->SetNumberOfIterations(n); }
395 int GetNumberOfIterations() { return this->Smoother->GetNumberOfIterations(); }
396 void SetRelaxationFactor(double f) { this->Smoother->SetRelaxationFactor(f); }
397 double GetRelaxationFactor() { return this->Smoother->GetRelaxationFactor(); }
398 void SetConstraintDistance(double d) { this->Smoother->SetConstraintDistance(d); }
399 double GetConstraintDistance() { return this->Smoother->GetConstraintDistance(); }
400 void SetConstraintBox(double sx, double sy, double sz)
401 {
402 this->Smoother->SetConstraintBox(sx, sy, sz);
403 }
404 void SetConstraintBox(double s[3]) { this->Smoother->SetConstraintBox(s); }
405 double* GetConstraintBox() VTK_SIZEHINT(3) { return this->Smoother->GetConstraintBox(); }
406 void GetConstraintBox(double s[3]) { this->Smoother->GetConstraintBox(s); }
408 {
409 this->Smoother->SetConstraintStrategyToConstraintDistance();
410 }
412 {
413 this->Smoother->SetConstraintStrategyToConstraintBox();
414 }
415 int GetConstraintStrategy() { return this->Smoother->GetConstraintStrategy(); }
417
419
433 vtkBooleanMacro(AutomaticSmoothingConstraints, bool);
434 vtkSetClampMacro(ConstraintScale, double, 0, 100);
435 vtkGetMacro(ConstraintScale, double);
437
439
445 VTK_DEPRECATED_IN_9_7_0("No longer used")
446 virtual void SetOptimizedSmoothingStencils(bool) {}
447 VTK_DEPRECATED_IN_9_7_0("No longer used")
448 virtual bool GetOptimizedSmoothingStencils() { return true; }
449 VTK_DEPRECATED_IN_9_7_0("No longer used")
451 VTK_DEPRECATED_IN_9_7_0("No longer used")
454
456
463 vtkGetSmartPointerMacro(Smoother, vtkConstrainedSmoothingFilter);
465
466 // The following code is used to control what is produced for output.
467
479 {
480 OUTPUT_STYLE_DEFAULT VTK_DEPRECATED_IN_9_7_0("Use vtkSurfaceNetsAtlas instead") = 0,
481 OUTPUT_STYLE_BOUNDARY VTK_DEPRECATED_IN_9_7_0("Use vtkSurfaceNetsAtlas instead") = 1,
482 OUTPUT_STYLE_SELECTED VTK_DEPRECATED_IN_9_7_0("Use vtkSurfaceNetsAtlas instead") = 2,
483 };
484
486
492 VTK_DEPRECATED_IN_9_7_0("Use vtkSurfaceNetsAtlas instead")
493 vtkSetClampMacro(OutputStyle, int, 0, 2);
494 VTK_DEPRECATED_IN_9_7_0("Use vtkSurfaceNetsAtlas instead")
495 vtkGetMacro(OutputStyle, int);
496 VTK_DEPRECATED_IN_9_7_0("Use vtkSurfaceNetsAtlas with OutputStyle=EXTRACT_ALL instead")
498 VTK_DEPRECATED_IN_9_7_0("Use vtkSurfaceNetsAtlas with OutputStyle=OUTPUT_STYLE_BOUNDARY instead")
500 VTK_DEPRECATED_IN_9_7_0("Use vtkSurfaceNetsAtlas with ExtractionMode=EXTRACT_LABEL_SET instead")
503
505
508 VTK_DEPRECATED_IN_9_7_0("Use vtkSurfaceNetsAtlas with ExtractionMode=EXTRACT_LABEL_SET instead")
510 VTK_DEPRECATED_IN_9_7_0("Use vtkSurfaceNetsAtlas with ExtractionMode=EXTRACT_LABEL_SET instead")
511 void AddSelectedLabel(double label);
512 VTK_DEPRECATED_IN_9_7_0("Use vtkSurfaceNetsAtlas with ExtractionMode=EXTRACT_LABEL_SET instead")
513 void DeleteSelectedLabel(double label);
514 VTK_DEPRECATED_IN_9_7_0("Use vtkSurfaceNetsAtlas with ExtractionMode=EXTRACT_LABEL_SET instead")
516 VTK_DEPRECATED_IN_9_7_0("Use vtkSurfaceNetsAtlas with ExtractionMode=EXTRACT_LABEL_SET instead")
517 double GetSelectedLabel(vtkIdType ithLabel);
519
529
531
542 vtkGetMacro(TriangulationStrategy, int);
552
553
555
565 vtkSetMacro(DataCaching, bool);
566 vtkGetMacro(DataCaching, bool);
567 vtkBooleanMacro(DataCaching, bool);
569
570protected:
572 ~vtkSurfaceNets3D() override = default;
573
574 // Support visualization pipeline operations.
576 int FillInputPortInformation(int port, vtkInformation* info) override;
577
578 // Support the contouring operation.
584
585 // Support smoothing.
590
591 // Support data caching of the extracted surface nets. This is used to
592 // avoid repeated surface extraction when only smoothing filter
593 // parameters are modified.
600
601 // Support output style
603 std::vector<double> SelectedLabels;
605
606 // Support triangulation strategy
608
609private:
610 vtkSurfaceNets3D(const vtkSurfaceNets3D&) = delete;
611 void operator=(const vtkSurfaceNets3D&) = delete;
612};
613
614VTK_ABI_NAMESPACE_END
615#endif
object to represent cell connectivity
adjust point positions using constrained smoothing
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
concrete dataset represents vertices, lines, polygons, and triangle strips
Hold a reference to a vtkObjectBase instance.
double * GetConstraintBox()
Convenience methods that delegate to the internal smoothing filter follow below.
void GetConstraintBox(double s[3])
Convenience methods that delegate to the internal smoothing filter follow below.
void SetTriangulationStrategyToMinArea()
Specify the strategy to triangulate the quads (not applicable if the output mesh type is set to MESH_...
virtual bool GetOptimizedSmoothingStencils()
Indicate whether to use optimized smoothing stencils.
double GetRelaxationFactor()
Convenience methods that delegate to the internal smoothing filter follow below.
void SetLabel(int i, double value)
Set a particular label value at label number i.
double GetSelectedLabel(vtkIdType ithLabel)
void SetOutputMeshTypeToTriangles()
Control the type of output mesh.
double GetLabel(int i)
Get the ith label value.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
virtual void OptimizedSmoothingStencilsOn()
Indicate whether to use optimized smoothing stencils.
double * GetLabels()
Get a pointer to an array of labels.
void InitializeSelectedLabelsList()
void GetValues(double *contourValues)
Fill a supplied list with label values.
void SetTriangulationStrategyToMinEdge()
Specify the strategy to triangulate the quads (not applicable if the output mesh type is set to MESH_...
void SetConstraintDistance(double d)
Convenience methods that delegate to the internal smoothing filter follow below.
int GetNumberOfIterations()
Convenience methods that delegate to the internal smoothing filter follow below.
MeshType
This enum is used to control the type of the output polygonal mesh.
void SetOutputMeshTypeToQuads()
Control the type of output mesh.
vtkSmartPointer< vtkContourValues > Labels
void GenerateLabels(int numLabels, double range[2])
Generate numLabels equally spaced labels between the specified range.
void SetConstraintStrategyToConstraintDistance()
Convenience methods that delegate to the internal smoothing filter follow below.
vtkSmartPointer< vtkConstrainedSmoothingFilter > Smoother
std::vector< double > SelectedLabels
virtual void OptimizedSmoothingStencilsOff()
Indicate whether to use optimized smoothing stencils.
vtkIdType GetNumberOfSelectedLabels()
~vtkSurfaceNets3D() override=default
void SetConstraintBox(double sx, double sy, double sz)
Convenience methods that delegate to the internal smoothing filter follow below.
void SetNumberOfIterations(int n)
Convenience methods that delegate to the internal smoothing filter follow below.
virtual void SetTriangulationStrategy(int)
Specify the strategy to triangulate the quads (not applicable if the output mesh type is set to MESH_...
static vtkSurfaceNets3D * New()
Standard methods for instantiation, printing, and obtaining type information.
vtkTimeStamp SelectedLabelsTime
void SetOutputStyleToDefault()
Specify the form (i.e., the style) of the output.
void SetConstraintBox(double s[3])
Convenience methods that delegate to the internal smoothing filter follow below.
TriangulationType
This enum is used to control how quadrilaterals are triangulated.
virtual void SetOutputMeshType(int)
Control the type of output mesh.
void SetRelaxationFactor(double f)
Convenience methods that delegate to the internal smoothing filter follow below.
void GetLabels(double *contourValues)
Fill a supplied list with label values.
void GenerateValues(int numContours, double range[2])
Generate numLabels equally spaced labels between the specified range.
void GenerateValues(int numContours, double rangeStart, double rangeEnd)
Generate numLabels equally spaced labels between the specified range.
void SetOutputStyleToBoundary()
Specify the form (i.e., the style) of the output.
void CacheData(vtkPolyData *pd, vtkCellArray *ca)
void SetOutputMeshTypeToDefault()
Control the type of output mesh.
vtkIdType GetNumberOfLabels()
Get the number of labels in the list of label values.
virtual void SetOptimizedSmoothingStencils(bool)
Indicate whether to use optimized smoothing stencils.
int GetConstraintStrategy()
Convenience methods that delegate to the internal smoothing filter follow below.
double GetConstraintDistance()
Convenience methods that delegate to the internal smoothing filter follow below.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkTimeStamp SmoothingTime
vtkIdType GetNumberOfContours()
Get the number of labels in the list of label values.
vtkMTimeType GetMTime() override
The modified time is also a function of the label values and the smoothing filter.
void AddSelectedLabel(double label)
void SetNumberOfLabels(int number)
Set the number of labels to place into the list.
void SetOutputStyleToSelected()
Specify the form (i.e., the style) of the output.
void GenerateLabels(int numLabels, double rangeStart, double rangeEnd)
Generate numLabels equally spaced labels between the specified range.
void SetTriangulationStrategyToGreedy()
Specify the strategy to triangulate the quads (not applicable if the output mesh type is set to MESH_...
void SetValue(int i, double value)
Set a particular label value at label number i.
void SetConstraintStrategyToConstraintBox()
Convenience methods that delegate to the internal smoothing filter follow below.
vtkSmartPointer< vtkPolyData > GeometryCache
OutputType
This enum is used to control the production of the filter output.
void DeleteSelectedLabel(double label)
double * GetValues()
Get a pointer to an array of labels.
void SetNumberOfContours(int number)
Set the number of labels to place into the list.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instantiation, printing, and obtaining type information.
double GetValue(int i)
Get the ith label value.
vtkSmartPointer< vtkCellArray > StencilsCache
record modification and/or execution time
#define VTK_DEPRECATED_IN_9_7_0(reason)
int vtkIdType
Definition vtkType.h:363
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:318
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO