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 =========================================================================*/
60 #ifndef vtkConnectivityFilter_h
61 #define vtkConnectivityFilter_h
62 
63 #include "vtkFiltersCoreModule.h" // For export macro
64 #include "vtkPointSetAlgorithm.h"
65 
66 #define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
67 #define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
68 #define VTK_EXTRACT_SPECIFIED_REGIONS 3
69 #define VTK_EXTRACT_LARGEST_REGION 4
70 #define VTK_EXTRACT_ALL_REGIONS 5
71 #define VTK_EXTRACT_CLOSEST_POINT_REGION 6
72 
73 class vtkDataArray;
74 class vtkDataSet;
75 class vtkFloatArray;
76 class vtkIdList;
77 class vtkIdTypeArray;
78 class vtkIntArray;
79 class vtkPolyData;
80 
81 class VTKFILTERSCORE_EXPORT vtkConnectivityFilter : public vtkPointSetAlgorithm
82 {
83 public:
85  void PrintSelf(ostream& os, vtkIndent indent) override;
86 
90  static vtkConnectivityFilter* New();
91 
93 
98  vtkSetMacro(ScalarConnectivity, vtkTypeBool);
99  vtkGetMacro(ScalarConnectivity, vtkTypeBool);
100  vtkBooleanMacro(ScalarConnectivity, vtkTypeBool);
102 
104 
107  vtkSetVector2Macro(ScalarRange, double);
108  vtkGetVector2Macro(ScalarRange, double);
110 
112 
115  vtkSetClampMacro(
117  vtkGetMacro(ExtractionMode, int);
119  {
120  this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);
121  }
123  {
124  this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);
125  }
128  {
129  this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);
130  }
132  {
133  this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);
134  }
135  void SetExtractionModeToAllRegions() { this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS); }
136  const char* GetExtractionModeAsString();
138 
142  void InitializeSeedList();
143 
147  void AddSeed(vtkIdType id);
148 
152  void DeleteSeed(vtkIdType id);
153 
157  void InitializeSpecifiedRegionList();
158 
162  void AddSpecifiedRegion(int id);
163 
167  void DeleteSpecifiedRegion(int id);
168 
170 
174  vtkSetVector3Macro(ClosestPoint, double);
175  vtkGetVectorMacro(ClosestPoint, double, 3);
177 
181  int GetNumberOfExtractedRegions();
182 
184 
187  vtkSetMacro(ColorRegions, vtkTypeBool);
188  vtkGetMacro(ColorRegions, vtkTypeBool);
189  vtkBooleanMacro(ColorRegions, vtkTypeBool);
191 
197  {
200  CELL_COUNT_ASCENDING
201  };
202 
204 
207  vtkSetMacro(RegionIdAssignmentMode, int);
209  vtkGetMacro(RegionIdAssignmentMode, int);
210 
212 
217  vtkSetMacro(OutputPointsPrecision, int);
218  vtkGetMacro(OutputPointsPrecision, int);
220 
221 protected:
223  ~vtkConnectivityFilter() override;
224 
227 
228  // Usual data generation method
229  int RequestDataObject(vtkInformation* request, vtkInformationVector** inputVector,
230  vtkInformationVector* outputVector) override;
232  int FillInputPortInformation(int port, vtkInformation* info) override;
233  int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation* info) override;
234 
235  vtkTypeBool ColorRegions; // boolean turns on/off scalar gen for separate regions
236  int ExtractionMode; // how to extract regions
238  vtkIdList* Seeds; // id's of points or cells used to seed regions
239  vtkIdList* SpecifiedRegionIds; // regions specified for extraction
240  vtkIdTypeArray* RegionSizes; // size (in cells) of each region extracted
241 
242  double ClosestPoint[3];
243 
245  double ScalarRange[2];
246 
248 
249  void TraverseAndMark(vtkDataSet* input);
250 
251  void OrderRegionIds(vtkIdTypeArray* pointRegionIds, vtkIdTypeArray* cellRegionIds);
252 
253 private:
254  // used to support algorithm execution
255  vtkFloatArray* CellScalars;
256  vtkIdList* NeighborCellPointIds;
257  vtkIdType* Visited;
258  vtkIdType* PointMap;
259  vtkIdTypeArray* NewScalars;
260  vtkIdTypeArray* NewCellScalars;
261  vtkIdType RegionNumber;
262  vtkIdType PointNumber;
263  vtkIdType NumCellsInRegion;
264  vtkDataArray* InScalars;
265  vtkIdList* Wave;
266  vtkIdList* Wave2;
267  vtkIdList* PointIds;
268  vtkIdList* CellIds;
269 
270 private:
272  void operator=(const vtkConnectivityFilter&) = delete;
273 };
274 
279 {
281  {
282  return "ExtractPointSeededRegions";
283  }
285  {
286  return "ExtractCellSeededRegions";
287  }
289  {
290  return "ExtractSpecifiedRegions";
291  }
292  else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
293  {
294  return "ExtractAllRegions";
295  }
297  {
298  return "ExtractClosestPointRegion";
299  }
300  else
301  {
302  return "ExtractLargestRegion";
303  }
304 }
305 
306 #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:62
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:41
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:332
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
#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:69
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:45
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:39
#define VTK_EXTRACT_POINT_SEEDED_REGIONS
#define VTK_EXTRACT_CLOSEST_POINT_REGION
list of point or cell ids
Definition: vtkIdList.h:33
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
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.