VTK  9.3.0
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
42#ifndef vtkEuclideanClusterExtraction_h
43#define vtkEuclideanClusterExtraction_h
44
45#include "vtkFiltersPointsModule.h" // For export macro
47
48#define VTK_EXTRACT_POINT_SEEDED_CLUSTERS 1
49#define VTK_EXTRACT_SPECIFIED_CLUSTERS 2
50#define VTK_EXTRACT_LARGEST_CLUSTER 3
51#define VTK_EXTRACT_ALL_CLUSTERS 4
52#define VTK_EXTRACT_CLOSEST_POINT_CLUSTER 5
53
54VTK_ABI_NAMESPACE_BEGIN
55class vtkDataArray;
56class vtkFloatArray;
57class vtkIdList;
58class vtkIdTypeArray;
60
61class VTKFILTERSPOINTS_EXPORT vtkEuclideanClusterExtraction : public vtkPolyDataAlgorithm
62{
63public:
65 void PrintSelf(ostream& os, vtkIndent indent) override;
66
71
73
76 vtkSetClampMacro(Radius, double, 0.0, VTK_FLOAT_MAX);
77 vtkGetMacro(Radius, double);
79
81
87 vtkSetMacro(ScalarConnectivity, bool);
88 vtkGetMacro(ScalarConnectivity, bool);
89 vtkBooleanMacro(ScalarConnectivity, bool);
91
93
96 vtkSetVector2Macro(ScalarRange, double);
97 vtkGetVector2Macro(ScalarRange, double);
99
101
104 vtkSetClampMacro(
106 vtkGetMacro(ExtractionMode, int);
108 {
109 this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_CLUSTERS);
110 }
113 {
114 this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_CLUSTERS);
115 }
117 {
118 this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_CLUSTER);
119 }
120 void SetExtractionModeToAllClusters() { this->SetExtractionMode(VTK_EXTRACT_ALL_CLUSTERS); }
121 const char* GetExtractionModeAsString();
123
128
133
138
143
148
153
155
159 vtkSetVector3Macro(ClosestPoint, double);
160 vtkGetVectorMacro(ClosestPoint, double, 3);
162
167
169
172 vtkSetMacro(ColorClusters, bool);
173 vtkGetMacro(ColorClusters, bool);
174 vtkBooleanMacro(ColorClusters, bool);
176
178
184 vtkGetObjectMacro(Locator, vtkAbstractPointLocator);
186
187protected:
190
191 double Radius; // connection radius
192 bool ColorClusters; // boolean turns on/off scalar gen for separate clusters
193 int ExtractionMode; // how to extract clusters
194 vtkIdList* Seeds; // id's of points or cells used to seed clusters
195 vtkIdList* SpecifiedClusterIds; // clusters specified for extraction
196 vtkIdTypeArray* ClusterSizes; // size (in cells) of each cluster extracted
197
198 double ClosestPoint[3];
199
201 double ScalarRange[2];
202
204
205 // Configure the pipeline
207 int FillInputPortInformation(int port, vtkInformation* info) override;
208
209 // Internal method for propagating connected waves.
212
213private:
215 void operator=(const vtkEuclideanClusterExtraction&) = delete;
216
217 // used to support algorithm execution
218 vtkFloatArray* NeighborScalars;
219 vtkIdList* NeighborPointIds;
220 char* Visited;
221 vtkIdType* PointMap;
222 vtkIdTypeArray* NewScalars;
223 vtkIdType ClusterNumber;
224 vtkIdType PointNumber;
225 vtkIdType NumPointsInCluster;
226 vtkDataArray* InScalars;
227 vtkIdList* Wave;
228 vtkIdList* Wave2;
229 vtkIdList* PointIds;
230};
231
236{
238 {
239 return "ExtractPointSeededClusters";
240 }
242 {
243 return "ExtractSpecifiedClusters";
244 }
246 {
247 return "ExtractAllClusters";
248 }
250 {
251 return "ExtractClosestPointCluster";
252 }
253 else
254 {
255 return "ExtractLargestCluster";
256 }
257}
258
259VTK_ABI_NAMESPACE_END
260#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:23
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate 3D points
Definition vtkPoints.h:29
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