VTK  9.7.1
vtkFillPointCloud.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
55 #ifndef vtkFillPointCloud_h
56 #define vtkFillPointCloud_h
57 
58 #include "vtkFiltersMeshingModule.h" // For export macro
59 #include "vtkLabeledImagePointSampler.h" // For adaptive sampling
60 #include "vtkPolyDataAlgorithm.h"
61 #include "vtkSmartPointer.h" // For vtkSmartPointer
62 #include "vtkStaticPointLocator.h" // For point locator
63 
64 VTK_ABI_NAMESPACE_BEGIN
65 
66 class VTKFILTERSMESHING_EXPORT vtkFillPointCloud : public vtkPolyDataAlgorithm
67 {
68 public:
70 
74  static vtkFillPointCloud* New();
76  void PrintSelf(ostream& os, vtkIndent indent) override;
78 
80 
87  {
88  UNIFORM = 0,
89  ADAPTIVE = 1
90  };
91  vtkSetClampMacro(FillStrategy, int, UNIFORM, ADAPTIVE);
92  vtkGetMacro(FillStrategy, int);
93  void SetFillStrategyToUniform() { this->SetFillStrategy(UNIFORM); }
94  void SetFillStrategyToAdaptive() { this->SetFillStrategy(ADAPTIVE); }
96 
98 
104  vtkSetMacro(InLabel, int);
105  vtkGetMacro(InLabel, int);
107 
109 
115  vtkSetMacro(BackgroundLabel, int);
116  vtkGetMacro(BackgroundLabel, int);
118 
120 
127  vtkSetClampMacro(MaximumNumberOfPoints, int, 1, VTK_INT_MAX);
128  vtkGetMacro(MaximumNumberOfPoints, int);
130 
132 
138  vtkSetMacro(ManualLocatorControl, vtkTypeBool);
139  vtkGetMacro(ManualLocatorControl, vtkTypeBool);
140  vtkBooleanMacro(ManualLocatorControl, vtkTypeBool);
142 
144 
149  vtkStaticPointLocator* GetLocator() { return this->Locator; }
151 
153 
161  void SetJoggle(vtkTypeBool onoff)
162  {
163  this->PointSampler->SetJoggle(onoff);
164  this->UpdateJoggleInfo();
165  }
166  vtkTypeBool GetJoggle() const { return this->PointSampler->GetJoggle(); }
167  void JoggleOn()
168  {
169  this->PointSampler->JoggleOn();
170  this->UpdateJoggleInfo();
171  }
172  void JoggleOff()
173  {
174  this->PointSampler->JoggleOff();
175  this->UpdateJoggleInfo();
176  }
177 
179  {
180  this->PointSampler->SetJoggleRadiusIsAbsolute(onoff);
181  this->UpdateJoggleInfo();
182  }
184  {
185  return this->PointSampler->GetJoggleRadiusIsAbsolute();
186  }
188  {
189  this->PointSampler->JoggleRadiusIsAbsoluteOn();
190  this->UpdateJoggleInfo();
191  }
193  {
194  this->PointSampler->JoggleRadiusIsAbsoluteOff();
195  this->UpdateJoggleInfo();
196  }
197 
198  void SetJoggleRadius(double r)
199  {
200  this->PointSampler->SetJoggleRadius(r);
201  this->UpdateJoggleInfo();
202  }
203  double GetJoggleRadius() const { return this->PointSampler->GetJoggleRadius(); }
205 
207 
211  vtkLabeledImagePointSampler* GetPointSampler() { return this->PointSampler; }
213 
218  vtkIdType GetNumberOfAddedPoints() { return this->NumberOfAddedPoints; }
219 
224  vtkMTimeType GetMTime() override;
225 
226 protected:
228  ~vtkFillPointCloud() override;
229 
231  int InLabel;
234 
235  // These data members are maintained by the internal point sampler.
237  double JoggleRadius;
239 
241  vtkSmartPointer<vtkStaticPointLocator> Locator; // locator for finding proximal points
242 
244 
246 
247  // Internal helper methods
248  void UpdateJoggleInfo();
249 
250  vtkPoints* CreatePointsAndRegions(vtkPointSet* input, vtkInformationVector** inputVector,
251  vtkIdType numNewPts, vtkPolyData* output);
252 
253  // Support second input
255  int FillInputPortInformation(int port, vtkInformation* info) override;
256 
257 private:
258  vtkFillPointCloud(const vtkFillPointCloud&) = delete;
259  void operator=(const vtkFillPointCloud&) = delete;
260 };
261 
262 VTK_ABI_NAMESPACE_END
263 #endif
vtkIdType GetNumberOfAddedPoints()
Get the number of points added.
vtkSmartPointer< vtkLabeledImagePointSampler > PointSampler
void JoggleOn()
Enable/disable point joggling.
FillStrategyOptions
Specify the fill strategy to use when generating new points.
vtkStaticPointLocator * GetLocator()
Retrieve the internal locator to manually configure it, for example specifying the number of points p...
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.
#define VTK_INT_MAX
Definition: vtkType.h:192
void SetJoggle(vtkTypeBool onoff)
Enable/disable point joggling.
vtkLabeledImagePointSampler * GetPointSampler()
Retrieve the internal instance of vtkLabeledImagePointSampler in order to better control the adaptive...
concrete class for storing a set of points
Definition: vtkPointSet.h:58
int vtkIdType
Definition: vtkType.h:363
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
void SetFillStrategyToAdaptive()
Specify the fill strategy to use when generating new points.
double GetJoggleRadius() const
Enable/disable point joggling.
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:64
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:28
add points to empty regions in an input point cloud
vtkIdType NumberOfAddedPoints
virtual vtkMTimeType GetMTime()
Return this object's modified time.
void JoggleOff()
Enable/disable point joggling.
vtkSmartPointer< vtkStaticPointLocator > Locator
vtkTypeBool JoggleRadiusIsAbsolute
quickly locate points in 3-space
produce sampled points from a segmented image
void JoggleRadiusIsAbsoluteOff()
Enable/disable point joggling.
void JoggleRadiusIsAbsoluteOn()
Enable/disable point joggling.
vtkTypeBool GetJoggleRadiusIsAbsolute() const
Enable/disable point joggling.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
Store zero or more vtkInformation instances.
void SetJoggleRadius(double r)
Enable/disable point joggling.
void SetFillStrategyToUniform()
Specify the fill strategy to use when generating new points.
void SetJoggleRadiusIsAbsolute(vtkTypeBool onoff)
Enable/disable point joggling.
vtkTypeBool ManualLocatorControl
represent and manipulate 3D points
Definition: vtkPoints.h:30
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTypeBool GetJoggle() const
Enable/disable point joggling.