VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vtkPolyDataConnectivityFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPolyDataConnectivityFilter.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 __vtkPolyDataConnectivityFilter_h
53 #define __vtkPolyDataConnectivityFilter_h
54 
55 #include "vtkFiltersCoreModule.h" // For export macro
56 #include "vtkPolyDataAlgorithm.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 vtkIdList;
67 class vtkIdTypeArray;
68 
69 class VTKFILTERSCORE_EXPORT vtkPolyDataConnectivityFilter : public vtkPolyDataAlgorithm
70 {
71 public:
72  vtkTypeMacro(vtkPolyDataConnectivityFilter,vtkPolyDataAlgorithm);
73  void PrintSelf(ostream& os, vtkIndent indent);
74 
76 
77  vtkGetObjectMacro(RegionSizes,vtkIdTypeArray);
79 
81  static vtkPolyDataConnectivityFilter *New();
82 
84 
87  vtkSetMacro(ScalarConnectivity,int);
88  vtkGetMacro(ScalarConnectivity,int);
89  vtkBooleanMacro(ScalarConnectivity,int);
91 
93 
100  vtkSetMacro(FullScalarConnectivity,int);
101  vtkGetMacro(FullScalarConnectivity,int);
102  vtkBooleanMacro(FullScalarConnectivity,int);
104 
106 
108  vtkSetVector2Macro(ScalarRange,double);
109  vtkGetVector2Macro(ScalarRange,double);
111 
113 
114  vtkSetClampMacro(ExtractionMode,int,
117  vtkGetMacro(ExtractionMode,int);
119  {this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);};
121  {this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);};
123  {this->SetExtractionMode(VTK_EXTRACT_LARGEST_REGION);};
125  {this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);};
127  {this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);};
129  {this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS);};
130  const char *GetExtractionModeAsString();
132 
134  void InitializeSeedList();
135 
137  void AddSeed(int id);
138 
140  void DeleteSeed(int id);
141 
143  void InitializeSpecifiedRegionList();
144 
146  void AddSpecifiedRegion(int id);
147 
149  void DeleteSpecifiedRegion(int id);
150 
152 
154  vtkSetVector3Macro(ClosestPoint,double);
155  vtkGetVectorMacro(ClosestPoint,double,3);
157 
159  int GetNumberOfExtractedRegions();
160 
162 
163  vtkSetMacro(ColorRegions,int);
164  vtkGetMacro(ColorRegions,int);
165  vtkBooleanMacro(ColorRegions,int);
167 
169 
171  vtkSetMacro( MarkVisitedPointIds, int );
172  vtkGetMacro( MarkVisitedPointIds, int );
173  vtkBooleanMacro( MarkVisitedPointIds, int );
175 
177 
179  vtkGetObjectMacro( VisitedPointIds, vtkIdList );
181 
182 protected:
185 
186  // Usual data generation method
187  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
188 
189  int ColorRegions; //boolean turns on/off scalar gen for separate regions
190  int ExtractionMode; //how to extract regions
191  vtkIdList *Seeds; //id's of points or cells used to seed regions
192  vtkIdList *SpecifiedRegionIds; //regions specified for extraction
193  vtkIdTypeArray *RegionSizes; //size (in cells) of each region extracted
194 
195  double ClosestPoint[3];
196 
199 
200  // Does this cell qualify as being scalar connected ?
201  int IsScalarConnected( vtkIdType cellId );
202 
203  double ScalarRange[2];
204 
205  void TraverseAndMark();
206 
207  // used to support algorithm execution
208  vtkDataArray *CellScalars;
210  vtkIdType *Visited;
211  vtkIdType *PointMap;
212  vtkDataArray *NewScalars;
213  vtkIdType RegionNumber;
214  vtkIdType PointNumber;
215  vtkIdType NumCellsInRegion;
216  vtkDataArray *InScalars;
217  vtkPolyData *Mesh;
218  vtkIdList *Wave;
219  vtkIdList *Wave2;
220  vtkIdList *PointIds;
221  vtkIdList *CellIds;
222  vtkIdList *VisitedPointIds;
223 
225 
226 private:
228  void operator=(const vtkPolyDataConnectivityFilter&); // Not implemented.
229 };
230 
232 
234 {
236  {
237  return "ExtractPointSeededRegions";
238  }
240  {
241  return "ExtractCellSeededRegions";
242  }
243  else if ( this->ExtractionMode == VTK_EXTRACT_SPECIFIED_REGIONS )
244  {
245  return "ExtractSpecifiedRegions";
246  }
247  else if ( this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS )
248  {
249  return "ExtractAllRegions";
250  }
252  {
253  return "ExtractClosestPointRegion";
254  }
255  else
256  {
257  return "ExtractLargestRegion";
258  }
259 }
261 
262 
263 #endif
#define VTK_EXTRACT_CLOSEST_POINT_REGION
#define VTK_EXTRACT_POINT_SEEDED_REGIONS
extract polygonal data based on geometric connectivity
#define VTK_EXTRACT_LARGEST_REGION
#define VTK_EXTRACT_CELL_SEEDED_REGIONS
#define VTK_EXTRACT_ALL_REGIONS
#define VTK_EXTRACT_SPECIFIED_REGIONS