VTK
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 "vtkPolyDataAlgorithm.h"
56 
57 #define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
58 #define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
59 #define VTK_EXTRACT_SPECIFIED_REGIONS 3
60 #define VTK_EXTRACT_LARGEST_REGION 4
61 #define VTK_EXTRACT_ALL_REGIONS 5
62 #define VTK_EXTRACT_CLOSEST_POINT_REGION 6
63 
64 class vtkDataArray;
65 class vtkIdList;
66 class vtkIdTypeArray;
67 
69 {
70 public:
72  void PrintSelf(ostream& os, vtkIndent indent);
73 
75 
76  vtkGetObjectMacro(RegionSizes,vtkIdTypeArray);
78 
81 
83 
86  vtkSetMacro(ScalarConnectivity,int);
87  vtkGetMacro(ScalarConnectivity,int);
88  vtkBooleanMacro(ScalarConnectivity,int);
90 
92 
99  vtkSetMacro(FullScalarConnectivity,int);
100  vtkGetMacro(FullScalarConnectivity,int);
101  vtkBooleanMacro(FullScalarConnectivity,int);
103 
105 
107  vtkSetVector2Macro(ScalarRange,double);
108  vtkGetVector2Macro(ScalarRange,double);
110 
112 
113  vtkSetClampMacro(ExtractionMode,int,
116  vtkGetMacro(ExtractionMode,int);
117  void SetExtractionModeToPointSeededRegions()
118  {this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);};
119  void SetExtractionModeToCellSeededRegions()
120  {this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);};
121  void SetExtractionModeToLargestRegion()
122  {this->SetExtractionMode(VTK_EXTRACT_LARGEST_REGION);};
123  void SetExtractionModeToSpecifiedRegions()
124  {this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);};
125  void SetExtractionModeToClosestPointRegion()
126  {this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);};
127  void SetExtractionModeToAllRegions()
128  {this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS);};
129  const char *GetExtractionModeAsString();
131 
133  void InitializeSeedList();
134 
136  void AddSeed(int id);
137 
139  void DeleteSeed(int id);
140 
142  void InitializeSpecifiedRegionList();
143 
145  void AddSpecifiedRegion(int id);
146 
148  void DeleteSpecifiedRegion(int id);
149 
151 
153  vtkSetVector3Macro(ClosestPoint,double);
154  vtkGetVectorMacro(ClosestPoint,double,3);
156 
158  int GetNumberOfExtractedRegions();
159 
161 
162  vtkSetMacro(ColorRegions,int);
163  vtkGetMacro(ColorRegions,int);
164  vtkBooleanMacro(ColorRegions,int);
166 
168 
170  vtkSetMacro( MarkVisitedPointIds, int );
171  vtkGetMacro( MarkVisitedPointIds, int );
172  vtkBooleanMacro( MarkVisitedPointIds, int );
174 
176 
178  vtkGetObjectMacro( VisitedPointIds, vtkIdList );
180 
181 protected:
184 
185  // Usual data generation method
187 
188  int ColorRegions; //boolean turns on/off scalar gen for separate regions
189  int ExtractionMode; //how to extract regions
190  vtkIdList *Seeds; //id's of points or cells used to seed regions
191  vtkIdList *SpecifiedRegionIds; //regions specified for extraction
192  vtkIdTypeArray *RegionSizes; //size (in cells) of each region extracted
193 
194  double ClosestPoint[3];
195 
198 
199  // Does this cell qualify as being scalar connected ?
200  int IsScalarConnected( vtkIdType cellId );
201 
202  double ScalarRange[2];
203 
204  void TraverseAndMark();
205 
206  // used to support algorithm execution
222 
224 
225 private:
227  void operator=(const vtkPolyDataConnectivityFilter&); // Not implemented.
228 };
229 
231 
233 {
235  {
236  return "ExtractPointSeededRegions";
237  }
239  {
240  return "ExtractCellSeededRegions";
241  }
242  else if ( this->ExtractionMode == VTK_EXTRACT_SPECIFIED_REGIONS )
243  {
244  return "ExtractSpecifiedRegions";
245  }
246  else if ( this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS )
247  {
248  return "ExtractAllRegions";
249  }
251  {
252  return "ExtractClosestPointRegion";
253  }
254  else
255  {
256  return "ExtractLargestRegion";
257  }
258 }
260 
261 
262 #endif