VTK  9.6.20260626
vtkGeneralizedSurfaceNets3D.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
133
134#ifndef vtkGeneralizedSurfaceNets3D_h
135#define vtkGeneralizedSurfaceNets3D_h
136
137#include "vtkConstrainedSmoothingFilter.h" // Perform surface smoothing
138#include "vtkContourValues.h" // Manage contour values
139#include "vtkFiltersMeshingModule.h" // For export macro
140#include "vtkPolyDataAlgorithm.h"
141#include "vtkStaticPointLocator.h" // For point locator
142#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
143
144VTK_ABI_NAMESPACE_BEGIN
145
146class VTKFILTERSMESHING_EXPORT VTK_MARSHALAUTO vtkGeneralizedSurfaceNets3D
147 : public vtkPolyDataAlgorithm
148{
149public:
151
156 void PrintSelf(ostream& os, vtkIndent indent) override;
158
159 //---------------The following are methods used to set/get and generate
160 //---------------contour labels. Contour labels are required to be
161 //---------------specified by this filter.
163
175 void SetValue(int i, double value) { this->Labels->SetValue(i, value); }
176 void SetLabel(int i, double value) { this->Labels->SetValue(i, value); }
178
180
183 double GetValue(int i) { return this->Labels->GetValue(i); }
184 double GetLabel(int i) { return this->Labels->GetValue(i); }
186
188
192 double* GetValues() { return this->Labels->GetValues(); }
193 double* GetLabels() { return this->Labels->GetValues(); }
195
197
202 void GetValues(double* contourValues) { this->Labels->GetValues(contourValues); }
203 void GetLabels(double* contourValues) { this->Labels->GetValues(contourValues); }
205
207
214 void SetNumberOfLabels(int number) { this->Labels->SetNumberOfContours(number); }
215 void SetNumberOfContours(int number) { this->Labels->SetNumberOfContours(number); }
217
219
222 vtkIdType GetNumberOfLabels() { return this->Labels->GetNumberOfContours(); }
223 vtkIdType GetNumberOfContours() { return this->Labels->GetNumberOfContours(); }
225
227
231 void GenerateLabels(int numLabels, double range[2])
232 {
233 this->Labels->GenerateValues(numLabels, range);
234 }
235 void GenerateValues(int numContours, double range[2])
236 {
237 this->Labels->GenerateValues(numContours, range);
238 }
239 void GenerateLabels(int numLabels, double rangeStart, double rangeEnd)
240 {
241 this->Labels->GenerateValues(numLabels, rangeStart, rangeEnd);
242 }
243 void GenerateValues(int numContours, double rangeStart, double rangeEnd)
244 {
245 this->Labels->GenerateValues(numContours, rangeStart, rangeEnd);
246 }
247
248
250
257 vtkSetMacro(BackgroundLabel, int);
258 vtkGetMacro(BackgroundLabel, int);
260
261 //---------------Done defining label-related methods.
263
269 vtkBooleanMacro(BoundaryCapping, vtkTypeBool);
271
273
281 vtkBooleanMacro(MergePoints, vtkTypeBool);
283
285
293 vtkSetMacro(Smoothing, vtkTypeBool);
294 vtkGetMacro(Smoothing, vtkTypeBool);
295 vtkBooleanMacro(Smoothing, vtkTypeBool);
297
299
304 void SetNumberOfIterations(int n) { this->Smoother->SetNumberOfIterations(n); }
305 int GetNumberOfIterations() { return this->Smoother->GetNumberOfIterations(); }
306 void SetRelaxationFactor(double f) { this->Smoother->SetRelaxationFactor(f); }
307 double GetRelaxationFactor() { return this->Smoother->GetRelaxationFactor(); }
308 void SetConstraintDistance(double d) { this->Smoother->SetConstraintDistance(d); }
309 double GetConstraintDistance() { return this->Smoother->GetConstraintDistance(); }
311
313
332
334
346 vtkSetVector4Macro(SmoothingConstraints, unsigned char);
347 vtkGetVector4Macro(SmoothingConstraints, unsigned char);
352
354
363 vtkGetSmartPointerMacro(Smoother, vtkConstrainedSmoothingFilter);
365
378
380
391 vtkGetMacro(OutputMeshType, int);
396
398
404 vtkSetClampMacro(Padding, double, 0.001, 0.25);
405 vtkGetMacro(Padding, double);
407
409
416
418
424 vtkSetMacro(Validate, vtkTypeBool);
425 vtkGetMacro(Validate, vtkTypeBool);
426 vtkBooleanMacro(Validate, vtkTypeBool);
428
430
445 vtkSetClampMacro(PointOfInterest, vtkIdType, -1, VTK_ID_MAX);
447 vtkSetObjectMacro(PointsOfInterest, vtkIdTypeArray);
448 vtkGetObjectMacro(PointsOfInterest, vtkIdTypeArray);
452
454
458 vtkSetClampMacro(PruneTolerance, double, 0.0, 0.5);
459 vtkGetMacro(PruneTolerance, double);
461
463
471 vtkSetClampMacro(BatchSize, unsigned int, 1, VTK_INT_MAX);
472 vtkGetMacro(BatchSize, unsigned int);
474
479 int GetNumberOfThreads() { return this->NumberOfThreads; }
480
485 int GetNumberOfPrunes() { return this->NumberOfPrunes; }
486
492
493protected:
495 ~vtkGeneralizedSurfaceNets3D() override = default;
496
497 // Support the contouring operation by defining labels.
500
501 // Algorithm control
502 vtkTypeBool BoundaryCapping; // produce boundary surfaces or not
503 vtkTypeBool MergePoints; // merge near coincident points or not
504 vtkTypeBool Smoothing; // enable built-in smoothing process
505
506 // Internal classes Related to point location and smoothing control
508 vtkSmartPointer<vtkStaticPointLocator> Locator; // locator for finding proximal points
509
510 // Control the type of output mesh. Triangles by default.
512
513 // Related to internal Voronoi methods
514 double Padding; // amount to pad out input points bounding box
515 vtkTypeBool Validate; // Choose to validate and repair output
516 vtkTypeBool GenerateSmoothingStencils; // Produce smoothing stencils
517 unsigned char SmoothingConstraints[4]; // Specify which smoothing constraints are active
518 vtkIdType PointOfInterest; // specify a single input point to process
520 vtkIdType MaximumNumberOfHullClips; // limit the number of hull clips
521 double PruneTolerance; // prune tiny faces
522 unsigned int BatchSize; // process data in batches of specified size
523 int NumberOfThreads; // report on the number of threads used during processing
524 int NumberOfPrunes; // If spoke pruning is enabled, report number of pruning operations
525
526 // Satisfy pipeline-related API
528 int FillInputPortInformation(int port, vtkInformation* info) override;
529
530private:
532 void operator=(const vtkGeneralizedSurfaceNets3D&) = delete;
533};
534
535VTK_ABI_NAMESPACE_END
536#endif
adjust point positions using constrained smoothing
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void GenerateValues(int numContours, double range[2])
Generate numLabels equally spaced labels between the specified range.
int GetNumberOfPrunes()
Return the number of hull prunes performed during execution.
void SetValue(int i, double value)
Set a particular label value at label number i.
MeshType
This enum is used to control the type of the output polygonal mesh.
vtkSmartPointer< vtkContourValues > Labels
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instantiation, type information, and printing.
void GenerateLabels(int numLabels, double range[2])
Generate numLabels equally spaced labels between the specified range.
double GetRelaxationFactor()
Convenience methods that delegate to the internal smoothing filter follow below.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
double GetLabel(int i)
Get the ith label value.
int GetNumberOfIterations()
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.
void GetValues(double *contourValues)
Fill a supplied list with label values.
vtkIdType GetNumberOfLabels()
Get the number of labels in the list of label values.
vtkMTimeType GetMTime() override
The modified time is also a function of the built in locator, smoothing filter, and label values.
void SetNumberOfContours(int number)
Set the number of labels to place into the list.
void AllSmoothingConstraintsOff()
If GenerateSmoothingStencils is on, this provides some control over each point's stencil creation.
void EdgeSmoothingConstraintOff()
If GenerateSmoothingStencils is on, this provides some control over each point's stencil creation.
double GetValue(int i)
Get the ith label value.
vtkSmartPointer< vtkIdTypeArray > PointsOfInterest
void SetNumberOfIterations(int n)
Convenience methods that delegate to the internal smoothing filter follow below.
void SetOutputMeshTypeToDefault()
Control the type of output mesh.
int GetNumberOfThreads()
Return the number of threads actually used during execution.
void SetOutputMeshTypeToPolygons()
Control the type of output mesh.
vtkSmartPointer< vtkConstrainedSmoothingFilter > Smoother
double * GetLabels()
Get a pointer to an array of labels.
virtual void SetSmoothingConstraints(unsigned char, unsigned char, unsigned char, unsigned char)
If GenerateSmoothingStencils is on, this provides some control over each point's stencil creation.
double * GetValues()
Get a pointer to an array of labels.
~vtkGeneralizedSurfaceNets3D() override=default
void SetRelaxationFactor(double f)
Convenience methods that delegate to the internal smoothing filter follow below.
static vtkGeneralizedSurfaceNets3D * New()
Standard methods for instantiation, type information, and printing.
void GenerateLabels(int numLabels, double rangeStart, double rangeEnd)
Generate numLabels equally spaced labels between the specified range.
vtkIdType GetNumberOfContours()
Get the number of labels in the list of label values.
vtkStaticPointLocator * GetLocator()
Retrieve the internal locator to manually configure it, for example specifying the number of points p...
void SetConstraintDistance(double d)
Convenience methods that delegate to the internal smoothing filter follow below.
void SetNumberOfLabels(int number)
Set the number of labels to place into the list.
void GetLabels(double *contourValues)
Fill a supplied list with label values.
void SetOutputMeshTypeToTriangles()
Control the type of output mesh.
vtkSmartPointer< vtkStaticPointLocator > Locator
virtual void SetOutputMeshType(int)
Control the type of output mesh.
void AllSmoothingConstraintsOn()
If GenerateSmoothingStencils is on, this provides some control over each point's stencil creation.
void GenerateValues(int numContours, double rangeStart, double rangeEnd)
Generate numLabels equally spaced labels between the specified range.
double GetConstraintDistance()
Convenience methods that delegate to the internal smoothing filter follow below.
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Hold a reference to a vtkObjectBase instance.
quickly locate points in 3-space
int vtkTypeBool
Definition vtkABI.h:64
int vtkIdType
Definition vtkType.h:363
#define VTK_ID_MAX
Definition vtkType.h:367
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:318
#define VTK_INT_MAX
Definition vtkType.h:192
#define VTK_MARSHALAUTO