VTK  9.3.0
vtkPolyDataConnectivityFilter.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
50 #ifndef vtkPolyDataConnectivityFilter_h
51 #define vtkPolyDataConnectivityFilter_h
52 
53 #include "vtkFiltersCoreModule.h" // For export macro
54 #include "vtkPolyDataAlgorithm.h"
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 
63 VTK_ABI_NAMESPACE_BEGIN
64 class vtkDataArray;
65 class vtkIdList;
66 class vtkIdTypeArray;
67 
68 class VTKFILTERSCORE_EXPORT vtkPolyDataConnectivityFilter : public vtkPolyDataAlgorithm
69 {
70 public:
72  void PrintSelf(ostream& os, vtkIndent indent) override;
73 
75 
79  vtkGetObjectMacro(RegionSizes, vtkIdTypeArray);
81 
86 
88 
93  vtkSetMacro(ScalarConnectivity, vtkTypeBool);
94  vtkGetMacro(ScalarConnectivity, vtkTypeBool);
95  vtkBooleanMacro(ScalarConnectivity, vtkTypeBool);
97 
99 
108  vtkSetMacro(FullScalarConnectivity, vtkTypeBool);
109  vtkGetMacro(FullScalarConnectivity, vtkTypeBool);
110  vtkBooleanMacro(FullScalarConnectivity, vtkTypeBool);
112 
114 
117  vtkSetVector2Macro(ScalarRange, double);
118  vtkGetVector2Macro(ScalarRange, double);
120 
122 
125  vtkSetClampMacro(
127  vtkGetMacro(ExtractionMode, int);
129  {
130  this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);
131  }
133  {
134  this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);
135  }
138  {
139  this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);
140  }
142  {
143  this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);
144  }
145  void SetExtractionModeToAllRegions() { this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS); }
146  const char* GetExtractionModeAsString();
148 
153 
157  void AddSeed(int id);
158 
162  void DeleteSeed(int id);
163 
168 
172  void AddSpecifiedRegion(int id);
173 
177  void DeleteSpecifiedRegion(int id);
178 
180 
184  vtkSetVector3Macro(ClosestPoint, double);
185  vtkGetVectorMacro(ClosestPoint, double, 3);
187 
192 
194 
197  vtkSetMacro(ColorRegions, vtkTypeBool);
198  vtkGetMacro(ColorRegions, vtkTypeBool);
199  vtkBooleanMacro(ColorRegions, vtkTypeBool);
201 
203 
208  vtkSetMacro(MarkVisitedPointIds, vtkTypeBool);
209  vtkGetMacro(MarkVisitedPointIds, vtkTypeBool);
210  vtkBooleanMacro(MarkVisitedPointIds, vtkTypeBool);
212 
214 
218  vtkGetObjectMacro(VisitedPointIds, vtkIdList);
220 
222 
227  vtkSetMacro(OutputPointsPrecision, int);
228  vtkGetMacro(OutputPointsPrecision, int);
230 
231 protected:
234 
235  // Usual data generation method
237 
238  vtkTypeBool ColorRegions; // boolean turns on/off scalar gen for separate regions
239  int ExtractionMode; // how to extract regions
240  vtkIdList* Seeds; // id's of points or cells used to seed regions
241  vtkIdList* SpecifiedRegionIds; // regions specified for extraction
242  vtkIdTypeArray* RegionSizes; // size (in cells) of each region extracted
243 
244  double ClosestPoint[3];
245 
248 
249  // Does this cell qualify as being scalar connected ?
251 
252  double ScalarRange[2];
253 
255 
256  // used to support algorithm execution
267  std::vector<vtkIdType> Wave;
268  std::vector<vtkIdType> Wave2;
272 
275 
276 private:
278  void operator=(const vtkPolyDataConnectivityFilter&) = delete;
279 };
280 
285 {
287  {
288  return "ExtractPointSeededRegions";
289  }
291  {
292  return "ExtractCellSeededRegions";
293  }
295  {
296  return "ExtractSpecifiedRegions";
297  }
298  else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
299  {
300  return "ExtractAllRegions";
301  }
303  {
304  return "ExtractClosestPointRegion";
305  }
306  else
307  {
308  return "ExtractLargestRegion";
309  }
310 }
311 
312 VTK_ABI_NAMESPACE_END
313 #endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
list of point or cell ids
Definition: vtkIdList.h:32
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:38
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.
static vtkPolyDataConnectivityFilter * New()
Construct with default extraction mode to extract largest regions.
void InitializeSeedList()
Initialize list of point ids/cell ids used to seed regions.
~vtkPolyDataConnectivityFilter() override
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:89
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
int vtkIdType
Definition: vtkType.h:315