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=========================================================================*/
119#ifndef vtkConnectivityFilter_h
120#define vtkConnectivityFilter_h
121
122#include "vtkFiltersCoreModule.h" // For export macro
123#include "vtkPointSetAlgorithm.h"
124
125#define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
126#define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
127#define VTK_EXTRACT_SPECIFIED_REGIONS 3
128#define VTK_EXTRACT_LARGEST_REGION 4
129#define VTK_EXTRACT_ALL_REGIONS 5
130#define VTK_EXTRACT_CLOSEST_POINT_REGION 6
131
132class vtkDataArray;
133class vtkDataSet;
134class vtkFloatArray;
135class vtkIdList;
136class vtkIdTypeArray;
137class vtkIntArray;
138class vtkPolyData;
139
140class VTKFILTERSCORE_EXPORT vtkConnectivityFilter : public vtkPointSetAlgorithm
141{
142public:
144 void PrintSelf(ostream& os, vtkIndent indent) override;
145
150
152
157 vtkSetMacro(ScalarConnectivity, vtkTypeBool);
158 vtkGetMacro(ScalarConnectivity, vtkTypeBool);
159 vtkBooleanMacro(ScalarConnectivity, vtkTypeBool);
161
163
166 vtkSetVector2Macro(ScalarRange, double);
167 vtkGetVector2Macro(ScalarRange, double);
169
171
174 vtkSetClampMacro(
176 vtkGetMacro(ExtractionMode, int);
178 {
179 this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);
180 }
182 {
183 this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);
184 }
187 {
188 this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);
189 }
191 {
192 this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);
193 }
194 void SetExtractionModeToAllRegions() { this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS); }
195 const char* GetExtractionModeAsString();
197
202
207
212
217
221 void AddSpecifiedRegion(int id);
222
227
229
233 vtkSetVector3Macro(ClosestPoint, double);
234 vtkGetVectorMacro(ClosestPoint, double, 3);
236
241
243
246 vtkSetMacro(ColorRegions, vtkTypeBool);
247 vtkGetMacro(ColorRegions, vtkTypeBool);
248 vtkBooleanMacro(ColorRegions, vtkTypeBool);
250
256 {
259 CELL_COUNT_ASCENDING
260 };
261
263
267 vtkSetMacro(RegionIdAssignmentMode, int);
268 vtkGetMacro(RegionIdAssignmentMode, int);
269
271
276 vtkSetMacro(OutputPointsPrecision, int);
277 vtkGetMacro(OutputPointsPrecision, int);
279
280protected:
283
286
287 // Usual data generation method
289 vtkInformationVector* outputVector) override;
292 int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation* info) override;
293
294 vtkTypeBool ColorRegions; // boolean turns on/off scalar gen for separate regions
295 int ExtractionMode; // how to extract regions
297 vtkIdList* Seeds; // id's of points or cells used to seed regions
298 vtkIdList* SpecifiedRegionIds; // regions specified for extraction
299 vtkIdTypeArray* RegionSizes; // size (in cells) of each region extracted
300
301 double ClosestPoint[3];
302
304 double ScalarRange[2];
305
307
309
310 void OrderRegionIds(vtkIdTypeArray* pointRegionIds, vtkIdTypeArray* cellRegionIds);
311
312private:
313 // used to support algorithm execution
314 vtkFloatArray* CellScalars;
315 vtkIdList* NeighborCellPointIds;
316 vtkIdType* Visited;
317 vtkIdType* PointMap;
318 vtkIdTypeArray* NewScalars;
319 vtkIdTypeArray* NewCellScalars;
320 vtkIdType RegionNumber;
321 vtkIdType PointNumber;
322 vtkIdType NumCellsInRegion;
323 vtkDataArray* InScalars;
324 vtkIdList* Wave;
325 vtkIdList* Wave2;
326 vtkIdList* PointIds;
327 vtkIdList* CellIds;
328
329private:
331 void operator=(const vtkConnectivityFilter&) = delete;
332};
333
338{
340 {
341 return "ExtractPointSeededRegions";
342 }
344 {
345 return "ExtractCellSeededRegions";
346 }
348 {
349 return "ExtractSpecifiedRegions";
350 }
351 else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
352 {
353 return "ExtractAllRegions";
354 }
356 {
357 return "ExtractClosestPointRegion";
358 }
359 else
360 {
361 return "ExtractLargestRegion";
362 }
363}
364
365#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
see vtkAlgorithm for details
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
Definition: vtkDataArray.h:165
abstract class to specify dataset behavior
Definition: vtkDataSet.h:172
dynamic, self-adjusting array of float
list of point or cell ids
Definition: vtkIdList.h:143
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:155
Superclass for algorithms that produce output of the same type as input.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:200
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
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