VTK  9.1.0
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=========================================================================*/
116#ifndef vtkConnectivityFilter_h
117#define vtkConnectivityFilter_h
118
119#include "vtkFiltersCoreModule.h" // For export macro
120#include "vtkPointSetAlgorithm.h"
121
122#define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
123#define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
124#define VTK_EXTRACT_SPECIFIED_REGIONS 3
125#define VTK_EXTRACT_LARGEST_REGION 4
126#define VTK_EXTRACT_ALL_REGIONS 5
127#define VTK_EXTRACT_CLOSEST_POINT_REGION 6
128
129class vtkDataArray;
130class vtkDataSet;
131class vtkFloatArray;
132class vtkIdList;
133class vtkIdTypeArray;
134class vtkIntArray;
135class vtkPolyData;
136
137class VTKFILTERSCORE_EXPORT vtkConnectivityFilter : public vtkPointSetAlgorithm
138{
139public:
141 void PrintSelf(ostream& os, vtkIndent indent) override;
142
147
149
154 vtkSetMacro(ScalarConnectivity, vtkTypeBool);
155 vtkGetMacro(ScalarConnectivity, vtkTypeBool);
156 vtkBooleanMacro(ScalarConnectivity, vtkTypeBool);
158
160
163 vtkSetVector2Macro(ScalarRange, double);
164 vtkGetVector2Macro(ScalarRange, double);
166
168
171 vtkSetClampMacro(
173 vtkGetMacro(ExtractionMode, int);
175 {
176 this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);
177 }
179 {
180 this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);
181 }
184 {
185 this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);
186 }
188 {
189 this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);
190 }
191 void SetExtractionModeToAllRegions() { this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS); }
192 const char* GetExtractionModeAsString();
194
199
204
209
214
218 void AddSpecifiedRegion(int id);
219
224
226
230 vtkSetVector3Macro(ClosestPoint, double);
231 vtkGetVectorMacro(ClosestPoint, double, 3);
233
238
240
243 vtkSetMacro(ColorRegions, vtkTypeBool);
244 vtkGetMacro(ColorRegions, vtkTypeBool);
245 vtkBooleanMacro(ColorRegions, vtkTypeBool);
247
253 {
256 CELL_COUNT_ASCENDING
257 };
258
260
264 vtkSetMacro(RegionIdAssignmentMode, int);
265 vtkGetMacro(RegionIdAssignmentMode, int);
266
268
273 vtkSetMacro(OutputPointsPrecision, int);
274 vtkGetMacro(OutputPointsPrecision, int);
276
277protected:
280
283
284 // Usual data generation method
286 vtkInformationVector* outputVector) override;
289 int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation* info) override;
290
291 vtkTypeBool ColorRegions; // boolean turns on/off scalar gen for separate regions
292 int ExtractionMode; // how to extract regions
294 vtkIdList* Seeds; // id's of points or cells used to seed regions
295 vtkIdList* SpecifiedRegionIds; // regions specified for extraction
296 vtkIdTypeArray* RegionSizes; // size (in cells) of each region extracted
297
298 double ClosestPoint[3];
299
301 double ScalarRange[2];
302
304
306
307 void OrderRegionIds(vtkIdTypeArray* pointRegionIds, vtkIdTypeArray* cellRegionIds);
308
309private:
310 // used to support algorithm execution
311 vtkFloatArray* CellScalars;
312 vtkIdList* NeighborCellPointIds;
313 vtkIdType* Visited;
314 vtkIdType* PointMap;
315 vtkIdTypeArray* NewScalars;
316 vtkIdTypeArray* NewCellScalars;
317 vtkIdType RegionNumber;
318 vtkIdType PointNumber;
319 vtkIdType NumCellsInRegion;
320 vtkDataArray* InScalars;
321 vtkIdList* Wave;
322 vtkIdList* Wave2;
323 vtkIdList* PointIds;
324 vtkIdList* CellIds;
325
326private:
328 void operator=(const vtkConnectivityFilter&) = delete;
329};
330
335{
337 {
338 return "ExtractPointSeededRegions";
339 }
341 {
342 return "ExtractCellSeededRegions";
343 }
345 {
346 return "ExtractSpecifiedRegions";
347 }
348 else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
349 {
350 return "ExtractAllRegions";
351 }
353 {
354 return "ExtractClosestPointRegion";
355 }
356 else
357 {
358 return "ExtractLargestRegion";
359 }
360}
361
362#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:159
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:140
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:113
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:149
Superclass for algorithms that produce output of the same type as input.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
@ 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