VTK
vtkConnectivityFilter.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkConnectivityFilter.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=========================================================================*/
56#ifndef vtkConnectivityFilter_h
57#define vtkConnectivityFilter_h
58
59#include "vtkFiltersCoreModule.h" // For export macro
61
62#define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
63#define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
64#define VTK_EXTRACT_SPECIFIED_REGIONS 3
65#define VTK_EXTRACT_LARGEST_REGION 4
66#define VTK_EXTRACT_ALL_REGIONS 5
67#define VTK_EXTRACT_CLOSEST_POINT_REGION 6
68
69class vtkDataArray;
70class vtkFloatArray;
71class vtkIdList;
72class vtkIdTypeArray;
73class vtkIntArray;
74
75class VTKFILTERSCORE_EXPORT vtkConnectivityFilter : public vtkUnstructuredGridAlgorithm
76{
77public:
79 void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
80
85
87
92 vtkSetMacro(ScalarConnectivity,int);
93 vtkGetMacro(ScalarConnectivity,int);
94 vtkBooleanMacro(ScalarConnectivity,int);
96
98
101 vtkSetVector2Macro(ScalarRange,double);
102 vtkGetVector2Macro(ScalarRange,double);
104
106
109 vtkSetClampMacro(ExtractionMode,int,
111 vtkGetMacro(ExtractionMode,int);
113 {this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);};
115 {this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);};
117 {this->SetExtractionMode(VTK_EXTRACT_LARGEST_REGION);};
119 {this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);};
121 {this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);};
123 {this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS);};
124 const char *GetExtractionModeAsString();
126
131
136
141
146
150 void AddSpecifiedRegion(int id);
151
156
158
162 vtkSetVector3Macro(ClosestPoint,double);
163 vtkGetVectorMacro(ClosestPoint,double,3);
165
170
172
175 vtkSetMacro(ColorRegions,int);
176 vtkGetMacro(ColorRegions,int);
177 vtkBooleanMacro(ColorRegions,int);
179
181
186 vtkSetMacro(OutputPointsPrecision,int);
187 vtkGetMacro(OutputPointsPrecision,int);
189
190protected:
193
194 // Usual data generation method
195 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
196 int FillInputPortInformation(int port, vtkInformation *info) VTK_OVERRIDE;
197
198 int ColorRegions; //boolean turns on/off scalar gen for separate regions
199 int ExtractionMode; //how to extract regions
200 int OutputPointsPrecision;
201 vtkIdList *Seeds; //id's of points or cells used to seed regions
202 vtkIdList *SpecifiedRegionIds; //regions specified for extraction
203 vtkIdTypeArray *RegionSizes; //size (in cells) of each region extracted
204
205 double ClosestPoint[3];
206
207 int ScalarConnectivity;
208 double ScalarRange[2];
209
210 void TraverseAndMark(vtkDataSet *input);
211
212private:
213 // used to support algorithm execution
214 vtkFloatArray *CellScalars;
215 vtkIdList *NeighborCellPointIds;
216 vtkIdType *Visited;
217 vtkIdType *PointMap;
218 vtkIdTypeArray *NewScalars;
219 vtkIdTypeArray *NewCellScalars;
220 vtkIdType RegionNumber;
221 vtkIdType PointNumber;
222 vtkIdType NumCellsInRegion;
223 vtkDataArray *InScalars;
224 vtkIdList *Wave;
225 vtkIdList *Wave2;
226 vtkIdList *PointIds;
227 vtkIdList *CellIds;
228private:
229 vtkConnectivityFilter(const vtkConnectivityFilter&) VTK_DELETE_FUNCTION;
230 void operator=(const vtkConnectivityFilter&) VTK_DELETE_FUNCTION;
231};
232
234
237inline const char *vtkConnectivityFilter::GetExtractionModeAsString(void)
238{
239 if ( this->ExtractionMode == VTK_EXTRACT_POINT_SEEDED_REGIONS )
240 {
241 return "ExtractPointSeededRegions";
242 }
243 else if ( this->ExtractionMode == VTK_EXTRACT_CELL_SEEDED_REGIONS )
244 {
245 return "ExtractCellSeededRegions";
246 }
247 else if ( this->ExtractionMode == VTK_EXTRACT_SPECIFIED_REGIONS )
248 {
249 return "ExtractSpecifiedRegions";
250 }
251 else if ( this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS )
252 {
253 return "ExtractAllRegions";
254 }
255 else if ( this->ExtractionMode == VTK_EXTRACT_CLOSEST_POINT_REGION )
256 {
257 return "ExtractClosestPointRegion";
258 }
259 else
260 {
261 return "ExtractLargestRegion";
262 }
263}
265
266#endif
267
268
extract data based on geometric connectivity
~vtkConnectivityFilter() override
void AddSpecifiedRegion(int id)
Add a region id to extract.
static vtkConnectivityFilter * New()
Construct with default extraction mode to extract largest regions.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void DeleteSeed(vtkIdType id)
Delete a seed id (point or cell id).
void AddSeed(vtkIdType id)
Add a seed id (point or cell id).
void InitializeSeedList()
Initialize list of point ids/cell ids used to seed regions.
void DeleteSpecifiedRegion(int id)
Delete a region id to extract.
void InitializeSpecifiedRegionList()
Initialize list of region ids to extract.
int GetNumberOfExtractedRegions()
Obtain the number of connected regions.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:42
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.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:46
Superclass for algorithms that produce only unstructured grid as output.
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
#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
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
int vtkIdType
Definition: vtkType.h:287