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
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
66class vtkDataArray;
67class vtkIdList;
68class vtkIdTypeArray;
69
70class VTKFILTERSCORE_EXPORT vtkPolyDataConnectivityFilter : public vtkPolyDataAlgorithm
71{
72public:
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
150
154 void AddSeed(int id);
155
159 void DeleteSeed(int id);
160
165
169 void AddSpecifiedRegion(int id);
170
175
177
181 vtkSetVector3Macro(ClosestPoint,double);
182 vtkGetVectorMacro(ClosestPoint,double,3);
184
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
227protected:
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;
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
272private:
274 void operator=(const vtkPolyDataConnectivityFilter&) VTK_DELETE_FUNCTION;
275};
276
278
281inline 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
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
list of point or cell ids
Definition: vtkIdList.h:37
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:40
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.
void InitializeSeedList()
Initialize list of point ids/cell ids used to seed regions.
~vtkPolyDataConnectivityFilter() override
static vtkPolyDataConnectivityFilter * New()
Construct with default extraction mode to extract largest regions.
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 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:86
@ vector
Definition: vtkX3D.h:237
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
#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:287