VTK  9.3.0
vtkConnectivityFilter.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
57#ifndef vtkConnectivityFilter_h
58#define vtkConnectivityFilter_h
59
60#include "vtkFiltersCoreModule.h" // For export macro
62
63#define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
64#define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
65#define VTK_EXTRACT_SPECIFIED_REGIONS 3
66#define VTK_EXTRACT_LARGEST_REGION 4
67#define VTK_EXTRACT_ALL_REGIONS 5
68#define VTK_EXTRACT_CLOSEST_POINT_REGION 6
69
70VTK_ABI_NAMESPACE_BEGIN
71class vtkDataArray;
72class vtkDataSet;
73class vtkFloatArray;
74class vtkIdList;
75class vtkIdTypeArray;
76class vtkIntArray;
77class vtkPolyData;
78
79class VTKFILTERSCORE_EXPORT vtkConnectivityFilter : public vtkPointSetAlgorithm
80{
81public:
83 void PrintSelf(ostream& os, vtkIndent indent) override;
84
89
91
96 vtkSetMacro(ScalarConnectivity, vtkTypeBool);
97 vtkGetMacro(ScalarConnectivity, vtkTypeBool);
98 vtkBooleanMacro(ScalarConnectivity, vtkTypeBool);
100
102
105 vtkSetVector2Macro(ScalarRange, double);
106 vtkGetVector2Macro(ScalarRange, double);
108
110
113 vtkSetClampMacro(
115 vtkGetMacro(ExtractionMode, int);
117 {
118 this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);
119 }
121 {
122 this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);
123 }
126 {
127 this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);
128 }
130 {
131 this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);
132 }
133 void SetExtractionModeToAllRegions() { this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS); }
134 const char* GetExtractionModeAsString();
136
141
146
151
156
160 void AddSpecifiedRegion(int id);
161
166
168
172 vtkSetVector3Macro(ClosestPoint, double);
173 vtkGetVectorMacro(ClosestPoint, double, 3);
175
180
182
185 vtkSetMacro(ColorRegions, vtkTypeBool);
186 vtkGetMacro(ColorRegions, vtkTypeBool);
187 vtkBooleanMacro(ColorRegions, vtkTypeBool);
189
195 {
198 CELL_COUNT_ASCENDING
199 };
200
202
206 vtkSetMacro(RegionIdAssignmentMode, int);
207 vtkGetMacro(RegionIdAssignmentMode, int);
208
210
215 vtkSetMacro(OutputPointsPrecision, int);
216 vtkGetMacro(OutputPointsPrecision, int);
218
219protected:
222
225
226 // Usual data generation method
228 vtkInformationVector* outputVector) override;
230 int FillInputPortInformation(int port, vtkInformation* info) override;
231 int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation* info) override;
232
233 vtkTypeBool ColorRegions; // boolean turns on/off scalar gen for separate regions
234 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
243 double ScalarRange[2];
244
246
248
249 void OrderRegionIds(vtkIdTypeArray* pointRegionIds, vtkIdTypeArray* cellRegionIds);
250
251private:
252 // used to support algorithm execution
253 vtkFloatArray* CellScalars;
254 vtkIdList* NeighborCellPointIds;
255 vtkIdType* Visited;
256 vtkIdType* PointMap;
257 vtkIdTypeArray* NewScalars;
258 vtkIdTypeArray* NewCellScalars;
259 vtkIdType RegionNumber;
260 vtkIdType PointNumber;
261 vtkIdType NumCellsInRegion;
262 vtkDataArray* InScalars;
263 vtkIdList* Wave;
264 vtkIdList* Wave2;
265 vtkIdList* PointIds;
266 vtkIdList* CellIds;
267
269 void operator=(const vtkConnectivityFilter&) = delete;
270};
271
276{
278 {
279 return "ExtractPointSeededRegions";
280 }
282 {
283 return "ExtractCellSeededRegions";
284 }
286 {
287 return "ExtractSpecifiedRegions";
288 }
289 else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
290 {
291 return "ExtractAllRegions";
292 }
294 {
295 return "ExtractClosestPointRegion";
296 }
297 else
298 {
299 return "ExtractLargestRegion";
300 }
301}
302
303VTK_ABI_NAMESPACE_END
304#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:62
dynamic, self-adjusting array of float
list of point or cell ids
Definition vtkIdList.h:32
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:38
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition vtkIntArray.h:44
Superclass for algorithms that produce output of the same type as input.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:89
int vtkTypeBool
Definition vtkABI.h:64
#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:315