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=========================================================================*/
70#ifndef vtkEuclideanClusterExtraction_h
71#define vtkEuclideanClusterExtraction_h
72
73#include "vtkFiltersPointsModule.h" // For export macro
75
76#define VTK_EXTRACT_POINT_SEEDED_CLUSTERS 1
77#define VTK_EXTRACT_SPECIFIED_CLUSTERS 2
78#define VTK_EXTRACT_LARGEST_CLUSTER 3
79#define VTK_EXTRACT_ALL_CLUSTERS 4
80#define VTK_EXTRACT_CLOSEST_POINT_CLUSTER 5
81
82class vtkDataArray;
83class vtkFloatArray;
84class vtkIdList;
85class vtkIdTypeArray;
87
88class VTKFILTERSPOINTS_EXPORT vtkEuclideanClusterExtraction : public vtkPolyDataAlgorithm
89{
90public:
92 void PrintSelf(ostream& os, vtkIndent indent) override;
93
98
100
103 vtkSetClampMacro(Radius, double, 0.0, VTK_FLOAT_MAX);
104 vtkGetMacro(Radius, double);
106
108
114 vtkSetMacro(ScalarConnectivity, bool);
115 vtkGetMacro(ScalarConnectivity, bool);
116 vtkBooleanMacro(ScalarConnectivity, bool);
118
120
123 vtkSetVector2Macro(ScalarRange, double);
124 vtkGetVector2Macro(ScalarRange, double);
126
128
131 vtkSetClampMacro(
133 vtkGetMacro(ExtractionMode, int);
135 {
136 this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_CLUSTERS);
137 }
140 {
141 this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_CLUSTERS);
142 }
144 {
145 this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_CLUSTER);
146 }
147 void SetExtractionModeToAllClusters() { this->SetExtractionMode(VTK_EXTRACT_ALL_CLUSTERS); }
148 const char* GetExtractionModeAsString();
150
155
160
165
170
175
180
182
186 vtkSetVector3Macro(ClosestPoint, double);
187 vtkGetVectorMacro(ClosestPoint, double, 3);
189
194
196
199 vtkSetMacro(ColorClusters, bool);
200 vtkGetMacro(ColorClusters, bool);
201 vtkBooleanMacro(ColorClusters, bool);
203
205
211 vtkGetObjectMacro(Locator, vtkAbstractPointLocator);
213
214protected:
217
218 double Radius; // connection radius
219 bool ColorClusters; // boolean turns on/off scalar gen for separate clusters
220 int ExtractionMode; // how to extract clusters
221 vtkIdList* Seeds; // id's of points or cells used to seed clusters
222 vtkIdList* SpecifiedClusterIds; // clusters specified for extraction
223 vtkIdTypeArray* ClusterSizes; // size (in cells) of each cluster extracted
224
225 double ClosestPoint[3];
226
228 double ScalarRange[2];
229
231
232 // Configure the pipeline
235
236 // Internal method for propagating connected waves.
239
240private:
242 void operator=(const vtkEuclideanClusterExtraction&) = delete;
243
244 // used to support algorithm execution
245 vtkFloatArray* NeighborScalars;
246 vtkIdList* NeighborPointIds;
247 char* Visited;
248 vtkIdType* PointMap;
249 vtkIdTypeArray* NewScalars;
250 vtkIdType ClusterNumber;
251 vtkIdType PointNumber;
252 vtkIdType NumPointsInCluster;
253 vtkDataArray* InScalars;
254 vtkIdList* Wave;
255 vtkIdList* Wave2;
256 vtkIdList* PointIds;
257};
258
263{
265 {
266 return "ExtractPointSeededClusters";
267 }
269 {
270 return "ExtractSpecifiedClusters";
271 }
273 {
274 return "ExtractAllClusters";
275 }
277 {
278 return "ExtractClosestPointCluster";
279 }
280 else
281 {
282 return "ExtractLargestCluster";
283 }
284}
285
286#endif
abstract class to quickly locate points in 3-space
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
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:140
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:113
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate 3D points
Definition: vtkPoints.h:143
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