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
41 #ifndef vtkPolyDataConnectivityFilter_h
42 #define vtkPolyDataConnectivityFilter_h
43 
44 #include "vtkFiltersCoreModule.h" // For export macro
45 #include "vtkPolyDataAlgorithm.h"
46 
47 #define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
48 #define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
49 #define VTK_EXTRACT_SPECIFIED_REGIONS 3
50 #define VTK_EXTRACT_LARGEST_REGION 4
51 #define VTK_EXTRACT_ALL_REGIONS 5
52 #define VTK_EXTRACT_CLOSEST_POINT_REGION 6
53 
54 VTK_ABI_NAMESPACE_BEGIN
55 class vtkDataArray;
56 class vtkIdList;
57 class vtkIdTypeArray;
58 
59 class VTKFILTERSCORE_EXPORT vtkPolyDataConnectivityFilter : public vtkPolyDataAlgorithm
60 {
61 public:
63  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
66 
70  vtkGetObjectMacro(RegionSizes, vtkIdTypeArray);
72 
77 
79 
84  vtkSetMacro(ScalarConnectivity, vtkTypeBool);
85  vtkGetMacro(ScalarConnectivity, vtkTypeBool);
86  vtkBooleanMacro(ScalarConnectivity, vtkTypeBool);
88 
90 
99  vtkSetMacro(FullScalarConnectivity, vtkTypeBool);
100  vtkGetMacro(FullScalarConnectivity, vtkTypeBool);
101  vtkBooleanMacro(FullScalarConnectivity, vtkTypeBool);
103 
105 
108  vtkSetVector2Macro(ScalarRange, double);
109  vtkGetVector2Macro(ScalarRange, double);
111 
113 
116  vtkSetClampMacro(
118  vtkGetMacro(ExtractionMode, int);
120  {
121  this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);
122  }
124  {
125  this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);
126  }
129  {
130  this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);
131  }
133  {
134  this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);
135  }
136  void SetExtractionModeToAllRegions() { this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS); }
137  const char* GetExtractionModeAsString();
139 
144 
148  void AddSeed(int id);
149 
153  void DeleteSeed(int id);
154 
159 
163  void AddSpecifiedRegion(int id);
164 
168  void DeleteSpecifiedRegion(int id);
169 
171 
175  vtkSetVector3Macro(ClosestPoint, double);
176  vtkGetVectorMacro(ClosestPoint, double, 3);
178 
183 
185 
188  vtkSetMacro(ColorRegions, vtkTypeBool);
189  vtkGetMacro(ColorRegions, vtkTypeBool);
190  vtkBooleanMacro(ColorRegions, vtkTypeBool);
192 
194 
199  vtkSetMacro(MarkVisitedPointIds, vtkTypeBool);
200  vtkGetMacro(MarkVisitedPointIds, vtkTypeBool);
201  vtkBooleanMacro(MarkVisitedPointIds, vtkTypeBool);
203 
205 
209  vtkGetObjectMacro(VisitedPointIds, vtkIdList);
211 
213 
218  vtkSetMacro(OutputPointsPrecision, int);
219  vtkGetMacro(OutputPointsPrecision, int);
221 
222 protected:
225 
226  // Usual data generation method
228 
229  vtkTypeBool ColorRegions; // boolean turns on/off scalar gen for separate regions
230  int ExtractionMode; // how to extract regions
231  vtkIdList* Seeds; // id's of points or cells used to seed regions
232  vtkIdList* SpecifiedRegionIds; // regions specified for extraction
233  vtkIdTypeArray* RegionSizes; // size (in cells) of each region extracted
234 
235  double ClosestPoint[3];
236 
239 
240  // Does this cell qualify as being scalar connected ?
242 
243  double ScalarRange[2];
244 
246 
247  // used to support algorithm execution
258  std::vector<vtkIdType> Wave;
259  std::vector<vtkIdType> Wave2;
263 
266 
267 private:
269  void operator=(const vtkPolyDataConnectivityFilter&) = delete;
270 };
271 
276 {
278  {
279  return "ExtractPointSeededRegions";
280  }
282  {
283  return "ExtractCellSeededRegions";
284  }
286  {
287  return "ExtractSpecifiedRegions";
288  }
289  else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
290  {
291  return "ExtractAllRegions";
292  }
294  {
295  return "ExtractClosestPointRegion";
296  }
297  else
298  {
299  return "ExtractLargestRegion";
300  }
301 }
302 
303 VTK_ABI_NAMESPACE_END
304 #endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:45
list of point or cell ids
Definition: vtkIdList.h:23
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:29
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:80
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