VTK  9.3.1
vtkConnectivityFilter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
48 #ifndef vtkConnectivityFilter_h
49 #define vtkConnectivityFilter_h
50 
51 #include "vtkFiltersCoreModule.h" // For export macro
52 #include "vtkPointSetAlgorithm.h"
53 
54 #define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
55 #define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
56 #define VTK_EXTRACT_SPECIFIED_REGIONS 3
57 #define VTK_EXTRACT_LARGEST_REGION 4
58 #define VTK_EXTRACT_ALL_REGIONS 5
59 #define VTK_EXTRACT_CLOSEST_POINT_REGION 6
60 
61 VTK_ABI_NAMESPACE_BEGIN
62 class vtkDataArray;
63 class vtkDataSet;
64 class vtkFloatArray;
65 class vtkIdList;
66 class vtkIdTypeArray;
67 class vtkIntArray;
68 class vtkPolyData;
69 
70 class VTKFILTERSCORE_EXPORT vtkConnectivityFilter : public vtkPointSetAlgorithm
71 {
72 public:
74  void PrintSelf(ostream& os, vtkIndent indent) override;
75 
79  static vtkConnectivityFilter* New();
80 
82 
87  vtkSetMacro(ScalarConnectivity, vtkTypeBool);
88  vtkGetMacro(ScalarConnectivity, vtkTypeBool);
89  vtkBooleanMacro(ScalarConnectivity, vtkTypeBool);
91 
93 
96  vtkSetVector2Macro(ScalarRange, double);
97  vtkGetVector2Macro(ScalarRange, double);
99 
101 
104  vtkSetClampMacro(
106  vtkGetMacro(ExtractionMode, int);
108  {
109  this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);
110  }
112  {
113  this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);
114  }
117  {
118  this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);
119  }
121  {
122  this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);
123  }
124  void SetExtractionModeToAllRegions() { this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS); }
125  const char* GetExtractionModeAsString();
127 
131  void InitializeSeedList();
132 
136  void AddSeed(vtkIdType id);
137 
141  void DeleteSeed(vtkIdType id);
142 
146  void InitializeSpecifiedRegionList();
147 
151  void AddSpecifiedRegion(int id);
152 
156  void DeleteSpecifiedRegion(int id);
157 
159 
163  vtkSetVector3Macro(ClosestPoint, double);
164  vtkGetVectorMacro(ClosestPoint, double, 3);
166 
170  int GetNumberOfExtractedRegions();
171 
173 
176  vtkSetMacro(ColorRegions, vtkTypeBool);
177  vtkGetMacro(ColorRegions, vtkTypeBool);
178  vtkBooleanMacro(ColorRegions, vtkTypeBool);
180 
186  {
189  CELL_COUNT_ASCENDING
190  };
191 
193 
196  vtkSetMacro(RegionIdAssignmentMode, int);
198  vtkGetMacro(RegionIdAssignmentMode, int);
199 
201 
206  vtkSetMacro(OutputPointsPrecision, int);
207  vtkGetMacro(OutputPointsPrecision, int);
209 
210 protected:
212  ~vtkConnectivityFilter() override;
213 
216 
217  // Usual data generation method
218  int RequestDataObject(vtkInformation* request, vtkInformationVector** inputVector,
219  vtkInformationVector* outputVector) override;
221  int FillInputPortInformation(int port, vtkInformation* info) override;
222  int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation* info) override;
223 
224  vtkTypeBool ColorRegions; // boolean turns on/off scalar gen for separate regions
225  int ExtractionMode; // how to extract regions
227  vtkIdList* Seeds; // id's of points or cells used to seed regions
228  vtkIdList* SpecifiedRegionIds; // regions specified for extraction
229  vtkIdTypeArray* RegionSizes; // size (in cells) of each region extracted
230 
231  double ClosestPoint[3];
232 
234  double ScalarRange[2];
235 
237 
238  void TraverseAndMark(vtkDataSet* input);
239 
240  void OrderRegionIds(vtkIdTypeArray* pointRegionIds, vtkIdTypeArray* cellRegionIds);
241 
242 private:
243  // used to support algorithm execution
244  vtkFloatArray* CellScalars;
245  vtkIdList* NeighborCellPointIds;
246  vtkIdType* Visited;
247  vtkIdType* PointMap;
248  vtkIdTypeArray* NewScalars;
249  vtkIdTypeArray* NewCellScalars;
250  vtkIdType RegionNumber;
251  vtkIdType PointNumber;
252  vtkIdType NumCellsInRegion;
253  vtkDataArray* InScalars;
254  vtkIdList* Wave;
255  vtkIdList* Wave2;
256  vtkIdList* PointIds;
257  vtkIdList* CellIds;
258 
260  void operator=(const vtkConnectivityFilter&) = delete;
261 };
262 
267 {
269  {
270  return "ExtractPointSeededRegions";
271  }
273  {
274  return "ExtractCellSeededRegions";
275  }
277  {
278  return "ExtractSpecifiedRegions";
279  }
280  else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
281  {
282  return "ExtractAllRegions";
283  }
285  {
286  return "ExtractClosestPointRegion";
287  }
288  else
289  {
290  return "ExtractLargestRegion";
291  }
292 }
293 
294 VTK_ABI_NAMESPACE_END
295 #endif
void SetExtractionModeToPointSeededRegions()
Control the extraction of connected surfaces.
void SetExtractionModeToClosestPointRegion()
Control the extraction of connected surfaces.
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Store vtkAlgorithm input/output information.
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
see vtkAlgorithm for details
virtual int RequestDataObject(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
void SetExtractionModeToCellSeededRegions()
Control the extraction of connected surfaces.
extract data based on geometric connectivity
abstract class to specify dataset behavior
Definition: vtkDataSet.h:52
void SetExtractionModeToAllRegions()
Control the extraction of connected surfaces.
const char * GetExtractionModeAsString()
Return the method of extraction as a string.
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:30
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
#define VTK_EXTRACT_LARGEST_REGION
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:315
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
#define VTK_EXTRACT_SPECIFIED_REGIONS
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
#define VTK_EXTRACT_CELL_SEEDED_REGIONS
int vtkTypeBool
Definition: vtkABI.h:64
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:34
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
a simple class to control print indentation
Definition: vtkIndent.h:28
#define VTK_EXTRACT_POINT_SEEDED_REGIONS
#define VTK_EXTRACT_CLOSEST_POINT_REGION
list of point or cell ids
Definition: vtkIdList.h:22
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
Superclass for algorithms that produce output of the same type as input.
RegionIdAssignment
Enumeration of the various ways to assign RegionIds when the ColorRegions option is on...
#define VTK_EXTRACT_ALL_REGIONS
static vtkPointSetAlgorithm * New()
void SetExtractionModeToLargestRegion()
Control the extraction of connected surfaces.
Store zero or more vtkInformation instances.
void SetExtractionModeToSpecifiedRegions()
Control the extraction of connected surfaces.