VTK  9.1.0
vtkPolyDataConnectivityFilter.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkPolyDataConnectivityFilter.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=========================================================================*/
50#ifndef vtkPolyDataConnectivityFilter_h
51#define vtkPolyDataConnectivityFilter_h
52
53#include "vtkFiltersCoreModule.h" // For export macro
55
56#define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
57#define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
58#define VTK_EXTRACT_SPECIFIED_REGIONS 3
59#define VTK_EXTRACT_LARGEST_REGION 4
60#define VTK_EXTRACT_ALL_REGIONS 5
61#define VTK_EXTRACT_CLOSEST_POINT_REGION 6
62
63class vtkDataArray;
64class vtkIdList;
65class vtkIdTypeArray;
66
67class VTKFILTERSCORE_EXPORT vtkPolyDataConnectivityFilter : public vtkPolyDataAlgorithm
68{
69public:
71 void PrintSelf(ostream& os, vtkIndent indent) override;
72
74
78 vtkGetObjectMacro(RegionSizes, vtkIdTypeArray);
80
85
87
92 vtkSetMacro(ScalarConnectivity, vtkTypeBool);
93 vtkGetMacro(ScalarConnectivity, vtkTypeBool);
94 vtkBooleanMacro(ScalarConnectivity, vtkTypeBool);
96
98
107 vtkSetMacro(FullScalarConnectivity, vtkTypeBool);
108 vtkGetMacro(FullScalarConnectivity, vtkTypeBool);
109 vtkBooleanMacro(FullScalarConnectivity, vtkTypeBool);
111
113
116 vtkSetVector2Macro(ScalarRange, double);
117 vtkGetVector2Macro(ScalarRange, double);
119
121
124 vtkSetClampMacro(
126 vtkGetMacro(ExtractionMode, int);
128 {
129 this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);
130 }
132 {
133 this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);
134 }
137 {
138 this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);
139 }
141 {
142 this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);
143 }
144 void SetExtractionModeToAllRegions() { this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS); }
145 const char* GetExtractionModeAsString();
147
152
156 void AddSeed(int id);
157
161 void DeleteSeed(int id);
162
167
171 void AddSpecifiedRegion(int id);
172
177
179
183 vtkSetVector3Macro(ClosestPoint, double);
184 vtkGetVectorMacro(ClosestPoint, double, 3);
186
191
193
196 vtkSetMacro(ColorRegions, vtkTypeBool);
197 vtkGetMacro(ColorRegions, vtkTypeBool);
198 vtkBooleanMacro(ColorRegions, vtkTypeBool);
200
202
207 vtkSetMacro(MarkVisitedPointIds, vtkTypeBool);
208 vtkGetMacro(MarkVisitedPointIds, vtkTypeBool);
209 vtkBooleanMacro(MarkVisitedPointIds, vtkTypeBool);
211
213
217 vtkGetObjectMacro(VisitedPointIds, vtkIdList);
219
221
226 vtkSetMacro(OutputPointsPrecision, int);
227 vtkGetMacro(OutputPointsPrecision, int);
229
230protected:
233
234 // Usual data generation method
236
237 vtkTypeBool ColorRegions; // boolean turns on/off scalar gen for separate regions
238 int ExtractionMode; // how to extract regions
239 vtkIdList* Seeds; // id's of points or cells used to seed regions
240 vtkIdList* SpecifiedRegionIds; // regions specified for extraction
241 vtkIdTypeArray* RegionSizes; // size (in cells) of each region extracted
242
243 double ClosestPoint[3];
244
247
248 // Does this cell qualify as being scalar connected ?
250
251 double ScalarRange[2];
252
254
255 // used to support algorithm execution
266 std::vector<vtkIdType> Wave;
267 std::vector<vtkIdType> Wave2;
271
274
275private:
277 void operator=(const vtkPolyDataConnectivityFilter&) = delete;
278};
279
284{
286 {
287 return "ExtractPointSeededRegions";
288 }
290 {
291 return "ExtractCellSeededRegions";
292 }
294 {
295 return "ExtractSpecifiedRegions";
296 }
297 else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
298 {
299 return "ExtractAllRegions";
300 }
302 {
303 return "ExtractClosestPointRegion";
304 }
305 else
306 {
307 return "ExtractLargestRegion";
308 }
309}
310
311#endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
list of point or cell ids
Definition: vtkIdList.h:31
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce only polydata as output.
extract polygonal data based on geometric connectivity
void SetExtractionModeToAllRegions()
Control the extraction of connected surfaces.
void InitializeSpecifiedRegionList()
Initialize list of region ids to extract.
const char * GetExtractionModeAsString()
Return the method of extraction as a string.
void InitializeSeedList()
Initialize list of point ids/cell ids used to seed regions.
~vtkPolyDataConnectivityFilter() override
static vtkPolyDataConnectivityFilter * New()
Construct with default extraction mode to extract largest regions.
void SetExtractionModeToLargestRegion()
Control the extraction of connected surfaces.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void DeleteSpecifiedRegion(int id)
Delete a region id to extract.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetExtractionModeToClosestPointRegion()
Control the extraction of connected surfaces.
int IsScalarConnected(vtkIdType cellId)
int GetNumberOfExtractedRegions()
Obtain the number of connected regions.
void DeleteSeed(int id)
Delete a seed id (point or cell id).
void AddSpecifiedRegion(int id)
Add a region id to extract.
void SetExtractionModeToPointSeededRegions()
Control the extraction of connected surfaces.
void SetExtractionModeToSpecifiedRegions()
Control the extraction of connected surfaces.
void SetExtractionModeToCellSeededRegions()
Control the extraction of connected surfaces.
void AddSeed(int id)
Add a seed id (point or cell id).
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
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_SPECIFIED_REGIONS
#define VTK_EXTRACT_LARGEST_REGION
int vtkIdType
Definition: vtkType.h:332