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) VTK_OVERRIDE;
75 
77 
81  vtkGetObjectMacro(RegionSizes,vtkIdTypeArray);
83 
88 
90 
95  vtkSetMacro(ScalarConnectivity,int);
96  vtkGetMacro(ScalarConnectivity,int);
97  vtkBooleanMacro(ScalarConnectivity,int);
99 
101 
110  vtkSetMacro(FullScalarConnectivity,int);
111  vtkGetMacro(FullScalarConnectivity,int);
112  vtkBooleanMacro(FullScalarConnectivity,int);
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,int);
195  vtkGetMacro(ColorRegions,int);
196  vtkBooleanMacro(ColorRegions,int);
198 
200 
204  vtkSetMacro( MarkVisitedPointIds, int );
205  vtkGetMacro( MarkVisitedPointIds, int );
206  vtkBooleanMacro( MarkVisitedPointIds, int );
208 
210 
214  vtkGetObjectMacro( VisitedPointIds, vtkIdList );
216 
218 
223  vtkSetMacro(OutputPointsPrecision,int);
224  vtkGetMacro(OutputPointsPrecision,int);
226 
227 protected:
229  ~vtkPolyDataConnectivityFilter() VTK_OVERRIDE;
230 
231  // Usual data generation method
232  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
233 
234  int 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 
242  int ScalarConnectivity;
243  int FullScalarConnectivity;
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
253  vtkDataArray *CellScalars;
254  vtkIdList *NeighborCellPointIds;
255  vtkIdType *Visited;
256  vtkIdType *PointMap;
257  vtkDataArray *NewScalars;
258  vtkIdType RegionNumber;
259  vtkIdType PointNumber;
260  vtkIdType NumCellsInRegion;
261  vtkDataArray *InScalars;
262  vtkPolyData *Mesh;
263  std::vector<vtkIdType> Wave;
264  std::vector<vtkIdType> Wave2;
265  vtkIdList *PointIds;
266  vtkIdList *CellIds;
267  vtkIdList *VisitedPointIds;
268 
269  int MarkVisitedPointIds;
270  int OutputPointsPrecision;
271 
272 private:
274  void operator=(const vtkPolyDataConnectivityFilter&) VTK_DELETE_FUNCTION;
275 };
276 
278 
281 inline const char *vtkPolyDataConnectivityFilter::GetExtractionModeAsString(void)
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.
#define VTK_EXTRACT_CLOSEST_POINT_REGION
#define VTK_EXTRACT_POINT_SEEDED_REGIONS
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:287
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
void SetExtractionModeToPointSeededRegions()
Control the extraction of connected surfaces.
static vtkPolyDataAlgorithm * New()
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
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
#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
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
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