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 =========================================================================*/
55 #ifndef __vtkConnectivityFilter_h
56 #define __vtkConnectivityFilter_h
57 
59 
60 #define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
61 #define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
62 #define VTK_EXTRACT_SPECIFIED_REGIONS 3
63 #define VTK_EXTRACT_LARGEST_REGION 4
64 #define VTK_EXTRACT_ALL_REGIONS 5
65 #define VTK_EXTRACT_CLOSEST_POINT_REGION 6
66 
67 class vtkDataArray;
68 class vtkFloatArray;
69 class vtkIdList;
70 class vtkIdTypeArray;
71 class vtkIntArray;
72 
74 {
75 public:
77  void PrintSelf(ostream& os, vtkIndent indent);
78 
80  static vtkConnectivityFilter *New();
81 
83 
86  vtkSetMacro(ScalarConnectivity,int);
87  vtkGetMacro(ScalarConnectivity,int);
88  vtkBooleanMacro(ScalarConnectivity,int);
90 
92 
94  vtkSetVector2Macro(ScalarRange,double);
95  vtkGetVector2Macro(ScalarRange,double);
97 
99 
100  vtkSetClampMacro(ExtractionMode,int,
102  vtkGetMacro(ExtractionMode,int);
104  {this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);};
106  {this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);};
108  {this->SetExtractionMode(VTK_EXTRACT_LARGEST_REGION);};
110  {this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);};
112  {this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);};
114  {this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS);};
115  const char *GetExtractionModeAsString();
117 
119  void InitializeSeedList();
120 
122  void AddSeed(vtkIdType id);
123 
125  void DeleteSeed(vtkIdType id);
126 
128  void InitializeSpecifiedRegionList();
129 
131  void AddSpecifiedRegion(int id);
132 
134  void DeleteSpecifiedRegion(int id);
135 
137 
139  vtkSetVector3Macro(ClosestPoint,double);
140  vtkGetVectorMacro(ClosestPoint,double,3);
142 
144  int GetNumberOfExtractedRegions();
145 
147 
148  vtkSetMacro(ColorRegions,int);
149  vtkGetMacro(ColorRegions,int);
150  vtkBooleanMacro(ColorRegions,int);
152 
153 protected:
156 
157  // Usual data generation method
160 
161  int ColorRegions; //boolean turns on/off scalar gen for separate regions
162  int ExtractionMode; //how to extract regions
163  vtkIdList *Seeds; //id's of points or cells used to seed regions
164  vtkIdList *SpecifiedRegionIds; //regions specified for extraction
165  vtkIdTypeArray *RegionSizes; //size (in cells) of each region extracted
166 
167  double ClosestPoint[3];
168 
170  double ScalarRange[2];
171 
172  void TraverseAndMark(vtkDataSet *input);
173 
174 private:
175  // used to support algorithm execution
176  vtkFloatArray *CellScalars;
177  vtkIdList *NeighborCellPointIds;
178  vtkIdType *Visited;
179  vtkIdType *PointMap;
180  vtkIdTypeArray *NewScalars;
181  vtkIdTypeArray *NewCellScalars;
182  vtkIdType RegionNumber;
183  vtkIdType PointNumber;
184  vtkIdType NumCellsInRegion;
185  vtkDataArray *InScalars;
186  vtkIdList *Wave;
187  vtkIdList *Wave2;
188  vtkIdList *PointIds;
189  vtkIdList *CellIds;
190 private:
191  vtkConnectivityFilter(const vtkConnectivityFilter&); // Not implemented.
192  void operator=(const vtkConnectivityFilter&); // Not implemented.
193 };
194 
196 
198 {
200  {
201  return "ExtractPointSeededRegions";
202  }
203  else if ( this->ExtractionMode == VTK_EXTRACT_CELL_SEEDED_REGIONS )
204  {
205  return "ExtractCellSeededRegions";
206  }
207  else if ( this->ExtractionMode == VTK_EXTRACT_SPECIFIED_REGIONS )
208  {
209  return "ExtractSpecifiedRegions";
210  }
211  else if ( this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS )
212  {
213  return "ExtractAllRegions";
214  }
216  {
217  return "ExtractClosestPointRegion";
218  }
219  else
220  {
221  return "ExtractLargestRegion";
222  }
223 }
225 
226 #endif
227 
228 
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
#define VTK_GRAPHICS_EXPORT
Store vtkAlgorithm input/output information.
extract data based on geometric connectivity
abstract class to specify dataset behavior
Definition: vtkDataSet.h:58
const char * GetExtractionModeAsString()
static vtkUnstructuredGridAlgorithm * New()
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:42
#define VTK_EXTRACT_LARGEST_REGION
virtual int FillInputPortInformation(int port, vtkInformation *info)
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:255
#define VTK_EXTRACT_SPECIFIED_REGIONS
#define VTK_EXTRACT_CELL_SEEDED_REGIONS
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:42
a simple class to control print indentation
Definition: vtkIndent.h:37
#define VTK_EXTRACT_POINT_SEEDED_REGIONS
#define VTK_EXTRACT_CLOSEST_POINT_REGION
list of point or cell ids
Definition: vtkIdList.h:34
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:53
void PrintSelf(ostream &os, vtkIndent indent)
Superclass for algorithms that produce only unstructured grid as output.
#define VTK_EXTRACT_ALL_REGIONS
Store zero or more vtkInformation instances.