VTK  9.2.6
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=========================================================================*/
62#ifndef vtkPolyDataConnectivityFilter_h
63#define vtkPolyDataConnectivityFilter_h
64
65#include "vtkFiltersCoreModule.h" // For export macro
67
68#define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
69#define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
70#define VTK_EXTRACT_SPECIFIED_REGIONS 3
71#define VTK_EXTRACT_LARGEST_REGION 4
72#define VTK_EXTRACT_ALL_REGIONS 5
73#define VTK_EXTRACT_CLOSEST_POINT_REGION 6
74
75class vtkDataArray;
76class vtkIdList;
77class vtkIdTypeArray;
78
79class VTKFILTERSCORE_EXPORT vtkPolyDataConnectivityFilter : public vtkPolyDataAlgorithm
80{
81public:
83 void PrintSelf(ostream& os, vtkIndent indent) override;
84
86
90 vtkGetObjectMacro(RegionSizes, vtkIdTypeArray);
92
97
99
104 vtkSetMacro(ScalarConnectivity, vtkTypeBool);
105 vtkGetMacro(ScalarConnectivity, vtkTypeBool);
106 vtkBooleanMacro(ScalarConnectivity, vtkTypeBool);
108
110
119 vtkSetMacro(FullScalarConnectivity, vtkTypeBool);
120 vtkGetMacro(FullScalarConnectivity, vtkTypeBool);
121 vtkBooleanMacro(FullScalarConnectivity, vtkTypeBool);
123
125
128 vtkSetVector2Macro(ScalarRange, double);
129 vtkGetVector2Macro(ScalarRange, double);
131
133
136 vtkSetClampMacro(
138 vtkGetMacro(ExtractionMode, int);
140 {
141 this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);
142 }
144 {
145 this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);
146 }
149 {
150 this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);
151 }
153 {
154 this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);
155 }
156 void SetExtractionModeToAllRegions() { this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS); }
157 const char* GetExtractionModeAsString();
159
164
168 void AddSeed(int id);
169
173 void DeleteSeed(int id);
174
179
183 void AddSpecifiedRegion(int id);
184
189
191
195 vtkSetVector3Macro(ClosestPoint, double);
196 vtkGetVectorMacro(ClosestPoint, double, 3);
198
203
205
208 vtkSetMacro(ColorRegions, vtkTypeBool);
209 vtkGetMacro(ColorRegions, vtkTypeBool);
210 vtkBooleanMacro(ColorRegions, vtkTypeBool);
212
214
219 vtkSetMacro(MarkVisitedPointIds, vtkTypeBool);
220 vtkGetMacro(MarkVisitedPointIds, vtkTypeBool);
221 vtkBooleanMacro(MarkVisitedPointIds, vtkTypeBool);
223
225
229 vtkGetObjectMacro(VisitedPointIds, vtkIdList);
231
233
238 vtkSetMacro(OutputPointsPrecision, int);
239 vtkGetMacro(OutputPointsPrecision, int);
241
242protected:
245
246 // Usual data generation method
248
249 vtkTypeBool ColorRegions; // boolean turns on/off scalar gen for separate regions
250 int ExtractionMode; // how to extract regions
251 vtkIdList* Seeds; // id's of points or cells used to seed regions
252 vtkIdList* SpecifiedRegionIds; // regions specified for extraction
253 vtkIdTypeArray* RegionSizes; // size (in cells) of each region extracted
254
255 double ClosestPoint[3];
256
259
260 // Does this cell qualify as being scalar connected ?
262
263 double ScalarRange[2];
264
266
267 // used to support algorithm execution
278 std::vector<vtkIdType> Wave;
279 std::vector<vtkIdType> Wave2;
283
286
287private:
289 void operator=(const vtkPolyDataConnectivityFilter&) = delete;
290};
291
296{
298 {
299 return "ExtractPointSeededRegions";
300 }
302 {
303 return "ExtractCellSeededRegions";
304 }
306 {
307 return "ExtractSpecifiedRegions";
308 }
309 else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
310 {
311 return "ExtractAllRegions";
312 }
314 {
315 return "ExtractClosestPointRegion";
316 }
317 else
318 {
319 return "ExtractLargestRegion";
320 }
321}
322
323#endif
abstract superclass for arrays of numeric data
list of point or cell ids
Definition vtkIdList.h:43
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:49
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
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
#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
int vtkIdType
Definition vtkType.h:332