VTK
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 =========================================================================*/
52 #ifndef vtkConnectivityFilter_h
53 #define vtkConnectivityFilter_h
54 
55 #include "vtkFiltersCoreModule.h" // For export macro
56 #include "vtkPointSetAlgorithm.h"
57 
58 #define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
59 #define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
60 #define VTK_EXTRACT_SPECIFIED_REGIONS 3
61 #define VTK_EXTRACT_LARGEST_REGION 4
62 #define VTK_EXTRACT_ALL_REGIONS 5
63 #define VTK_EXTRACT_CLOSEST_POINT_REGION 6
64 
65 class vtkDataArray;
66 class vtkDataSet;
67 class vtkFloatArray;
68 class vtkIdList;
69 class vtkIdTypeArray;
70 class vtkIntArray;
71 class vtkPolyData;
72 
73 class VTKFILTERSCORE_EXPORT vtkConnectivityFilter : public vtkPointSetAlgorithm
74 {
75 public:
77  void PrintSelf(ostream& os, vtkIndent indent) override;
78 
82  static vtkConnectivityFilter *New();
83 
85 
90  vtkSetMacro(ScalarConnectivity,vtkTypeBool);
91  vtkGetMacro(ScalarConnectivity,vtkTypeBool);
92  vtkBooleanMacro(ScalarConnectivity,vtkTypeBool);
94 
96 
99  vtkSetVector2Macro(ScalarRange,double);
100  vtkGetVector2Macro(ScalarRange,double);
102 
104 
107  vtkSetClampMacro(ExtractionMode,int,
109  vtkGetMacro(ExtractionMode,int);
111  {this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);};
113  {this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);};
115  {this->SetExtractionMode(VTK_EXTRACT_LARGEST_REGION);};
117  {this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);};
119  {this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);};
121  {this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS);};
122  const char *GetExtractionModeAsString();
124 
128  void InitializeSeedList();
129 
133  void AddSeed(vtkIdType id);
134 
138  void DeleteSeed(vtkIdType id);
139 
143  void InitializeSpecifiedRegionList();
144 
148  void AddSpecifiedRegion(int id);
149 
153  void DeleteSpecifiedRegion(int id);
154 
156 
160  vtkSetVector3Macro(ClosestPoint,double);
161  vtkGetVectorMacro(ClosestPoint,double,3);
163 
167  int GetNumberOfExtractedRegions();
168 
170 
173  vtkSetMacro(ColorRegions,vtkTypeBool);
174  vtkGetMacro(ColorRegions,vtkTypeBool);
175  vtkBooleanMacro(ColorRegions,vtkTypeBool);
177 
179 
184  vtkSetMacro(OutputPointsPrecision,int);
185  vtkGetMacro(OutputPointsPrecision,int);
187 
189 
190 protected:
192  ~vtkConnectivityFilter() override;
193 
194  // Usual data generation method
195  int RequestDataObject(vtkInformation* request, vtkInformationVector** inputVector,
196  vtkInformationVector* outputVector) override;
198  int FillInputPortInformation(int port, vtkInformation *info) override;
199  int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation* info) override;
200 
201  vtkTypeBool ColorRegions; //boolean turns on/off scalar gen for separate regions
202  int ExtractionMode; //how to extract regions
204  vtkIdList *Seeds; //id's of points or cells used to seed regions
205  vtkIdList *SpecifiedRegionIds; //regions specified for extraction
206  vtkIdTypeArray *RegionSizes; //size (in cells) of each region extracted
207 
208  double ClosestPoint[3];
209 
211  double ScalarRange[2];
212 
213  void TraverseAndMark(vtkDataSet *input);
214 
215 private:
216  // used to support algorithm execution
217  vtkFloatArray *CellScalars;
218  vtkIdList *NeighborCellPointIds;
219  vtkIdType *Visited;
220  vtkIdType *PointMap;
221  vtkIdTypeArray *NewScalars;
222  vtkIdTypeArray *NewCellScalars;
223  vtkIdType RegionNumber;
224  vtkIdType PointNumber;
225  vtkIdType NumCellsInRegion;
226  vtkDataArray *InScalars;
227  vtkIdList *Wave;
228  vtkIdList *Wave2;
229  vtkIdList *PointIds;
230  vtkIdList *CellIds;
231 private:
233  void operator=(const vtkConnectivityFilter&) = delete;
234 };
235 
237 
241 {
243  {
244  return "ExtractPointSeededRegions";
245  }
247  {
248  return "ExtractCellSeededRegions";
249  }
250  else if ( this->ExtractionMode == VTK_EXTRACT_SPECIFIED_REGIONS )
251  {
252  return "ExtractSpecifiedRegions";
253  }
254  else if ( this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS )
255  {
256  return "ExtractAllRegions";
257  }
259  {
260  return "ExtractClosestPointRegion";
261  }
262  else
263  {
264  return "ExtractLargestRegion";
265  }
266 }
268 
269 #endif
270 
271 
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.
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:56
int ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
see vtkAlgorithm for details
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:35
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:345
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:69
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:39
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:33
#define VTK_EXTRACT_POINT_SEEDED_REGIONS
#define VTK_EXTRACT_CLOSEST_POINT_REGION
list of point or cell ids
Definition: vtkIdList.h:30
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
Superclass for algorithms that produce output of the same type as input.
#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.