VTK
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(ExtractionMode,int,
130  vtkGetMacro(ExtractionMode,int);
132  {this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);};
134  {this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);};
136  {this->SetExtractionMode(VTK_EXTRACT_LARGEST_REGION);};
138  {this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);};
140  {this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);};
142  {this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS);};
143  const char *GetExtractionModeAsString();
145 
149  void InitializeSeedList();
150 
154  void AddSeed(int id);
155 
159  void DeleteSeed(int id);
160 
164  void InitializeSpecifiedRegionList();
165 
169  void AddSpecifiedRegion(int id);
170 
174  void DeleteSpecifiedRegion(int id);
175 
177 
181  vtkSetVector3Macro(ClosestPoint,double);
182  vtkGetVectorMacro(ClosestPoint,double,3);
184 
188  int GetNumberOfExtractedRegions();
189 
191 
194  vtkSetMacro(ColorRegions,vtkTypeBool);
195  vtkGetMacro(ColorRegions,vtkTypeBool);
196  vtkBooleanMacro(ColorRegions,vtkTypeBool);
198 
200 
204  vtkSetMacro( MarkVisitedPointIds, vtkTypeBool );
205  vtkGetMacro( MarkVisitedPointIds, vtkTypeBool );
206  vtkBooleanMacro( MarkVisitedPointIds, vtkTypeBool );
208 
210 
214  vtkGetObjectMacro( VisitedPointIds, vtkIdList );
216 
218 
223  vtkSetMacro(OutputPointsPrecision,int);
224  vtkGetMacro(OutputPointsPrecision,int);
226 
227 protected:
229  ~vtkPolyDataConnectivityFilter() override;
230 
231  // Usual data generation method
233 
234  vtkTypeBool ColorRegions; //boolean turns on/off scalar gen for separate regions
235  int ExtractionMode; //how to extract regions
236  vtkIdList *Seeds; //id's of points or cells used to seed regions
237  vtkIdList *SpecifiedRegionIds; //regions specified for extraction
238  vtkIdTypeArray *RegionSizes; //size (in cells) of each region extracted
239 
240  double ClosestPoint[3];
241 
244 
245  // Does this cell qualify as being scalar connected ?
246  int IsScalarConnected( vtkIdType cellId );
247 
248  double ScalarRange[2];
249 
250  void TraverseAndMark();
251 
252  // used to support algorithm execution
263  std::vector<vtkIdType> Wave;
264  std::vector<vtkIdType> Wave2;
268 
271 
272 private:
274  void operator=(const vtkPolyDataConnectivityFilter&) = delete;
275 };
276 
278 
282 {
283  if ( this->ExtractionMode == VTK_EXTRACT_POINT_SEEDED_REGIONS )
284  {
285  return "ExtractPointSeededRegions";
286  }
287  else if ( this->ExtractionMode == VTK_EXTRACT_CELL_SEEDED_REGIONS )
288  {
289  return "ExtractCellSeededRegions";
290  }
291  else if ( this->ExtractionMode == VTK_EXTRACT_SPECIFIED_REGIONS )
292  {
293  return "ExtractSpecifiedRegions";
294  }
295  else if ( this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS )
296  {
297  return "ExtractAllRegions";
298  }
299  else if ( this->ExtractionMode == VTK_EXTRACT_CLOSEST_POINT_REGION )
300  {
301  return "ExtractClosestPointRegion";
302  }
303  else
304  {
305  return "ExtractLargestRegion";
306  }
307 }
309 
310 
311 #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:347
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
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:36
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
#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