VTK  9.5.20251127
vtkConnectedPointsFilter.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
41
42#ifndef vtkConnectedPointsFilter_h
43#define vtkConnectedPointsFilter_h
44
45#include "vtkFiltersPointsModule.h" // For export macro
47
48// Make these consistent with the other connectivity filters
49#define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
50#define VTK_EXTRACT_SPECIFIED_REGIONS 3
51#define VTK_EXTRACT_LARGEST_REGION 4
52#define VTK_EXTRACT_ALL_REGIONS 5
53#define VTK_EXTRACT_CLOSEST_POINT_REGION 6
54
55VTK_ABI_NAMESPACE_BEGIN
57class vtkDataArray;
58class vtkFloatArray;
59class vtkIdList;
60class vtkIdTypeArray;
61class vtkIntArray;
62
63class VTKFILTERSPOINTS_EXPORT vtkConnectedPointsFilter : public vtkPolyDataAlgorithm
64{
65public:
67 void PrintSelf(ostream& os, vtkIndent indent) override;
68
73
75
79 vtkSetClampMacro(Radius, double, 0.0, VTK_DOUBLE_MAX);
80 vtkGetMacro(Radius, double);
82
84
87 vtkSetClampMacro(
89 vtkGetMacro(ExtractionMode, int);
104 const char* GetExtractionModeAsString();
106
108
112 vtkSetVector3Macro(ClosestPoint, double);
113 vtkGetVectorMacro(ClosestPoint, double, 3);
115
120
125
130
135
140
145
147
153 vtkSetMacro(AlignedNormals, int);
154 vtkGetMacro(AlignedNormals, int);
155 vtkBooleanMacro(AlignedNormals, int);
157
159
164 vtkSetClampMacro(NormalAngle, double, 0.0001, 90.0);
165 vtkGetMacro(NormalAngle, double);
167
169
174 vtkSetMacro(ScalarConnectivity, int);
175 vtkGetMacro(ScalarConnectivity, int);
176 vtkBooleanMacro(ScalarConnectivity, int);
178
180
183 vtkSetVector2Macro(ScalarRange, double);
184 vtkGetVector2Macro(ScalarRange, double);
186
192
194
200 vtkGetObjectMacro(Locator, vtkAbstractPointLocator);
202
203protected:
206
207 // Usual data generation method
209 int FillInputPortInformation(int port, vtkInformation* info) override;
210
211 // The radius defines the proximal neighborhood of points
212 double Radius;
213
214 // indicate how to extract regions
216
217 // id's of points used to seed regions
219
220 // regions specified for extraction
222
223 // Seed with a closest point
224 double ClosestPoint[3];
225
226 // Segment based on nearly aligned normals
230
231 // Support segmentation based on scalar connectivity
233 double ScalarRange[2];
234
235 // accelerate searching
237
238 // Wave propagation used to segment points
240 vtkPoints* inPts, vtkDataArray* inScalars, float* normals, vtkIdType* labels);
241
242private:
243 // used to support algorithm execution
244 vtkIdType CurrentRegionNumber;
245 vtkIdTypeArray* RegionLabels;
246 vtkIdType NumPointsInRegion;
247 vtkIdTypeArray* RegionSizes;
248 vtkIdList* NeighborPointIds; // avoid repetitive new/delete
249 vtkIdList* Wave;
250 vtkIdList* Wave2;
251
253 void operator=(const vtkConnectedPointsFilter&) = delete;
254};
255
260{
262 {
263 return "ExtractPointSeededRegions";
264 }
266 {
267 return "ExtractSpecifiedRegions";
268 }
269 else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
270 {
271 return "ExtractAllRegions";
272 }
274 {
275 return "ExtractClosestPointRegion";
276 }
277 else
278 {
279 return "ExtractLargestRegion";
280 }
281}
282
283VTK_ABI_NAMESPACE_END
284#endif
abstract class to quickly locate points in 3-space
void SetExtractionModeToClosestPointRegion()
Control the extraction of connected regions.
void TraverseAndMark(vtkPoints *inPts, vtkDataArray *inScalars, float *normals, vtkIdType *labels)
vtkAbstractPointLocator * Locator
void SetExtractionModeToPointSeededRegions()
Control the extraction of connected regions.
void SetLocator(vtkAbstractPointLocator *locator)
Specify a point locator.
virtual void SetExtractionMode(int)
Control the extraction of connected regions.
static vtkConnectedPointsFilter * New()
Construct with default extraction mode to extract the largest region.
void InitializeSpecifiedRegionList()
Initialize list of region ids to extract.
void DeleteSeed(vtkIdType id)
Delete a point seed id.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void DeleteSpecifiedRegion(vtkIdType id)
Delete a region id to extract.
int GetNumberOfExtractedRegions()
Obtain the number of connected regions.
void SetExtractionModeToSpecifiedRegions()
Control the extraction of connected regions.
~vtkConnectedPointsFilter() override
void AddSpecifiedRegion(vtkIdType id)
Add a non-negative region id to extract.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void SetExtractionModeToAllRegions()
Control the extraction of connected regions.
void AddSeed(vtkIdType id)
Add a non-negative point seed id.
void SetExtractionModeToLargestRegion()
Control the extraction of connected regions.
const char * GetExtractionModeAsString()
Return the method of extraction as a string.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void InitializeSeedList()
Initialize list of point ids ids used to seed regions.
dynamic, self-adjusting array of float
list of point or cell ids
Definition vtkIdList.h:133
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.
dynamic, self-adjusting array of int
represent and manipulate 3D points
Definition vtkPoints.h:139
#define vtkDataArray
#define VTK_EXTRACT_CLOSEST_POINT_REGION
#define VTK_EXTRACT_POINT_SEEDED_REGIONS
#define VTK_EXTRACT_ALL_REGIONS
#define VTK_EXTRACT_SPECIFIED_REGIONS
#define VTK_EXTRACT_LARGEST_REGION
int vtkIdType
Definition vtkType.h:367
#define VTK_DOUBLE_MAX
Definition vtkType.h:206