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=========================================================================*/
59
60#ifndef vtkConnectivityFilter_h
61#define vtkConnectivityFilter_h
62
63#include "vtkFiltersCoreModule.h" // For export macro
65
66#define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
67#define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
68#define VTK_EXTRACT_SPECIFIED_REGIONS 3
69#define VTK_EXTRACT_LARGEST_REGION 4
70#define VTK_EXTRACT_ALL_REGIONS 5
71#define VTK_EXTRACT_CLOSEST_POINT_REGION 6
72
73class vtkDataArray;
74class vtkDataSet;
75class vtkFloatArray;
76class vtkIdList;
77class vtkIdTypeArray;
78class vtkIntArray;
79class vtkPolyData;
80
81class VTKFILTERSCORE_EXPORT vtkConnectivityFilter : public vtkPointSetAlgorithm
82{
83public:
85 void PrintSelf(ostream& os, vtkIndent indent) override;
86
91
93
102
104
107 vtkSetVector2Macro(ScalarRange, double);
108 vtkGetVector2Macro(ScalarRange, double);
110
112
115 vtkSetClampMacro(
117 vtkGetMacro(ExtractionMode, int);
136 const char* GetExtractionModeAsString();
138
143
148
153
158
162 void AddSpecifiedRegion(int id);
163
168
170
174 vtkSetVector3Macro(ClosestPoint, double);
175 vtkGetVectorMacro(ClosestPoint, double, 3);
177
182
184
189 vtkBooleanMacro(ColorRegions, vtkTypeBool);
191
202
204
208 vtkSetMacro(RegionIdAssignmentMode, int);
209 vtkGetMacro(RegionIdAssignmentMode, int);
210
212
217 vtkSetMacro(OutputPointsPrecision, int);
218 vtkGetMacro(OutputPointsPrecision, int);
220
221protected:
224
227
228 // Usual data generation method
230 vtkInformationVector* outputVector) override;
232 int FillInputPortInformation(int port, vtkInformation* info) override;
233 int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation* info) override;
234
235 vtkTypeBool ColorRegions; // boolean turns on/off scalar gen for separate regions
236 int ExtractionMode; // how to extract regions
238 vtkIdList* Seeds; // id's of points or cells used to seed regions
239 vtkIdList* SpecifiedRegionIds; // regions specified for extraction
240 vtkIdTypeArray* RegionSizes; // size (in cells) of each region extracted
241
242 double ClosestPoint[3];
243
245 double ScalarRange[2];
246
248
250
251 void OrderRegionIds(vtkIdTypeArray* pointRegionIds, vtkIdTypeArray* cellRegionIds);
252
253private:
254 // used to support algorithm execution
255 vtkFloatArray* CellScalars;
256 vtkIdList* NeighborCellPointIds;
257 vtkIdType* Visited;
258 vtkIdType* PointMap;
259 vtkIdTypeArray* NewScalars;
260 vtkIdTypeArray* NewCellScalars;
261 vtkIdType RegionNumber;
262 vtkIdType PointNumber;
263 vtkIdType NumCellsInRegion;
264 vtkDataArray* InScalars;
265 vtkIdList* Wave;
266 vtkIdList* Wave2;
267 vtkIdList* PointIds;
268 vtkIdList* CellIds;
269
270private:
272 void operator=(const vtkConnectivityFilter&) = delete;
273};
274
279{
281 {
282 return "ExtractPointSeededRegions";
283 }
285 {
286 return "ExtractCellSeededRegions";
287 }
289 {
290 return "ExtractSpecifiedRegions";
291 }
292 else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
293 {
294 return "ExtractAllRegions";
295 }
297 {
298 return "ExtractClosestPointRegion";
299 }
300 else
301 {
302 return "ExtractLargestRegion";
303 }
304}
305
306#endif
~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.
virtual void SetExtractionMode(int)
Control the extraction of connected surfaces.
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 class to specify dataset behavior
Definition vtkDataSet.h:63
dynamic, self-adjusting array of float
list of point or cell ids
Definition vtkIdList.h:34
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
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:91
int vtkTypeBool
Definition vtkABI.h:69
#define vtkDataArray
#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