VTK  9.3.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 
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 
143  void InitializeSeedList();
144 
148  void AddSeed(int id);
149 
153  void DeleteSeed(int id);
154 
158  void InitializeSpecifiedRegionList();
159 
163  void AddSpecifiedRegion(int id);
164 
168  void DeleteSpecifiedRegion(int id);
169 
171 
175  vtkSetVector3Macro(ClosestPoint, double);
176  vtkGetVectorMacro(ClosestPoint, double, 3);
178 
182  int GetNumberOfExtractedRegions();
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:
224  ~vtkPolyDataConnectivityFilter() override;
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 ?
241  int IsScalarConnected(vtkIdType cellId);
242 
243  double ScalarRange[2];
244 
245  void TraverseAndMark();
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
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:315
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
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:22
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
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