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 =========================================================================*/
50 #ifndef vtkConnectivityFilter_h
51 #define vtkConnectivityFilter_h
52 
53 #include "vtkFiltersCoreModule.h" // For export macro
55 
56 #define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
57 #define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
58 #define VTK_EXTRACT_SPECIFIED_REGIONS 3
59 #define VTK_EXTRACT_LARGEST_REGION 4
60 #define VTK_EXTRACT_ALL_REGIONS 5
61 #define VTK_EXTRACT_CLOSEST_POINT_REGION 6
62 
63 class vtkDataArray;
64 class vtkFloatArray;
65 class vtkIdList;
66 class vtkIdTypeArray;
67 class vtkIntArray;
68 
69 class VTKFILTERSCORE_EXPORT vtkConnectivityFilter : public vtkUnstructuredGridAlgorithm
70 {
71 public:
73  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
74 
78  static vtkConnectivityFilter *New();
79 
81 
86  vtkSetMacro(ScalarConnectivity,int);
87  vtkGetMacro(ScalarConnectivity,int);
88  vtkBooleanMacro(ScalarConnectivity,int);
90 
92 
95  vtkSetVector2Macro(ScalarRange,double);
96  vtkGetVector2Macro(ScalarRange,double);
98 
100 
103  vtkSetClampMacro(ExtractionMode,int,
105  vtkGetMacro(ExtractionMode,int);
107  {this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);};
109  {this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);};
111  {this->SetExtractionMode(VTK_EXTRACT_LARGEST_REGION);};
113  {this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);};
115  {this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);};
117  {this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS);};
118  const char *GetExtractionModeAsString();
120 
124  void InitializeSeedList();
125 
129  void AddSeed(vtkIdType id);
130 
134  void DeleteSeed(vtkIdType id);
135 
139  void InitializeSpecifiedRegionList();
140 
144  void AddSpecifiedRegion(int id);
145 
149  void DeleteSpecifiedRegion(int id);
150 
152 
156  vtkSetVector3Macro(ClosestPoint,double);
157  vtkGetVectorMacro(ClosestPoint,double,3);
159 
163  int GetNumberOfExtractedRegions();
164 
166 
169  vtkSetMacro(ColorRegions,int);
170  vtkGetMacro(ColorRegions,int);
171  vtkBooleanMacro(ColorRegions,int);
173 
175 
180  vtkSetMacro(OutputPointsPrecision,int);
181  vtkGetMacro(OutputPointsPrecision,int);
183 
184 protected:
186  ~vtkConnectivityFilter() VTK_OVERRIDE;
187 
188  // Usual data generation method
190  int FillInputPortInformation(int port, vtkInformation *info) VTK_OVERRIDE;
191 
192  int ColorRegions; //boolean turns on/off scalar gen for separate regions
193  int ExtractionMode; //how to extract regions
195  vtkIdList *Seeds; //id's of points or cells used to seed regions
196  vtkIdList *SpecifiedRegionIds; //regions specified for extraction
197  vtkIdTypeArray *RegionSizes; //size (in cells) of each region extracted
198 
199  double ClosestPoint[3];
200 
202  double ScalarRange[2];
203 
204  void TraverseAndMark(vtkDataSet *input);
205 
206 private:
207  // used to support algorithm execution
208  vtkFloatArray *CellScalars;
209  vtkIdList *NeighborCellPointIds;
210  vtkIdType *Visited;
211  vtkIdType *PointMap;
212  vtkIdTypeArray *NewScalars;
213  vtkIdTypeArray *NewCellScalars;
214  vtkIdType RegionNumber;
215  vtkIdType PointNumber;
216  vtkIdType NumCellsInRegion;
217  vtkDataArray *InScalars;
218  vtkIdList *Wave;
219  vtkIdList *Wave2;
220  vtkIdList *PointIds;
221  vtkIdList *CellIds;
222 private:
223  vtkConnectivityFilter(const vtkConnectivityFilter&) VTK_DELETE_FUNCTION;
224  void operator=(const vtkConnectivityFilter&) VTK_DELETE_FUNCTION;
225 };
226 
228 
232 {
233  if ( this->ExtractionMode == VTK_EXTRACT_POINT_SEEDED_REGIONS )
234  {
235  return "ExtractPointSeededRegions";
236  }
237  else if ( this->ExtractionMode == VTK_EXTRACT_CELL_SEEDED_REGIONS )
238  {
239  return "ExtractCellSeededRegions";
240  }
241  else if ( this->ExtractionMode == VTK_EXTRACT_SPECIFIED_REGIONS )
242  {
243  return "ExtractSpecifiedRegions";
244  }
245  else if ( this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS )
246  {
247  return "ExtractAllRegions";
248  }
249  else if ( this->ExtractionMode == VTK_EXTRACT_CLOSEST_POINT_REGION )
250  {
251  return "ExtractClosestPointRegion";
252  }
253  else
254  {
255  return "ExtractLargestRegion";
256  }
257 }
259 
260 #endif
261 
262 
void SetExtractionModeToPointSeededRegions()
Control the extraction of connected surfaces.
void SetExtractionModeToClosestPointRegion()
Control the extraction of connected surfaces.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
Store vtkAlgorithm input/output information.
void SetExtractionModeToCellSeededRegions()
Control the extraction of connected surfaces.
extract data based on geometric connectivity
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
void SetExtractionModeToAllRegions()
Control the extraction of connected surfaces.
const char * GetExtractionModeAsString()
Return the method of extraction as a string.
static vtkUnstructuredGridAlgorithm * New()
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:35
#define VTK_EXTRACT_LARGEST_REGION
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:345
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
#define VTK_EXTRACT_SPECIFIED_REGIONS
#define VTK_EXTRACT_CELL_SEEDED_REGIONS
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:39
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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 only unstructured grid as output.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
#define VTK_EXTRACT_ALL_REGIONS
void SetExtractionModeToLargestRegion()
Control the extraction of connected surfaces.
Store zero or more vtkInformation instances.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
void SetExtractionModeToSpecifiedRegions()
Control the extraction of connected surfaces.