VTK  9.1.0
vtkEuclideanClusterExtraction.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkEuclideanClusterExtraction.h
5
6 Copyright (c) Kitware, Inc.
7 All rights reserved.
8 See LICENSE file for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
60#ifndef vtkEuclideanClusterExtraction_h
61#define vtkEuclideanClusterExtraction_h
62
63#include "vtkFiltersPointsModule.h" // For export macro
65
66#define VTK_EXTRACT_POINT_SEEDED_CLUSTERS 1
67#define VTK_EXTRACT_SPECIFIED_CLUSTERS 2
68#define VTK_EXTRACT_LARGEST_CLUSTER 3
69#define VTK_EXTRACT_ALL_CLUSTERS 4
70#define VTK_EXTRACT_CLOSEST_POINT_CLUSTER 5
71
72class vtkDataArray;
73class vtkFloatArray;
74class vtkIdList;
75class vtkIdTypeArray;
77
78class VTKFILTERSPOINTS_EXPORT vtkEuclideanClusterExtraction : public vtkPolyDataAlgorithm
79{
80public:
82 void PrintSelf(ostream& os, vtkIndent indent) override;
83
88
90
93 vtkSetClampMacro(Radius, double, 0.0, VTK_FLOAT_MAX);
94 vtkGetMacro(Radius, double);
96
98
104 vtkSetMacro(ScalarConnectivity, bool);
105 vtkGetMacro(ScalarConnectivity, bool);
106 vtkBooleanMacro(ScalarConnectivity, bool);
108
110
113 vtkSetVector2Macro(ScalarRange, double);
114 vtkGetVector2Macro(ScalarRange, double);
116
118
121 vtkSetClampMacro(
123 vtkGetMacro(ExtractionMode, int);
125 {
126 this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_CLUSTERS);
127 }
130 {
131 this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_CLUSTERS);
132 }
134 {
135 this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_CLUSTER);
136 }
137 void SetExtractionModeToAllClusters() { this->SetExtractionMode(VTK_EXTRACT_ALL_CLUSTERS); }
138 const char* GetExtractionModeAsString();
140
145
150
155
160
165
170
172
176 vtkSetVector3Macro(ClosestPoint, double);
177 vtkGetVectorMacro(ClosestPoint, double, 3);
179
184
186
189 vtkSetMacro(ColorClusters, bool);
190 vtkGetMacro(ColorClusters, bool);
191 vtkBooleanMacro(ColorClusters, bool);
193
195
201 vtkGetObjectMacro(Locator, vtkAbstractPointLocator);
203
204protected:
207
208 double Radius; // connection radius
209 bool ColorClusters; // boolean turns on/off scalar gen for separate clusters
210 int ExtractionMode; // how to extract clusters
211 vtkIdList* Seeds; // id's of points or cells used to seed clusters
212 vtkIdList* SpecifiedClusterIds; // clusters specified for extraction
213 vtkIdTypeArray* ClusterSizes; // size (in cells) of each cluster extracted
214
215 double ClosestPoint[3];
216
218 double ScalarRange[2];
219
221
222 // Configure the pipeline
225
226 // Internal method for propagating connected waves.
229
230private:
232 void operator=(const vtkEuclideanClusterExtraction&) = delete;
233
234 // used to support algorithm execution
235 vtkFloatArray* NeighborScalars;
236 vtkIdList* NeighborPointIds;
237 char* Visited;
238 vtkIdType* PointMap;
239 vtkIdTypeArray* NewScalars;
240 vtkIdType ClusterNumber;
241 vtkIdType PointNumber;
242 vtkIdType NumPointsInCluster;
243 vtkDataArray* InScalars;
244 vtkIdList* Wave;
245 vtkIdList* Wave2;
246 vtkIdList* PointIds;
247};
248
253{
255 {
256 return "ExtractPointSeededClusters";
257 }
259 {
260 return "ExtractSpecifiedClusters";
261 }
263 {
264 return "ExtractAllClusters";
265 }
267 {
268 return "ExtractClosestPointCluster";
269 }
270 else
271 {
272 return "ExtractLargestCluster";
273 }
274}
275
276#endif
abstract class to quickly locate points in 3-space
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:59
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
Definition: vtkFloatArray.h:45
list of point or cell ids
Definition: vtkIdList.h:40
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:43
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate 3D points
Definition: vtkPoints.h:43
Superclass for algorithms that produce only polydata as output.
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
#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:332
#define VTK_FLOAT_MAX
Definition: vtkType.h:163