VTK  9.0.3
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 =========================================================================*/
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 class vtkDataArray;
64 class vtkIdList;
65 class vtkIdTypeArray;
66 
67 class VTKFILTERSCORE_EXPORT vtkPolyDataConnectivityFilter : public vtkPolyDataAlgorithm
68 {
69 public:
71  void PrintSelf(ostream& os, vtkIndent indent) override;
72 
74 
78  vtkGetObjectMacro(RegionSizes, vtkIdTypeArray);
80 
85 
87 
92  vtkSetMacro(ScalarConnectivity, vtkTypeBool);
93  vtkGetMacro(ScalarConnectivity, vtkTypeBool);
94  vtkBooleanMacro(ScalarConnectivity, vtkTypeBool);
96 
98 
107  vtkSetMacro(FullScalarConnectivity, vtkTypeBool);
108  vtkGetMacro(FullScalarConnectivity, vtkTypeBool);
109  vtkBooleanMacro(FullScalarConnectivity, vtkTypeBool);
111 
113 
116  vtkSetVector2Macro(ScalarRange, double);
117  vtkGetVector2Macro(ScalarRange, double);
119 
121 
124  vtkSetClampMacro(
126  vtkGetMacro(ExtractionMode, int);
128  {
129  this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);
130  }
132  {
133  this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);
134  }
137  {
138  this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);
139  }
141  {
142  this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);
143  }
144  void SetExtractionModeToAllRegions() { this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS); }
145  const char* GetExtractionModeAsString();
147 
152 
156  void AddSeed(int id);
157 
161  void DeleteSeed(int id);
162 
167 
171  void AddSpecifiedRegion(int id);
172 
176  void DeleteSpecifiedRegion(int id);
177 
179 
183  vtkSetVector3Macro(ClosestPoint, double);
184  vtkGetVectorMacro(ClosestPoint, double, 3);
186 
191 
193 
196  vtkSetMacro(ColorRegions, vtkTypeBool);
197  vtkGetMacro(ColorRegions, vtkTypeBool);
198  vtkBooleanMacro(ColorRegions, vtkTypeBool);
200 
202 
207  vtkSetMacro(MarkVisitedPointIds, vtkTypeBool);
208  vtkGetMacro(MarkVisitedPointIds, vtkTypeBool);
209  vtkBooleanMacro(MarkVisitedPointIds, vtkTypeBool);
211 
213 
217  vtkGetObjectMacro(VisitedPointIds, vtkIdList);
219 
221 
226  vtkSetMacro(OutputPointsPrecision, int);
227  vtkGetMacro(OutputPointsPrecision, int);
229 
230 protected:
233 
234  // Usual data generation method
236 
237  vtkTypeBool ColorRegions; // boolean turns on/off scalar gen for separate regions
238  int ExtractionMode; // how to extract regions
239  vtkIdList* Seeds; // id's of points or cells used to seed regions
240  vtkIdList* SpecifiedRegionIds; // regions specified for extraction
241  vtkIdTypeArray* RegionSizes; // size (in cells) of each region extracted
242 
243  double ClosestPoint[3];
244 
247 
248  // Does this cell qualify as being scalar connected ?
250 
251  double ScalarRange[2];
252 
254 
255  // used to support algorithm execution
266  std::vector<vtkIdType> Wave;
267  std::vector<vtkIdType> Wave2;
271 
274 
275 private:
277  void operator=(const vtkPolyDataConnectivityFilter&) = delete;
278 };
279 
281 
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 }
312 
313 #endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
list of point or cell ids
Definition: vtkIdList.h:31
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:34
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 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
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.
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 AddSeed(int id)
Add a seed id (point or cell id).
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
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
int vtkIdType
Definition: vtkType.h:338