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 =========================================================================*/
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) VTK_OVERRIDE;
72 
74 
78  vtkGetObjectMacro(RegionSizes,vtkIdTypeArray);
80 
85 
87 
92  vtkSetMacro(ScalarConnectivity,int);
93  vtkGetMacro(ScalarConnectivity,int);
94  vtkBooleanMacro(ScalarConnectivity,int);
96 
98 
107  vtkSetMacro(FullScalarConnectivity,int);
108  vtkGetMacro(FullScalarConnectivity,int);
109  vtkBooleanMacro(FullScalarConnectivity,int);
111 
113 
116  vtkSetVector2Macro(ScalarRange,double);
117  vtkGetVector2Macro(ScalarRange,double);
119 
121 
124  vtkSetClampMacro(ExtractionMode,int,
127  vtkGetMacro(ExtractionMode,int);
129  {this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);};
131  {this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);};
133  {this->SetExtractionMode(VTK_EXTRACT_LARGEST_REGION);};
135  {this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);};
137  {this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);};
139  {this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS);};
140  const char *GetExtractionModeAsString();
142 
146  void InitializeSeedList();
147 
151  void AddSeed(int id);
152 
156  void DeleteSeed(int id);
157 
161  void InitializeSpecifiedRegionList();
162 
166  void AddSpecifiedRegion(int id);
167 
171  void DeleteSpecifiedRegion(int id);
172 
174 
178  vtkSetVector3Macro(ClosestPoint,double);
179  vtkGetVectorMacro(ClosestPoint,double,3);
181 
185  int GetNumberOfExtractedRegions();
186 
188 
191  vtkSetMacro(ColorRegions,int);
192  vtkGetMacro(ColorRegions,int);
193  vtkBooleanMacro(ColorRegions,int);
195 
197 
201  vtkSetMacro( MarkVisitedPointIds, int );
202  vtkGetMacro( MarkVisitedPointIds, int );
203  vtkBooleanMacro( MarkVisitedPointIds, int );
205 
207 
211  vtkGetObjectMacro( VisitedPointIds, vtkIdList );
213 
215 
220  vtkSetMacro(OutputPointsPrecision,int);
221  vtkGetMacro(OutputPointsPrecision,int);
223 
224 protected:
226  ~vtkPolyDataConnectivityFilter() VTK_OVERRIDE;
227 
228  // Usual data generation method
230 
231  int ColorRegions; //boolean turns on/off scalar gen for separate regions
232  int ExtractionMode; //how to extract regions
233  vtkIdList *Seeds; //id's of points or cells used to seed regions
234  vtkIdList *SpecifiedRegionIds; //regions specified for extraction
235  vtkIdTypeArray *RegionSizes; //size (in cells) of each region extracted
236 
237  double ClosestPoint[3];
238 
241 
242  // Does this cell qualify as being scalar connected ?
243  int IsScalarConnected( vtkIdType cellId );
244 
245  double ScalarRange[2];
246 
247  void TraverseAndMark();
248 
249  // used to support algorithm execution
260  std::vector<vtkIdType> Wave;
261  std::vector<vtkIdType> Wave2;
265 
268 
269 private:
271  void operator=(const vtkPolyDataConnectivityFilter&) VTK_DELETE_FUNCTION;
272 };
273 
275 
279 {
280  if ( this->ExtractionMode == VTK_EXTRACT_POINT_SEEDED_REGIONS )
281  {
282  return "ExtractPointSeededRegions";
283  }
284  else if ( this->ExtractionMode == VTK_EXTRACT_CELL_SEEDED_REGIONS )
285  {
286  return "ExtractCellSeededRegions";
287  }
288  else if ( this->ExtractionMode == VTK_EXTRACT_SPECIFIED_REGIONS )
289  {
290  return "ExtractSpecifiedRegions";
291  }
292  else if ( this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS )
293  {
294  return "ExtractAllRegions";
295  }
296  else if ( this->ExtractionMode == VTK_EXTRACT_CLOSEST_POINT_REGION )
297  {
298  return "ExtractClosestPointRegion";
299  }
300  else
301  {
302  return "ExtractLargestRegion";
303  }
304 }
306 
307 
308 #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:345
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()
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:33
extract polygonal data based on geometric connectivity
list of point or cell ids
Definition: vtkIdList.h:30
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
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