VTK  9.3.20240424
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
107#ifndef vtkConnectivityFilter_h
108#define vtkConnectivityFilter_h
109
110#include "vtkFiltersCoreModule.h" // For export macro
111#include "vtkPointSetAlgorithm.h"
112
113#define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
114#define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
115#define VTK_EXTRACT_SPECIFIED_REGIONS 3
116#define VTK_EXTRACT_LARGEST_REGION 4
117#define VTK_EXTRACT_ALL_REGIONS 5
118#define VTK_EXTRACT_CLOSEST_POINT_REGION 6
119
120VTK_ABI_NAMESPACE_BEGIN
121class vtkDataArray;
122class vtkDataSet;
123class vtkFloatArray;
124class vtkIdList;
125class vtkIdTypeArray;
126class vtkIntArray;
127class vtkPolyData;
128
129class VTKFILTERSCORE_EXPORT vtkConnectivityFilter : public vtkPointSetAlgorithm
130{
131public:
133 void PrintSelf(ostream& os, vtkIndent indent) override;
134
139
141
146 vtkSetMacro(ScalarConnectivity, vtkTypeBool);
147 vtkGetMacro(ScalarConnectivity, vtkTypeBool);
148 vtkBooleanMacro(ScalarConnectivity, vtkTypeBool);
150
152
155 vtkSetVector2Macro(ScalarRange, double);
156 vtkGetVector2Macro(ScalarRange, double);
158
160
163 vtkSetClampMacro(
165 vtkGetMacro(ExtractionMode, int);
167 {
168 this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);
169 }
171 {
172 this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);
173 }
176 {
177 this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);
178 }
180 {
181 this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);
182 }
183 void SetExtractionModeToAllRegions() { this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS); }
184 const char* GetExtractionModeAsString();
186
191
196
201
206
210 void AddSpecifiedRegion(int id);
211
216
218
222 vtkSetVector3Macro(ClosestPoint, double);
223 vtkGetVectorMacro(ClosestPoint, double, 3);
225
230
232
235 vtkSetMacro(ColorRegions, vtkTypeBool);
236 vtkGetMacro(ColorRegions, vtkTypeBool);
237 vtkBooleanMacro(ColorRegions, vtkTypeBool);
239
245 {
248 CELL_COUNT_ASCENDING
249 };
250
252
256 vtkSetMacro(RegionIdAssignmentMode, int);
257 vtkGetMacro(RegionIdAssignmentMode, int);
258
260
265 vtkSetMacro(OutputPointsPrecision, int);
266 vtkGetMacro(OutputPointsPrecision, int);
268
269protected:
272
275
276 // Usual data generation method
278 vtkInformationVector* outputVector) override;
280 int FillInputPortInformation(int port, vtkInformation* info) override;
281 int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation* info) override;
282
283 vtkTypeBool ColorRegions; // boolean turns on/off scalar gen for separate regions
284 int ExtractionMode; // how to extract regions
286 vtkIdList* Seeds; // id's of points or cells used to seed regions
287 vtkIdList* SpecifiedRegionIds; // regions specified for extraction
288 vtkIdTypeArray* RegionSizes; // size (in cells) of each region extracted
289
290 double ClosestPoint[3];
291
293 double ScalarRange[2];
294
296
298
299 void OrderRegionIds(vtkIdTypeArray* pointRegionIds, vtkIdTypeArray* cellRegionIds);
300
301private:
302 // used to support algorithm execution
303 vtkFloatArray* CellScalars;
304 vtkIdList* NeighborCellPointIds;
305 vtkIdType* Visited;
306 vtkIdType* PointMap;
307 vtkIdTypeArray* NewScalars;
308 vtkIdTypeArray* NewCellScalars;
309 vtkIdType RegionNumber;
310 vtkIdType PointNumber;
311 vtkIdType NumCellsInRegion;
312 vtkDataArray* InScalars;
313 vtkIdList* Wave;
314 vtkIdList* Wave2;
315 vtkIdList* PointIds;
316 vtkIdList* CellIds;
317
319 void operator=(const vtkConnectivityFilter&) = delete;
320};
321
326{
328 {
329 return "ExtractPointSeededRegions";
330 }
332 {
333 return "ExtractCellSeededRegions";
334 }
336 {
337 return "ExtractSpecifiedRegions";
338 }
339 else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
340 {
341 return "ExtractAllRegions";
342 }
344 {
345 return "ExtractClosestPointRegion";
346 }
347 else
348 {
349 return "ExtractLargestRegion";
350 }
351}
352
353VTK_ABI_NAMESPACE_END
354#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:166
dynamic, self-adjusting array of float
list of point or cell ids
Definition vtkIdList.h:133
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
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: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