VTK  9.2.6
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=========================================================================*/
69#ifndef vtkConnectivityFilter_h
70#define vtkConnectivityFilter_h
71
72#include "vtkFiltersCoreModule.h" // For export macro
74
75#define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
76#define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
77#define VTK_EXTRACT_SPECIFIED_REGIONS 3
78#define VTK_EXTRACT_LARGEST_REGION 4
79#define VTK_EXTRACT_ALL_REGIONS 5
80#define VTK_EXTRACT_CLOSEST_POINT_REGION 6
81
82class vtkDataArray;
83class vtkDataSet;
84class vtkFloatArray;
85class vtkIdList;
86class vtkIdTypeArray;
87class vtkIntArray;
88class vtkPolyData;
89
90class VTKFILTERSCORE_EXPORT vtkConnectivityFilter : public vtkPointSetAlgorithm
91{
92public:
94 void PrintSelf(ostream& os, vtkIndent indent) override;
95
100
102
107 vtkSetMacro(ScalarConnectivity, vtkTypeBool);
108 vtkGetMacro(ScalarConnectivity, vtkTypeBool);
109 vtkBooleanMacro(ScalarConnectivity, vtkTypeBool);
111
113
116 vtkSetVector2Macro(ScalarRange, double);
117 vtkGetVector2Macro(ScalarRange, double);
119
121
124 vtkSetClampMacro(
126 vtkGetMacro(ExtractionMode, int);
128 {
129 this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);
130 }
132 {
133 this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);
134 }
137 {
138 this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);
139 }
141 {
142 this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);
143 }
144 void SetExtractionModeToAllRegions() { this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS); }
145 const char* GetExtractionModeAsString();
147
152
157
162
167
171 void AddSpecifiedRegion(int id);
172
177
179
183 vtkSetVector3Macro(ClosestPoint, double);
184 vtkGetVectorMacro(ClosestPoint, double, 3);
186
191
193
196 vtkSetMacro(ColorRegions, vtkTypeBool);
197 vtkGetMacro(ColorRegions, vtkTypeBool);
198 vtkBooleanMacro(ColorRegions, vtkTypeBool);
200
206 {
209 CELL_COUNT_ASCENDING
210 };
211
213
217 vtkSetMacro(RegionIdAssignmentMode, int);
218 vtkGetMacro(RegionIdAssignmentMode, int);
219
221
226 vtkSetMacro(OutputPointsPrecision, int);
227 vtkGetMacro(OutputPointsPrecision, int);
229
230protected:
233
236
237 // Usual data generation method
239 vtkInformationVector* outputVector) override;
241 int FillInputPortInformation(int port, vtkInformation* info) override;
242 int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation* info) override;
243
244 vtkTypeBool ColorRegions; // boolean turns on/off scalar gen for separate regions
245 int ExtractionMode; // how to extract regions
247 vtkIdList* Seeds; // id's of points or cells used to seed regions
248 vtkIdList* SpecifiedRegionIds; // regions specified for extraction
249 vtkIdTypeArray* RegionSizes; // size (in cells) of each region extracted
250
251 double ClosestPoint[3];
252
254 double ScalarRange[2];
255
257
259
260 void OrderRegionIds(vtkIdTypeArray* pointRegionIds, vtkIdTypeArray* cellRegionIds);
261
262private:
263 // used to support algorithm execution
264 vtkFloatArray* CellScalars;
265 vtkIdList* NeighborCellPointIds;
266 vtkIdType* Visited;
267 vtkIdType* PointMap;
268 vtkIdTypeArray* NewScalars;
269 vtkIdTypeArray* NewCellScalars;
270 vtkIdType RegionNumber;
271 vtkIdType PointNumber;
272 vtkIdType NumCellsInRegion;
273 vtkDataArray* InScalars;
274 vtkIdList* Wave;
275 vtkIdList* Wave2;
276 vtkIdList* PointIds;
277 vtkIdList* CellIds;
278
279private:
281 void operator=(const vtkConnectivityFilter&) = delete;
282};
283
288{
290 {
291 return "ExtractPointSeededRegions";
292 }
294 {
295 return "ExtractCellSeededRegions";
296 }
298 {
299 return "ExtractSpecifiedRegions";
300 }
301 else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
302 {
303 return "ExtractAllRegions";
304 }
306 {
307 return "ExtractClosestPointRegion";
308 }
309 else
310 {
311 return "ExtractLargestRegion";
312 }
313}
314
315#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
Upstream/Downstream requests form the generalized interface through which executives invoke a algorit...
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
abstract class to specify dataset behavior
Definition vtkDataSet.h:72
dynamic, self-adjusting array of float
list of point or cell ids
Definition vtkIdList.h:43
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:49
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition vtkIntArray.h:55
Superclass for algorithms that produce output of the same type as input.
concrete dataset represents vertices, lines, polygons, and triangle strips
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