VTK  9.7.1
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 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
47 
48 #define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
49 #define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
50 #define VTK_EXTRACT_SPECIFIED_REGIONS 3
51 #define VTK_EXTRACT_LARGEST_REGION 4
52 #define VTK_EXTRACT_ALL_REGIONS 5
53 #define VTK_EXTRACT_CLOSEST_POINT_REGION 6
54 
55 VTK_ABI_NAMESPACE_BEGIN
56 class vtkDataArray;
57 class vtkIdList;
58 class vtkIdTypeArray;
59 
61  : public vtkPolyDataAlgorithm
62 {
63 public:
65  void PrintSelf(ostream& os, vtkIndent indent) override;
66 
68 
72  vtkGetObjectMacro(RegionSizes, vtkIdTypeArray);
74 
79 
81 
86  vtkSetMacro(ScalarConnectivity, vtkTypeBool);
87  vtkGetMacro(ScalarConnectivity, vtkTypeBool);
88  vtkBooleanMacro(ScalarConnectivity, vtkTypeBool);
90 
92 
101  vtkSetMacro(FullScalarConnectivity, vtkTypeBool);
102  vtkGetMacro(FullScalarConnectivity, vtkTypeBool);
103  vtkBooleanMacro(FullScalarConnectivity, vtkTypeBool);
105 
107 
110  vtkSetVector2Macro(ScalarRange, double);
111  vtkGetVector2Macro(ScalarRange, double);
113 
115 
118  vtkSetClampMacro(
120  vtkGetMacro(ExtractionMode, int);
122  {
123  this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);
124  }
126  {
127  this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);
128  }
131  {
132  this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);
133  }
135  {
136  this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);
137  }
138  void SetExtractionModeToAllRegions() { this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS); }
139  const char* GetExtractionModeAsString();
141 
145  void InitializeSeedList();
146 
150  void AddSeed(int id);
151 
155  void DeleteSeed(int id);
156 
160  void InitializeSpecifiedRegionList();
161 
165  void AddSpecifiedRegion(int id);
166 
170  void DeleteSpecifiedRegion(int id);
171 
173 
177  vtkSetVector3Macro(ClosestPoint, double);
178  vtkGetVectorMacro(ClosestPoint, double, 3);
180 
184  int GetNumberOfExtractedRegions();
185 
187 
190  vtkSetMacro(ColorRegions, vtkTypeBool);
191  vtkGetMacro(ColorRegions, vtkTypeBool);
192  vtkBooleanMacro(ColorRegions, vtkTypeBool);
194 
196 
201  vtkSetMacro(MarkVisitedPointIds, vtkTypeBool);
202  vtkGetMacro(MarkVisitedPointIds, vtkTypeBool);
203  vtkBooleanMacro(MarkVisitedPointIds, vtkTypeBool);
205 
207 
211  vtkGetObjectMacro(VisitedPointIds, vtkIdList);
213 
215 
220  vtkSetMacro(OutputPointsPrecision, int);
221  vtkGetMacro(OutputPointsPrecision, int);
223 
224 protected:
226  ~vtkPolyDataConnectivityFilter() override;
227 
228  // Usual data generation method
230 
231  vtkTypeBool ColorRegions; // boolean turns on/off scalar gen for separate regions
232  int ExtractionMode; // how to extract regions
233  vtkIdList* Seeds; // id's of points or cells used to seed regions
234  vtkIdList* SpecifiedRegionIds; // regions specified for extraction
235  vtkIdTypeArray* RegionSizes; // size (in cells) of each region extracted
236 
237  double ClosestPoint[3];
238 
241 
242  // Does this cell qualify as being scalar connected ?
243  int IsScalarConnected(vtkIdType cellId);
244 
245  double ScalarRange[2];
246 
247  void TraverseAndMark();
248 
249  // used to support algorithm execution
260  std::vector<vtkIdType> Wave;
261  std::vector<vtkIdType> Wave2;
265 
268 
269 private:
271  void operator=(const vtkPolyDataConnectivityFilter&) = delete;
272 };
273 
278 {
280  {
281  return "ExtractPointSeededRegions";
282  }
284  {
285  return "ExtractCellSeededRegions";
286  }
288  {
289  return "ExtractSpecifiedRegions";
290  }
291  else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
292  {
293  return "ExtractAllRegions";
294  }
296  {
297  return "ExtractClosestPointRegion";
298  }
299  else
300  {
301  return "ExtractLargestRegion";
302  }
303 }
304 
305 VTK_ABI_NAMESPACE_END
306 #endif
void SetExtractionModeToSpecifiedRegions()
Control the extraction of connected surfaces.
Store vtkAlgorithm input/output information.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
#define VTK_EXTRACT_CLOSEST_POINT_REGION
#define VTK_EXTRACT_POINT_SEEDED_REGIONS
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:363
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
void SetExtractionModeToPointSeededRegions()
Control the extraction of connected surfaces.
const char * GetExtractionModeAsString()
Return the method of extraction as a string.
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:64
Superclass for algorithms that produce only polydata as output.
void SetExtractionModeToClosestPointRegion()
Control the extraction of connected surfaces.
a simple class to control print indentation
Definition: vtkIndent.h:28
extract polygonal data based on geometric connectivity
list of point or cell ids
Definition: vtkIdList.h:25
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
#define VTK_EXTRACT_LARGEST_REGION
void SetExtractionModeToLargestRegion()
Control the extraction of connected surfaces.
#define VTK_EXTRACT_CELL_SEEDED_REGIONS
void SetExtractionModeToAllRegions()
Control the extraction of connected surfaces.
Store zero or more vtkInformation instances.
#define VTK_EXTRACT_ALL_REGIONS
#define VTK_MARSHALAUTO
void SetExtractionModeToCellSeededRegions()
Control the extraction of connected surfaces.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
#define VTK_EXTRACT_SPECIFIED_REGIONS