VTK  9.5.20250910
vtkPolyDataEdgeConnectivityFilter.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
73#ifndef vtkPolyDataEdgeConnectivityFilter_h
74#define vtkPolyDataEdgeConnectivityFilter_h
75
76#include "vtkFiltersCoreModule.h" // For export macro
77#include "vtkIdTypeArray.h" //
79#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
80
81#define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
82#define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
83#define VTK_EXTRACT_SPECIFIED_REGIONS 3
84#define VTK_EXTRACT_LARGEST_REGION 4
85#define VTK_EXTRACT_ALL_REGIONS 5
86#define VTK_EXTRACT_CLOSEST_POINT_REGION 6
87#define VTK_EXTRACT_LARGE_REGIONS 7
88
89VTK_ABI_NAMESPACE_BEGIN
90class vtkDataArray;
91class vtkCharArray;
92class vtkIdList;
93class vtkIdTypeArray;
94class vtkEdgeTable;
95
98{
99public:
101
106 void PrintSelf(ostream& os, vtkIndent indent) override;
108
110
113 vtkSetClampMacro(
115 vtkGetMacro(ExtractionMode, int);
117 {
118 this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);
119 }
121 {
122 this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);
123 }
126 {
127 this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);
128 }
130 {
131 this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);
132 }
134 void SetExtractionModeToAllRegions() { this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS); }
135 const char* GetExtractionModeAsString();
137
139
144 vtkSetMacro(BarrierEdges, vtkTypeBool);
145 vtkGetMacro(BarrierEdges, vtkTypeBool);
146 vtkBooleanMacro(BarrierEdges, vtkTypeBool);
148
150
161
163
171 vtkSetVector2Macro(BarrierEdgeLength, double);
172 vtkGetVector2Macro(BarrierEdgeLength, double);
174
176
181 vtkSetMacro(ScalarConnectivity, vtkTypeBool);
182 vtkGetMacro(ScalarConnectivity, vtkTypeBool);
183 vtkBooleanMacro(ScalarConnectivity, vtkTypeBool);
185
187
190 vtkSetVector2Macro(ScalarRange, double);
191 vtkGetVector2Macro(ScalarRange, double);
193
195
199 vtkGetObjectMacro(RegionSizes, vtkIdTypeArray);
201
206
210 void AddSeed(int id);
211
215 void DeleteSeed(int id);
216
221
225 void AddSpecifiedRegion(int id);
226
231
236
238
242 vtkSetVector3Macro(ClosestPoint, double);
243 vtkGetVectorMacro(ClosestPoint, double, 3);
245
246 // Control the region growing process.
248 {
249 RegionGrowingOff = 0,
250 LargeRegions = 1,
251 SmallRegions = 2
252 };
253
255
265 vtkSetClampMacro(RegionGrowing, int, RegionGrowingOff, SmallRegions);
266 vtkGetMacro(RegionGrowing, int);
267 void SetRegionGrowingOff() { this->SetRegionGrowing(RegionGrowingOff); }
268 void GrowLargeRegionsOff() { this->SetRegionGrowing(RegionGrowingOff); }
269 void GrowSmallRegionsOff() { this->SetRegionGrowing(RegionGrowingOff); }
270 void SetRegionGrowingToLargeRegions() { this->SetRegionGrowing(LargeRegions); }
271 void GrowLargeRegionsOn() { this->SetRegionGrowing(LargeRegions); }
272 void SetRegionGrowingToSmallRegions() { this->SetRegionGrowing(SmallRegions); }
273 void GrowSmallRegionsOn() { this->SetRegionGrowing(SmallRegions); }
275
277
285 vtkSetClampMacro(LargeRegionThreshold, double, 0.0, 1.0);
286 vtkGetMacro(LargeRegionThreshold, double);
288
293 int GetNumberOfExtractedRegions() { return this->NumberOfExtractedRegions; }
294
298 double GetTotalArea() { return this->TotalArea; }
299
301
306 vtkSetMacro(ColorRegions, vtkTypeBool);
307 vtkGetMacro(ColorRegions, vtkTypeBool);
308 vtkBooleanMacro(ColorRegions, vtkTypeBool);
310
312
317 vtkSetMacro(CellRegionAreas, vtkTypeBool);
318 vtkGetMacro(CellRegionAreas, vtkTypeBool);
319 vtkBooleanMacro(CellRegionAreas, vtkTypeBool);
321
323
328 vtkSetMacro(OutputPointsPrecision, int);
329 vtkGetMacro(OutputPointsPrecision, int);
331
332protected:
335
336 // Usual data generation method
338
339 // Optional second input
341
342 // Filter data members
343 vtkTypeBool ColorRegions; // boolean turns on/off scalar generation for separate regions
344 vtkTypeBool CellRegionAreas; // for each cell, the area of the region the cell is associated with
345
346 int ExtractionMode; // how to extract regions
347 vtkTypeBool BarrierEdges; // enable barrier edges
348 double BarrierEdgeLength[2]; // edges of length within this range are barrier edges
350 double ScalarRange[2];
351 std::vector<vtkIdType> Seeds; // id's of points or cells used to seed regions
352 std::vector<vtkIdType> SpecifiedRegionIds; // regions specified for extraction
353 vtkSmartPointer<vtkIdTypeArray> RegionSizes; // size (in cells) of each region extracted
354 double ClosestPoint[3];
356
357 // Methods for iterative traversal and marking cells
360 vtkIdType cellId, vtkIdType npts, const vtkIdType* pts, vtkIdList* neis);
363
364 // Methods implementing iterative region growing
367 int CurrentGrowPass; // region growing is a multiple-pass process
369 void ExchangeRegions(vtkIdType currentRegionId, vtkIdType neiId, vtkIdType neiRegId);
372 int AssimilateCell(vtkIdType cellId, vtkIdType npts, const vtkIdType* pts);
375
376 double TotalArea; // the total area of the input mesh
377 std::vector<double> CellAreas; // the area of each polygonal cell
378 std::vector<double> RegionAreas; // the total area of each region
379 std::vector<char> RegionClassification; // indicate whether the region is large or small
380
381 // used to support algorithm execution
382 std::vector<vtkIdType> RegionIds;
383 std::vector<vtkIdType> PointMap;
391 std::vector<vtkIdType> Wave;
392 std::vector<vtkIdType> Wave2;
397 double BRange2[2]; // BarrierEdgeLength[0,1]**2 of edge lengths defining barriers
398
399private:
401 void operator=(const vtkPolyDataEdgeConnectivityFilter&) = delete;
402};
403
408{
410 {
411 return "ExtractPointSeededRegions";
412 }
414 {
415 return "ExtractCellSeededRegions";
416 }
418 {
419 return "ExtractSpecifiedRegions";
420 }
421 else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
422 {
423 return "ExtractAllRegions";
424 }
426 {
427 return "ExtractClosestPointRegion";
428 }
430 {
431 return "ExtractLargeRegions";
432 }
433 else
434 {
435 return "ExtractLargestRegion";
436 }
437}
438
439VTK_ABI_NAMESPACE_END
440#endif
Proxy object to connect input/output ports.
dynamic, self-adjusting array of char
abstract superclass for arrays of numeric data
keep track of edges (edge is pair of integer id's)
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.
Superclass for algorithms that produce only polydata as output.
segment polygonal mesh based on shared edge connectivity
void GrowLargeRegionsOff()
Specify a strategy for region growing.
void SetExtractionModeToLargeRegions()
Control the extraction of connected surfaces.
vtkPolyData * GetSource()
Specify the source vtkPolyData object used to specify barrier edges (this is an optional connection....
void GrowSmallRegionsOn()
Specify a strategy for region growing.
void SetRegionGrowingToLargeRegions()
Specify a strategy for region growing.
void GrowLargeRegionsOn()
Specify a strategy for region growing.
static vtkPolyDataEdgeConnectivityFilter * New()
Standard methods to instantiate, get type information, and print the object.
int GetNumberOfSpecifiedRegions()
Get number of specified regions.
int AssimilateCell(vtkIdType cellId, vtkIdType npts, const vtkIdType *pts)
int IsScalarConnected(vtkIdType cellId, vtkIdType neiId)
void GrowSmallRegionsOff()
Specify a strategy for region growing.
const char * GetExtractionModeAsString()
Return the method of extraction as a string.
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
void SetExtractionModeToLargestRegion()
Control the extraction of connected surfaces.
void SetSourceData(vtkPolyData *)
Specify the source vtkPolyData object used to specify barrier edges (this is an optional connection....
void SetExtractionModeToAllRegions()
Control the extraction of connected surfaces.
void SetRegionGrowingToSmallRegions()
Specify a strategy for region growing.
void ExchangeRegions(vtkIdType currentRegionId, vtkIdType neiId, vtkIdType neiRegId)
void SetExtractionModeToSpecifiedRegions()
Control the extraction of connected surfaces.
void SetExtractionModeToPointSeededRegions()
Control the extraction of connected surfaces.
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify the source vtkPolyData object used to specify barrier edges (this is an optional connection....
void InitializeSeedList()
Initialize list of point ids/cell ids used to seed regions.
void SetExtractionModeToCellSeededRegions()
Control the extraction of connected surfaces.
void SetRegionGrowingOff()
Specify a strategy for region growing.
void DeleteSpecifiedRegion(int id)
Delete a region id to extract.
bool IsBarrierEdge(vtkIdType p0, vtkIdType p1)
int GetNumberOfExtractedRegions()
Obtain the number of connected regions found.
void SetExtractionModeToClosestPointRegion()
Control the extraction of connected surfaces.
void DeleteSeed(int id)
Delete a seed id (point or cell id).
void GetConnectedNeighbors(vtkIdType cellId, vtkIdType npts, const vtkIdType *pts, vtkIdList *neis)
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void AddSpecifiedRegion(int id)
Add a region id to extract.
void AddSeed(int id)
Add a seed id (point or cell id).
void InitializeSpecifiedRegionList()
Initialize list of region ids to extract.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods to instantiate, get type information, and print the object.
double GetTotalArea()
Obtain the total area of all regions combined.
concrete dataset represents vertices, lines, polygons, and triangle strips
Hold a reference to a vtkObjectBase instance.
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_EXTRACT_CLOSEST_POINT_REGION
#define VTK_EXTRACT_POINT_SEEDED_REGIONS
#define VTK_EXTRACT_ALL_REGIONS
#define VTK_EXTRACT_CELL_SEEDED_REGIONS
#define VTK_EXTRACT_SPECIFIED_REGIONS
#define VTK_EXTRACT_LARGEST_REGION
#define VTK_EXTRACT_CLOSEST_POINT_REGION
#define VTK_EXTRACT_POINT_SEEDED_REGIONS
#define VTK_EXTRACT_ALL_REGIONS
#define VTK_EXTRACT_CELL_SEEDED_REGIONS
#define VTK_EXTRACT_LARGE_REGIONS
#define VTK_EXTRACT_SPECIFIED_REGIONS
int vtkIdType
Definition vtkType.h:332
#define VTK_MARSHALAUTO