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 
58 #include "vtkFiltersCoreModule.h" // For export macro
60 
61 #define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
62 #define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
63 #define VTK_EXTRACT_SPECIFIED_REGIONS 3
64 #define VTK_EXTRACT_LARGEST_REGION 4
65 #define VTK_EXTRACT_ALL_REGIONS 5
66 #define VTK_EXTRACT_CLOSEST_POINT_REGION 6
67 
68 class vtkDataArray;
69 class vtkFloatArray;
70 class vtkIdList;
71 class vtkIdTypeArray;
72 class vtkIntArray;
73 
75 {
76 public:
78  void PrintSelf(ostream& os, vtkIndent indent);
79 
81  static vtkConnectivityFilter *New();
82 
84 
87  vtkSetMacro(ScalarConnectivity,int);
88  vtkGetMacro(ScalarConnectivity,int);
89  vtkBooleanMacro(ScalarConnectivity,int);
91 
93 
95  vtkSetVector2Macro(ScalarRange,double);
96  vtkGetVector2Macro(ScalarRange,double);
98 
100 
101  vtkSetClampMacro(ExtractionMode,int,
103  vtkGetMacro(ExtractionMode,int);
105  {this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);};
107  {this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);};
109  {this->SetExtractionMode(VTK_EXTRACT_LARGEST_REGION);};
111  {this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);};
113  {this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);};
115  {this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS);};
116  const char *GetExtractionModeAsString();
118 
120  void InitializeSeedList();
121 
123  void AddSeed(vtkIdType id);
124 
126  void DeleteSeed(vtkIdType id);
127 
129  void InitializeSpecifiedRegionList();
130 
132  void AddSpecifiedRegion(int id);
133 
135  void DeleteSpecifiedRegion(int id);
136 
138 
140  vtkSetVector3Macro(ClosestPoint,double);
141  vtkGetVectorMacro(ClosestPoint,double,3);
143 
145  int GetNumberOfExtractedRegions();
146 
148 
149  vtkSetMacro(ColorRegions,int);
150  vtkGetMacro(ColorRegions,int);
151  vtkBooleanMacro(ColorRegions,int);
153 
155 
158  vtkSetMacro(OutputPointsPrecision,int);
159  vtkGetMacro(OutputPointsPrecision,int);
161 
162 protected:
165 
166  // Usual data generation method
169 
170  int ColorRegions; //boolean turns on/off scalar gen for separate regions
171  int ExtractionMode; //how to extract regions
173  vtkIdList *Seeds; //id's of points or cells used to seed regions
174  vtkIdList *SpecifiedRegionIds; //regions specified for extraction
175  vtkIdTypeArray *RegionSizes; //size (in cells) of each region extracted
176 
177  double ClosestPoint[3];
178 
180  double ScalarRange[2];
181 
182  void TraverseAndMark(vtkDataSet *input);
183 
184 private:
185  // used to support algorithm execution
186  vtkFloatArray *CellScalars;
187  vtkIdList *NeighborCellPointIds;
188  vtkIdType *Visited;
189  vtkIdType *PointMap;
190  vtkIdTypeArray *NewScalars;
191  vtkIdTypeArray *NewCellScalars;
192  vtkIdType RegionNumber;
193  vtkIdType PointNumber;
194  vtkIdType NumCellsInRegion;
195  vtkDataArray *InScalars;
196  vtkIdList *Wave;
197  vtkIdList *Wave2;
198  vtkIdList *PointIds;
199  vtkIdList *CellIds;
200 private:
201  vtkConnectivityFilter(const vtkConnectivityFilter&); // Not implemented.
202  void operator=(const vtkConnectivityFilter&); // Not implemented.
203 };
204 
206 
208 {
210  {
211  return "ExtractPointSeededRegions";
212  }
214  {
215  return "ExtractCellSeededRegions";
216  }
217  else if ( this->ExtractionMode == VTK_EXTRACT_SPECIFIED_REGIONS )
218  {
219  return "ExtractSpecifiedRegions";
220  }
221  else if ( this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS )
222  {
223  return "ExtractAllRegions";
224  }
226  {
227  return "ExtractClosestPointRegion";
228  }
229  else
230  {
231  return "ExtractLargestRegion";
232  }
233 }
235 
236 #endif
237 
238 
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Store vtkAlgorithm input/output information.
extract data based on geometric connectivity
abstract class to specify dataset behavior
Definition: vtkDataSet.h:61
#define VTKFILTERSCORE_EXPORT
const char * GetExtractionModeAsString()
static vtkUnstructuredGridAlgorithm * New()
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:45
#define VTK_EXTRACT_LARGEST_REGION
virtual int FillInputPortInformation(int port, vtkInformation *info)
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:275
#define VTK_EXTRACT_SPECIFIED_REGIONS
#define VTK_EXTRACT_CELL_SEEDED_REGIONS
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:49
a simple class to control print indentation
Definition: vtkIndent.h:38
#define VTK_EXTRACT_POINT_SEEDED_REGIONS
#define VTK_EXTRACT_CLOSEST_POINT_REGION
list of point or cell ids
Definition: vtkIdList.h:35
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
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.