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=========================================================================*/
56
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
70class vtkDataArray;
71class vtkDataSet;
72class vtkFloatArray;
73class vtkIdList;
74class vtkIdTypeArray;
75class vtkIntArray;
76class vtkPolyData;
77
78class VTKFILTERSCORE_EXPORT vtkConnectivityFilter : public vtkPointSetAlgorithm
79{
80public:
82 void PrintSelf(ostream& os, vtkIndent indent) override;
83
88
90
99
101
104 vtkSetVector2Macro(ScalarRange, double);
105 vtkGetVector2Macro(ScalarRange, double);
107
109
112 vtkSetClampMacro(
114 vtkGetMacro(ExtractionMode, int);
133 const char* GetExtractionModeAsString();
135
140
145
150
155
159 void AddSpecifiedRegion(int id);
160
165
167
171 vtkSetVector3Macro(ClosestPoint, double);
172 vtkGetVectorMacro(ClosestPoint, double, 3);
174
179
181
186 vtkBooleanMacro(ColorRegions, vtkTypeBool);
188
199
201
205 vtkSetMacro(RegionIdAssignmentMode, int);
206 vtkGetMacro(RegionIdAssignmentMode, int);
207
209
214 vtkSetMacro(OutputPointsPrecision, int);
215 vtkGetMacro(OutputPointsPrecision, int);
217
218protected:
221
224
225 // Usual data generation method
227 vtkInformationVector* outputVector) override;
229 int FillInputPortInformation(int port, vtkInformation* info) override;
230 int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation* info) override;
231
232 vtkTypeBool ColorRegions; // boolean turns on/off scalar gen for separate regions
233 int ExtractionMode; // how to extract regions
235 vtkIdList* Seeds; // id's of points or cells used to seed regions
236 vtkIdList* SpecifiedRegionIds; // regions specified for extraction
237 vtkIdTypeArray* RegionSizes; // size (in cells) of each region extracted
238
239 double ClosestPoint[3];
240
242 double ScalarRange[2];
243
245
247
248 void OrderRegionIds(vtkIdTypeArray* pointRegionIds, vtkIdTypeArray* cellRegionIds);
249
250private:
251 // used to support algorithm execution
252 vtkFloatArray* CellScalars;
253 vtkIdList* NeighborCellPointIds;
254 vtkIdType* Visited;
255 vtkIdType* PointMap;
256 vtkIdTypeArray* NewScalars;
257 vtkIdTypeArray* NewCellScalars;
258 vtkIdType RegionNumber;
259 vtkIdType PointNumber;
260 vtkIdType NumCellsInRegion;
261 vtkDataArray* InScalars;
262 vtkIdList* Wave;
263 vtkIdList* Wave2;
264 vtkIdList* PointIds;
265 vtkIdList* CellIds;
266
267private:
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
303#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:57
dynamic, self-adjusting array of float
list of point or cell ids
Definition vtkIdList.h:31
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition vtkIntArray.h:40
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:85
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