VTK  9.1.0
vtkPolyDataEdgeConnectivityFilter.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkPolyDataEdgeConnectivityFilter.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm 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=========================================================================*/
82#ifndef vtkPolyDataEdgeConnectivityFilter_h
83#define vtkPolyDataEdgeConnectivityFilter_h
84
85#include "vtkFiltersCoreModule.h" // For export macro
86#include "vtkIdTypeArray.h" //
88
89#define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
90#define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
91#define VTK_EXTRACT_SPECIFIED_REGIONS 3
92#define VTK_EXTRACT_LARGEST_REGION 4
93#define VTK_EXTRACT_ALL_REGIONS 5
94#define VTK_EXTRACT_CLOSEST_POINT_REGION 6
95#define VTK_EXTRACT_LARGE_REGIONS 7
96
97class vtkDataArray;
98class vtkCharArray;
99class vtkIdList;
100class vtkIdTypeArray;
101class vtkEdgeTable;
102
103class VTKFILTERSCORE_EXPORT vtkPolyDataEdgeConnectivityFilter : public vtkPolyDataAlgorithm
104{
105public:
107
112 void PrintSelf(ostream& os, vtkIndent indent) override;
114
116
119 vtkSetClampMacro(
121 vtkGetMacro(ExtractionMode, int);
123 {
124 this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);
125 }
127 {
128 this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);
129 }
132 {
133 this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);
134 }
136 {
137 this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);
138 }
140 void SetExtractionModeToAllRegions() { this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS); }
141 const char* GetExtractionModeAsString();
143
145
150 vtkSetMacro(BarrierEdges, vtkTypeBool);
151 vtkGetMacro(BarrierEdges, vtkTypeBool);
152 vtkBooleanMacro(BarrierEdges, vtkTypeBool);
154
156
167
169
177 vtkSetVector2Macro(BarrierEdgeLength, double);
178 vtkGetVector2Macro(BarrierEdgeLength, double);
180
182
187 vtkSetMacro(ScalarConnectivity, vtkTypeBool);
188 vtkGetMacro(ScalarConnectivity, vtkTypeBool);
189 vtkBooleanMacro(ScalarConnectivity, vtkTypeBool);
191
193
196 vtkSetVector2Macro(ScalarRange, double);
197 vtkGetVector2Macro(ScalarRange, double);
199
201
205 vtkGetObjectMacro(RegionSizes, vtkIdTypeArray);
207
212
216 void AddSeed(int id);
217
221 void DeleteSeed(int id);
222
227
231 void AddSpecifiedRegion(int id);
232
237
242
244
248 vtkSetVector3Macro(ClosestPoint, double);
249 vtkGetVectorMacro(ClosestPoint, double, 3);
251
252 // Control the region growing process.
254 {
255 RegionGrowingOff = 0,
256 LargeRegions = 1,
257 SmallRegions = 2
258 };
259
261
271 vtkSetClampMacro(RegionGrowing, int, RegionGrowingOff, SmallRegions);
272 vtkGetMacro(RegionGrowing, int);
273 void SetRegionGrowingOff() { this->SetRegionGrowing(RegionGrowingOff); }
274 void GrowLargeRegionsOff() { this->SetRegionGrowing(RegionGrowingOff); }
275 void GrowSmallRegionsOff() { this->SetRegionGrowing(RegionGrowingOff); }
276 void SetRegionGrowingToLargeRegions() { this->SetRegionGrowing(LargeRegions); }
277 void GrowLargeRegionsOn() { this->SetRegionGrowing(LargeRegions); }
278 void SetRegionGrowingToSmallRegions() { this->SetRegionGrowing(SmallRegions); }
279 void GrowSmallRegionsOn() { this->SetRegionGrowing(SmallRegions); }
281
283
291 vtkSetClampMacro(LargeRegionThreshold, double, 0.0, 1.0);
292 vtkGetMacro(LargeRegionThreshold, double);
294
299 int GetNumberOfExtractedRegions() { return this->NumberOfExtractedRegions; }
300
304 double GetTotalArea() { return this->TotalArea; }
305
307
312 vtkSetMacro(ColorRegions, vtkTypeBool);
313 vtkGetMacro(ColorRegions, vtkTypeBool);
314 vtkBooleanMacro(ColorRegions, vtkTypeBool);
316
318
323 vtkSetMacro(CellRegionAreas, vtkTypeBool);
324 vtkGetMacro(CellRegionAreas, vtkTypeBool);
325 vtkBooleanMacro(CellRegionAreas, vtkTypeBool);
327
329
334 vtkSetMacro(OutputPointsPrecision, int);
335 vtkGetMacro(OutputPointsPrecision, int);
337
338protected:
341
342 // Usual data generation method
344
345 // Optional second input
347
348 // Filter data members
349 vtkTypeBool ColorRegions; // boolean turns on/off scalar generation for separate regions
350 vtkTypeBool CellRegionAreas; // for each cell, the area of the region the cell is associated with
351
352 int ExtractionMode; // how to extract regions
353 vtkTypeBool BarrierEdges; // enable barrier edges
354 double BarrierEdgeLength[2]; // edges of length within this range are barrier edges
356 double ScalarRange[2];
357 std::vector<vtkIdType> Seeds; // id's of points or cells used to seed regions
358 std::vector<vtkIdType> SpecifiedRegionIds; // regions specified for extraction
359 vtkSmartPointer<vtkIdTypeArray> RegionSizes; // size (in cells) of each region extracted
360 double ClosestPoint[3];
362
363 // Methods for iterative traversal and marking cells
366 vtkIdType cellId, vtkIdType npts, const vtkIdType* pts, vtkIdList* neis);
369
370 // Methods implementing iterative region growing
373 int CurrentGrowPass; // region growing is a multiple-pass process
375 void ExchangeRegions(vtkIdType currentRegionId, vtkIdType neiId, vtkIdType neiRegId);
378 int AssimilateCell(vtkIdType cellId, vtkIdType npts, const vtkIdType* pts);
381
382 double TotalArea; // the total area of the input mesh
383 std::vector<double> CellAreas; // the area of each polygonal cell
384 std::vector<double> RegionAreas; // the total area of each region
385 std::vector<char> RegionClassification; // indicate whether the region is large or small
386
387 // used to support algorithm execution
388 std::vector<vtkIdType> RegionIds;
389 std::vector<vtkIdType> PointMap;
397 std::vector<vtkIdType> Wave;
398 std::vector<vtkIdType> Wave2;
403 double BRange2[2]; // BarrierEdgeLenght[0,1]**2 of edge lengths defining barriers
404
405private:
407 void operator=(const vtkPolyDataEdgeConnectivityFilter&) = delete;
408};
409
414{
416 {
417 return "ExtractPointSeededRegions";
418 }
420 {
421 return "ExtractCellSeededRegions";
422 }
424 {
425 return "ExtractSpecifiedRegions";
426 }
427 else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
428 {
429 return "ExtractAllRegions";
430 }
432 {
433 return "ExtractClosestPointRegion";
434 }
436 {
437 return "ExtractLargeRegions";
438 }
439 else
440 {
441 return "ExtractLargestRegion";
442 }
443}
444
445#endif
Proxy object to connect input/output ports.
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:68
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
keep track of edges (edge is pair of integer id's)
Definition: vtkEdgeTable.h:41
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.
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.
vtkSmartPointer< vtkIdTypeArray > RegionSizes
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
Definition: vtkPolyData.h:195
int vtkTypeBool
Definition: vtkABI.h:69
#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
#define VTK_EXTRACT_LARGEST_REGION
int vtkIdType
Definition: vtkType.h:332