VTK  9.2.6
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 =========================================================================*/
53 #ifndef vtkPolyDataConnectivityFilter_h
54 #define vtkPolyDataConnectivityFilter_h
55 
56 #include "vtkFiltersCoreModule.h" // For export macro
57 #include "vtkPolyDataAlgorithm.h"
58 
59 #define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
60 #define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
61 #define VTK_EXTRACT_SPECIFIED_REGIONS 3
62 #define VTK_EXTRACT_LARGEST_REGION 4
63 #define VTK_EXTRACT_ALL_REGIONS 5
64 #define VTK_EXTRACT_CLOSEST_POINT_REGION 6
65 
66 class vtkDataArray;
67 class vtkIdList;
68 class vtkIdTypeArray;
69 
70 class VTKFILTERSCORE_EXPORT vtkPolyDataConnectivityFilter : public vtkPolyDataAlgorithm
71 {
72 public:
74  void PrintSelf(ostream& os, vtkIndent indent) override;
75 
77 
81  vtkGetObjectMacro(RegionSizes, vtkIdTypeArray);
83 
88 
90 
95  vtkSetMacro(ScalarConnectivity, vtkTypeBool);
96  vtkGetMacro(ScalarConnectivity, vtkTypeBool);
97  vtkBooleanMacro(ScalarConnectivity, vtkTypeBool);
99 
101 
110  vtkSetMacro(FullScalarConnectivity, vtkTypeBool);
111  vtkGetMacro(FullScalarConnectivity, vtkTypeBool);
112  vtkBooleanMacro(FullScalarConnectivity, vtkTypeBool);
114 
116 
119  vtkSetVector2Macro(ScalarRange, double);
120  vtkGetVector2Macro(ScalarRange, double);
122 
124 
127  vtkSetClampMacro(
129  vtkGetMacro(ExtractionMode, int);
131  {
132  this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);
133  }
135  {
136  this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);
137  }
140  {
141  this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);
142  }
144  {
145  this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);
146  }
147  void SetExtractionModeToAllRegions() { this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS); }
148  const char* GetExtractionModeAsString();
150 
154  void InitializeSeedList();
155 
159  void AddSeed(int id);
160 
164  void DeleteSeed(int id);
165 
169  void InitializeSpecifiedRegionList();
170 
174  void AddSpecifiedRegion(int id);
175 
179  void DeleteSpecifiedRegion(int id);
180 
182 
186  vtkSetVector3Macro(ClosestPoint, double);
187  vtkGetVectorMacro(ClosestPoint, double, 3);
189 
193  int GetNumberOfExtractedRegions();
194 
196 
199  vtkSetMacro(ColorRegions, vtkTypeBool);
200  vtkGetMacro(ColorRegions, vtkTypeBool);
201  vtkBooleanMacro(ColorRegions, vtkTypeBool);
203 
205 
210  vtkSetMacro(MarkVisitedPointIds, vtkTypeBool);
211  vtkGetMacro(MarkVisitedPointIds, vtkTypeBool);
212  vtkBooleanMacro(MarkVisitedPointIds, vtkTypeBool);
214 
216 
220  vtkGetObjectMacro(VisitedPointIds, vtkIdList);
222 
224 
229  vtkSetMacro(OutputPointsPrecision, int);
230  vtkGetMacro(OutputPointsPrecision, int);
232 
233 protected:
235  ~vtkPolyDataConnectivityFilter() override;
236 
237  // Usual data generation method
239 
240  vtkTypeBool ColorRegions; // boolean turns on/off scalar gen for separate regions
241  int ExtractionMode; // how to extract regions
242  vtkIdList* Seeds; // id's of points or cells used to seed regions
243  vtkIdList* SpecifiedRegionIds; // regions specified for extraction
244  vtkIdTypeArray* RegionSizes; // size (in cells) of each region extracted
245 
246  double ClosestPoint[3];
247 
250 
251  // Does this cell qualify as being scalar connected ?
252  int IsScalarConnected(vtkIdType cellId);
253 
254  double ScalarRange[2];
255 
256  void TraverseAndMark();
257 
258  // used to support algorithm execution
269  std::vector<vtkIdType> Wave;
270  std::vector<vtkIdType> Wave2;
274 
277 
278 private:
280  void operator=(const vtkPolyDataConnectivityFilter&) = delete;
281 };
282 
287 {
289  {
290  return "ExtractPointSeededRegions";
291  }
293  {
294  return "ExtractCellSeededRegions";
295  }
297  {
298  return "ExtractSpecifiedRegions";
299  }
300  else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
301  {
302  return "ExtractAllRegions";
303  }
305  {
306  return "ExtractClosestPointRegion";
307  }
308  else
309  {
310  return "ExtractLargestRegion";
311  }
312 }
313 
314 #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:332
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
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:69
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:39
extract polygonal data based on geometric connectivity
list of point or cell ids
Definition: vtkIdList.h:33
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
#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