VTK  9.2.20230327
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 
132 VTK_ABI_NAMESPACE_BEGIN
133 class vtkDataArray;
134 class vtkDataSet;
135 class vtkFloatArray;
136 class vtkIdList;
137 class vtkIdTypeArray;
138 class vtkIntArray;
139 class vtkPolyData;
140 
141 class VTKFILTERSCORE_EXPORT vtkConnectivityFilter : public vtkPointSetAlgorithm
142 {
143 public:
145  void PrintSelf(ostream& os, vtkIndent indent) override;
146 
151 
153 
158  vtkSetMacro(ScalarConnectivity, vtkTypeBool);
159  vtkGetMacro(ScalarConnectivity, vtkTypeBool);
160  vtkBooleanMacro(ScalarConnectivity, vtkTypeBool);
162 
164 
167  vtkSetVector2Macro(ScalarRange, double);
168  vtkGetVector2Macro(ScalarRange, double);
170 
172 
175  vtkSetClampMacro(
177  vtkGetMacro(ExtractionMode, int);
179  {
180  this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);
181  }
183  {
184  this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);
185  }
188  {
189  this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);
190  }
192  {
193  this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);
194  }
195  void SetExtractionModeToAllRegions() { this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS); }
196  const char* GetExtractionModeAsString();
198 
203 
207  void AddSeed(vtkIdType id);
208 
213 
218 
222  void AddSpecifiedRegion(int id);
223 
227  void DeleteSpecifiedRegion(int id);
228 
230 
234  vtkSetVector3Macro(ClosestPoint, double);
235  vtkGetVectorMacro(ClosestPoint, double, 3);
237 
242 
244 
247  vtkSetMacro(ColorRegions, vtkTypeBool);
248  vtkGetMacro(ColorRegions, vtkTypeBool);
249  vtkBooleanMacro(ColorRegions, vtkTypeBool);
251 
257  {
260  CELL_COUNT_ASCENDING
261  };
262 
264 
268  vtkSetMacro(RegionIdAssignmentMode, int);
269  vtkGetMacro(RegionIdAssignmentMode, int);
270 
272 
277  vtkSetMacro(OutputPointsPrecision, int);
278  vtkGetMacro(OutputPointsPrecision, int);
280 
281 protected:
284 
287 
288  // Usual data generation method
290  vtkInformationVector* outputVector) override;
293  int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation* info) override;
294 
295  vtkTypeBool ColorRegions; // boolean turns on/off scalar gen for separate regions
296  int ExtractionMode; // how to extract regions
298  vtkIdList* Seeds; // id's of points or cells used to seed regions
299  vtkIdList* SpecifiedRegionIds; // regions specified for extraction
300  vtkIdTypeArray* RegionSizes; // size (in cells) of each region extracted
301 
302  double ClosestPoint[3];
303 
305  double ScalarRange[2];
306 
308 
310 
311  void OrderRegionIds(vtkIdTypeArray* pointRegionIds, vtkIdTypeArray* cellRegionIds);
312 
313 private:
314  // used to support algorithm execution
315  vtkFloatArray* CellScalars;
316  vtkIdList* NeighborCellPointIds;
317  vtkIdType* Visited;
318  vtkIdType* PointMap;
319  vtkIdTypeArray* NewScalars;
320  vtkIdTypeArray* NewCellScalars;
321  vtkIdType RegionNumber;
322  vtkIdType PointNumber;
323  vtkIdType NumCellsInRegion;
324  vtkDataArray* InScalars;
325  vtkIdList* Wave;
326  vtkIdList* Wave2;
327  vtkIdList* PointIds;
328  vtkIdList* CellIds;
329 
330 private:
332  void operator=(const vtkConnectivityFilter&) = delete;
333 };
334 
339 {
341  {
342  return "ExtractPointSeededRegions";
343  }
345  {
346  return "ExtractCellSeededRegions";
347  }
349  {
350  return "ExtractSpecifiedRegions";
351  }
352  else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
353  {
354  return "ExtractAllRegions";
355  }
357  {
358  return "ExtractClosestPointRegion";
359  }
360  else
361  {
362  return "ExtractLargestRegion";
363  }
364 }
365 
366 VTK_ABI_NAMESPACE_END
367 #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.
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.
static vtkConnectivityFilter * New()
Construct with default extraction mode to extract largest 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:166
abstract class to specify dataset behavior
Definition: vtkDataSet.h:174
dynamic, self-adjusting array of float
list of point or cell ids
Definition: vtkIdList.h:144
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:120
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:156
Superclass for algorithms that produce output of the same type as input.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:201
@ info
Definition: vtkX3D.h:388
@ port
Definition: vtkX3D.h:459
int vtkTypeBool
Definition: vtkABI.h:71
#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:327