VTK  9.1.0
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=========================================================================*/
66#ifndef vtkConnectivityFilter_h
67#define vtkConnectivityFilter_h
68
69#include "vtkFiltersCoreModule.h" // For export macro
71
72#define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
73#define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
74#define VTK_EXTRACT_SPECIFIED_REGIONS 3
75#define VTK_EXTRACT_LARGEST_REGION 4
76#define VTK_EXTRACT_ALL_REGIONS 5
77#define VTK_EXTRACT_CLOSEST_POINT_REGION 6
78
79class vtkDataArray;
80class vtkDataSet;
81class vtkFloatArray;
82class vtkIdList;
83class vtkIdTypeArray;
84class vtkIntArray;
85class vtkPolyData;
86
87class VTKFILTERSCORE_EXPORT vtkConnectivityFilter : public vtkPointSetAlgorithm
88{
89public:
91 void PrintSelf(ostream& os, vtkIndent indent) override;
92
97
99
104 vtkSetMacro(ScalarConnectivity, vtkTypeBool);
105 vtkGetMacro(ScalarConnectivity, vtkTypeBool);
106 vtkBooleanMacro(ScalarConnectivity, vtkTypeBool);
108
110
113 vtkSetVector2Macro(ScalarRange, double);
114 vtkGetVector2Macro(ScalarRange, double);
116
118
121 vtkSetClampMacro(
123 vtkGetMacro(ExtractionMode, int);
125 {
126 this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);
127 }
129 {
130 this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);
131 }
134 {
135 this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);
136 }
138 {
139 this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);
140 }
141 void SetExtractionModeToAllRegions() { this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS); }
142 const char* GetExtractionModeAsString();
144
149
154
159
164
168 void AddSpecifiedRegion(int id);
169
174
176
180 vtkSetVector3Macro(ClosestPoint, double);
181 vtkGetVectorMacro(ClosestPoint, double, 3);
183
188
190
193 vtkSetMacro(ColorRegions, vtkTypeBool);
194 vtkGetMacro(ColorRegions, vtkTypeBool);
195 vtkBooleanMacro(ColorRegions, vtkTypeBool);
197
203 {
206 CELL_COUNT_ASCENDING
207 };
208
210
214 vtkSetMacro(RegionIdAssignmentMode, int);
215 vtkGetMacro(RegionIdAssignmentMode, int);
216
218
223 vtkSetMacro(OutputPointsPrecision, int);
224 vtkGetMacro(OutputPointsPrecision, int);
226
227protected:
230
233
234 // Usual data generation method
236 vtkInformationVector* outputVector) override;
239 int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation* info) override;
240
241 vtkTypeBool ColorRegions; // boolean turns on/off scalar gen for separate regions
242 int ExtractionMode; // how to extract regions
244 vtkIdList* Seeds; // id's of points or cells used to seed regions
245 vtkIdList* SpecifiedRegionIds; // regions specified for extraction
246 vtkIdTypeArray* RegionSizes; // size (in cells) of each region extracted
247
248 double ClosestPoint[3];
249
251 double ScalarRange[2];
252
254
256
257 void OrderRegionIds(vtkIdTypeArray* pointRegionIds, vtkIdTypeArray* cellRegionIds);
258
259private:
260 // used to support algorithm execution
261 vtkFloatArray* CellScalars;
262 vtkIdList* NeighborCellPointIds;
263 vtkIdType* Visited;
264 vtkIdType* PointMap;
265 vtkIdTypeArray* NewScalars;
266 vtkIdTypeArray* NewCellScalars;
267 vtkIdType RegionNumber;
268 vtkIdType PointNumber;
269 vtkIdType NumCellsInRegion;
270 vtkDataArray* InScalars;
271 vtkIdList* Wave;
272 vtkIdList* Wave2;
273 vtkIdList* PointIds;
274 vtkIdList* CellIds;
275
276private:
278 void operator=(const vtkConnectivityFilter&) = delete;
279};
280
285{
287 {
288 return "ExtractPointSeededRegions";
289 }
291 {
292 return "ExtractCellSeededRegions";
293 }
295 {
296 return "ExtractSpecifiedRegions";
297 }
298 else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
299 {
300 return "ExtractAllRegions";
301 }
303 {
304 return "ExtractClosestPointRegion";
305 }
306 else
307 {
308 return "ExtractLargestRegion";
309 }
310}
311
312#endif
extract data based on geometric connectivity
~vtkConnectivityFilter() override
void TraverseAndMark(vtkDataSet *input)
void SetExtractionModeToClosestPointRegion()
Control the extraction of connected surfaces.
void SetExtractionModeToLargestRegion()
Control the extraction of connected surfaces.
void OrderRegionIds(vtkIdTypeArray *pointRegionIds, vtkIdTypeArray *cellRegionIds)
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).
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
const char * GetExtractionModeAsString()
Return the method of extraction as a string.
void SetExtractionModeToCellSeededRegions()
Control the extraction of connected surfaces.
void AddSeed(vtkIdType id)
Add a seed id (point or cell id).
RegionIdAssignment
Enumeration of the various ways to assign RegionIds when the ColorRegions option is on.
vtkTypeBool ProcessRequest(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
see vtkAlgorithm for details
int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation *info) override
void InitializeSeedList()
Initialize list of point ids/cell ids used to seed regions.
void DeleteSpecifiedRegion(int id)
Delete a region id to extract.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void SetExtractionModeToPointSeededRegions()
Control the extraction of connected surfaces.
void SetExtractionModeToAllRegions()
Control the extraction of connected surfaces.
void InitializeSpecifiedRegionList()
Initialize list of region ids to extract.
int RequestDataObject(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
void SetExtractionModeToSpecifiedRegions()
Control the extraction of connected surfaces.
int GetNumberOfExtractedRegions()
Obtain the number of connected regions.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:59
abstract class to specify dataset behavior
Definition: vtkDataSet.h:66
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:45
list of point or cell ids
Definition: vtkIdList.h:40
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:43
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:49
Superclass for algorithms that produce output of the same type as input.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:95
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
int vtkTypeBool
Definition: vtkABI.h:69
#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:332