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 =========================================================================*/
46 #ifndef __vtkPolyDataConnectivityFilter_h
47 #define __vtkPolyDataConnectivityFilter_h
48 
49 #include "vtkPolyDataAlgorithm.h"
50 
51 #define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
52 #define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
53 #define VTK_EXTRACT_SPECIFIED_REGIONS 3
54 #define VTK_EXTRACT_LARGEST_REGION 4
55 #define VTK_EXTRACT_ALL_REGIONS 5
56 #define VTK_EXTRACT_CLOSEST_POINT_REGION 6
57 
58 class vtkDataArray;
59 class vtkIdList;
60 class vtkIdTypeArray;
61 
63 {
64 public:
66  void PrintSelf(ostream& os, vtkIndent indent);
67 
70 
72 
75  vtkSetMacro(ScalarConnectivity,int);
76  vtkGetMacro(ScalarConnectivity,int);
77  vtkBooleanMacro(ScalarConnectivity,int);
79 
81 
83  vtkSetVector2Macro(ScalarRange,double);
84  vtkGetVector2Macro(ScalarRange,double);
86 
88 
89  vtkSetClampMacro(ExtractionMode,int,
92  vtkGetMacro(ExtractionMode,int);
94  {this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);};
96  {this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);};
98  {this->SetExtractionMode(VTK_EXTRACT_LARGEST_REGION);};
100  {this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);};
102  {this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);};
104  {this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS);};
105  const char *GetExtractionModeAsString();
107 
109  void InitializeSeedList();
110 
112  void AddSeed(int id);
113 
115  void DeleteSeed(int id);
116 
118  void InitializeSpecifiedRegionList();
119 
121  void AddSpecifiedRegion(int id);
122 
124  void DeleteSpecifiedRegion(int id);
125 
127 
129  vtkSetVector3Macro(ClosestPoint,double);
130  vtkGetVectorMacro(ClosestPoint,double,3);
132 
134  int GetNumberOfExtractedRegions();
135 
137 
138  vtkSetMacro(ColorRegions,int);
139  vtkGetMacro(ColorRegions,int);
140  vtkBooleanMacro(ColorRegions,int);
142 
143 protected:
146 
147  // Usual data generation method
149 
150  int ColorRegions; //boolean turns on/off scalar gen for separate regions
151  int ExtractionMode; //how to extract regions
152  vtkIdList *Seeds; //id's of points or cells used to seed regions
153  vtkIdList *SpecifiedRegionIds; //regions specified for extraction
154  vtkIdTypeArray *RegionSizes; //size (in cells) of each region extracted
155 
156  double ClosestPoint[3];
157 
159  double ScalarRange[2];
160 
161  void TraverseAndMark();
162 
163  // used to support algorithm execution
178 private:
180  void operator=(const vtkPolyDataConnectivityFilter&); // Not implemented.
181 };
182 
184 
186 {
188  {
189  return "ExtractPointSeededRegions";
190  }
192  {
193  return "ExtractCellSeededRegions";
194  }
195  else if ( this->ExtractionMode == VTK_EXTRACT_SPECIFIED_REGIONS )
196  {
197  return "ExtractSpecifiedRegions";
198  }
199  else if ( this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS )
200  {
201  return "ExtractAllRegions";
202  }
204  {
205  return "ExtractClosestPointRegion";
206  }
207  else
208  {
209  return "ExtractLargestRegion";
210  }
211 }
213 
214 
215 #endif