VTK  9.3.20240420
vtkEuclideanClusterExtraction.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
61#ifndef vtkEuclideanClusterExtraction_h
62#define vtkEuclideanClusterExtraction_h
63
64#include "vtkFiltersPointsModule.h" // For export macro
66
67#define VTK_EXTRACT_POINT_SEEDED_CLUSTERS 1
68#define VTK_EXTRACT_SPECIFIED_CLUSTERS 2
69#define VTK_EXTRACT_LARGEST_CLUSTER 3
70#define VTK_EXTRACT_ALL_CLUSTERS 4
71#define VTK_EXTRACT_CLOSEST_POINT_CLUSTER 5
72
73VTK_ABI_NAMESPACE_BEGIN
74class vtkDataArray;
75class vtkFloatArray;
76class vtkIdList;
77class vtkIdTypeArray;
79
80class VTKFILTERSPOINTS_EXPORT vtkEuclideanClusterExtraction : public vtkPolyDataAlgorithm
81{
82public:
84 void PrintSelf(ostream& os, vtkIndent indent) override;
85
90
92
95 vtkSetClampMacro(Radius, double, 0.0, VTK_FLOAT_MAX);
96 vtkGetMacro(Radius, double);
98
100
106 vtkSetMacro(ScalarConnectivity, bool);
107 vtkGetMacro(ScalarConnectivity, bool);
108 vtkBooleanMacro(ScalarConnectivity, bool);
110
112
115 vtkSetVector2Macro(ScalarRange, double);
116 vtkGetVector2Macro(ScalarRange, double);
118
120
123 vtkSetClampMacro(
125 vtkGetMacro(ExtractionMode, int);
127 {
128 this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_CLUSTERS);
129 }
132 {
133 this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_CLUSTERS);
134 }
136 {
137 this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_CLUSTER);
138 }
139 void SetExtractionModeToAllClusters() { this->SetExtractionMode(VTK_EXTRACT_ALL_CLUSTERS); }
140 const char* GetExtractionModeAsString();
142
147
152
157
162
167
172
174
178 vtkSetVector3Macro(ClosestPoint, double);
179 vtkGetVectorMacro(ClosestPoint, double, 3);
181
186
188
191 vtkSetMacro(ColorClusters, bool);
192 vtkGetMacro(ColorClusters, bool);
193 vtkBooleanMacro(ColorClusters, bool);
195
197
203 vtkGetObjectMacro(Locator, vtkAbstractPointLocator);
205
206protected:
209
210 double Radius; // connection radius
211 bool ColorClusters; // boolean turns on/off scalar gen for separate clusters
212 int ExtractionMode; // how to extract clusters
213 vtkIdList* Seeds; // id's of points or cells used to seed clusters
214 vtkIdList* SpecifiedClusterIds; // clusters specified for extraction
215 vtkIdTypeArray* ClusterSizes; // size (in cells) of each cluster extracted
216
217 double ClosestPoint[3];
218
220 double ScalarRange[2];
221
223
224 // Configure the pipeline
226 int FillInputPortInformation(int port, vtkInformation* info) override;
227
228 // Internal method for propagating connected waves.
231
232private:
234 void operator=(const vtkEuclideanClusterExtraction&) = delete;
235
236 // used to support algorithm execution
237 vtkFloatArray* NeighborScalars;
238 vtkIdList* NeighborPointIds;
239 char* Visited;
240 vtkIdType* PointMap;
241 vtkIdTypeArray* NewScalars;
242 vtkIdType ClusterNumber;
243 vtkIdType PointNumber;
244 vtkIdType NumPointsInCluster;
245 vtkDataArray* InScalars;
246 vtkIdList* Wave;
247 vtkIdList* Wave2;
248 vtkIdList* PointIds;
249};
250
255{
257 {
258 return "ExtractPointSeededClusters";
259 }
261 {
262 return "ExtractSpecifiedClusters";
263 }
265 {
266 return "ExtractAllClusters";
267 }
269 {
270 return "ExtractClosestPointCluster";
271 }
272 else
273 {
274 return "ExtractLargestCluster";
275 }
276}
277
278VTK_ABI_NAMESPACE_END
279#endif
abstract class to quickly locate points in 3-space
abstract superclass for arrays of numeric data
perform segmentation based on geometric proximity and optional scalar threshold
void AddSpecifiedCluster(int id)
Add a cluster id to extract.
void SetExtractionModeToClosestPointCluster()
Control the extraction of connected surfaces.
~vtkEuclideanClusterExtraction() override
static vtkEuclideanClusterExtraction * New()
Construct with default extraction mode to extract largest clusters.
void InsertIntoWave(vtkIdList *wave, vtkIdType ptId)
void DeleteSpecifiedCluster(int id)
Delete a cluster id to extract.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void SetExtractionModeToLargestCluster()
Control the extraction of connected surfaces.
void TraverseAndMark(vtkPoints *pts)
void SetExtractionModeToSpecifiedClusters()
Control the extraction of connected surfaces.
void SetLocator(vtkAbstractPointLocator *locator)
Specify a point locator.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void SetExtractionModeToAllClusters()
Control the extraction of connected surfaces.
void InitializeSeedList()
Initialize the list of point ids used to seed clusters.
int GetNumberOfExtractedClusters()
Obtain the number of connected clusters.
void AddSeed(vtkIdType id)
Add a seed id (point id).
const char * GetExtractionModeAsString()
Return the method of extraction as a string.
void DeleteSeed(vtkIdType id)
Delete a seed id.a.
void InitializeSpecifiedClusterList()
Initialize the list of cluster ids to extract.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetExtractionModeToPointSeededClusters()
Control the extraction of connected surfaces.
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.
represent and manipulate 3D points
Definition vtkPoints.h:139
Superclass for algorithms that produce only polydata as output.
#define VTK_EXTRACT_SPECIFIED_CLUSTERS
#define VTK_EXTRACT_LARGEST_CLUSTER
#define VTK_EXTRACT_POINT_SEEDED_CLUSTERS
#define VTK_EXTRACT_ALL_CLUSTERS
#define VTK_EXTRACT_CLOSEST_POINT_CLUSTER
int vtkIdType
Definition vtkType.h:315
#define VTK_FLOAT_MAX
Definition vtkType.h:152