vtkConnectivityFilter.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00067 #ifndef __vtkConnectivityFilter_h
00068 #define __vtkConnectivityFilter_h
00069
00070 #include "vtkDataSetToUnstructuredGridFilter.h"
00071
00072 #define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
00073 #define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
00074 #define VTK_EXTRACT_SPECIFIED_REGIONS 3
00075 #define VTK_EXTRACT_LARGEST_REGION 4
00076 #define VTK_EXTRACT_ALL_REGIONS 5
00077 #define VTK_EXTRACT_CLOSEST_POINT_REGION 6
00078
00079 class vtkDataArray;
00080 class vtkFloatArray;
00081 class vtkIdList;
00082 class vtkIntArray;
00083
00084 class VTK_GRAPHICS_EXPORT vtkConnectivityFilter : public vtkDataSetToUnstructuredGridFilter
00085 {
00086 public:
00087 vtkTypeRevisionMacro(vtkConnectivityFilter,vtkDataSetToUnstructuredGridFilter);
00088 void PrintSelf(ostream& os, vtkIndent indent);
00089
00091 static vtkConnectivityFilter *New();
00092
00094
00097 vtkSetMacro(ScalarConnectivity,int);
00098 vtkGetMacro(ScalarConnectivity,int);
00099 vtkBooleanMacro(ScalarConnectivity,int);
00101
00103
00105 vtkSetVector2Macro(ScalarRange,double);
00106 vtkGetVector2Macro(ScalarRange,double);
00108
00110
00111 vtkSetClampMacro(ExtractionMode,int,
00112 VTK_EXTRACT_POINT_SEEDED_REGIONS,VTK_EXTRACT_CLOSEST_POINT_REGION);
00113 vtkGetMacro(ExtractionMode,int);
00114 void SetExtractionModeToPointSeededRegions()
00115 {this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);};
00116 void SetExtractionModeToCellSeededRegions()
00117 {this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);};
00118 void SetExtractionModeToLargestRegion()
00119 {this->SetExtractionMode(VTK_EXTRACT_LARGEST_REGION);};
00120 void SetExtractionModeToSpecifiedRegions()
00121 {this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);};
00122 void SetExtractionModeToClosestPointRegion()
00123 {this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);};
00124 void SetExtractionModeToAllRegions()
00125 {this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS);};
00126 const char *GetExtractionModeAsString();
00128
00130 void InitializeSeedList();
00131
00133 void AddSeed(vtkIdType id);
00134
00136 void DeleteSeed(vtkIdType id);
00137
00139 void InitializeSpecifiedRegionList();
00140
00142 void AddSpecifiedRegion(int id);
00143
00145 void DeleteSpecifiedRegion(int id);
00146
00148
00150 vtkSetVector3Macro(ClosestPoint,double);
00151 vtkGetVectorMacro(ClosestPoint,double,3);
00153
00155 int GetNumberOfExtractedRegions();
00156
00158
00159 vtkSetMacro(ColorRegions,int);
00160 vtkGetMacro(ColorRegions,int);
00161 vtkBooleanMacro(ColorRegions,int);
00163
00164 protected:
00165 vtkConnectivityFilter();
00166 ~vtkConnectivityFilter();
00167
00168
00169 void Execute();
00170
00171 int ColorRegions;
00172 int ExtractionMode;
00173 vtkIdList *Seeds;
00174 vtkIdList *SpecifiedRegionIds;
00175 vtkIntArray *RegionSizes;
00176
00177 double ClosestPoint[3];
00178
00179 int ScalarConnectivity;
00180 double ScalarRange[2];
00181
00182 void TraverseAndMark();
00183
00184 private:
00185
00186 vtkFloatArray *CellScalars;
00187 vtkIdList *NeighborCellPointIds;
00188 vtkIdType *Visited;
00189 vtkIdType *PointMap;
00190 vtkFloatArray *NewScalars;
00191 int RegionNumber;
00192 vtkIdType PointNumber;
00193 int NumCellsInRegion;
00194 vtkDataArray *InScalars;
00195 vtkIdList *Wave;
00196 vtkIdList *Wave2;
00197 vtkIdList *PointIds;
00198 vtkIdList *CellIds;
00199 private:
00200 vtkConnectivityFilter(const vtkConnectivityFilter&);
00201 void operator=(const vtkConnectivityFilter&);
00202 };
00203
00205 inline const char *vtkConnectivityFilter::GetExtractionModeAsString(void)
00206 {
00207 if ( this->ExtractionMode == VTK_EXTRACT_POINT_SEEDED_REGIONS )
00208 {
00209 return "ExtractPointSeededRegions";
00210 }
00211 else if ( this->ExtractionMode == VTK_EXTRACT_CELL_SEEDED_REGIONS )
00212 {
00213 return "ExtractCellSeededRegions";
00214 }
00215 else if ( this->ExtractionMode == VTK_EXTRACT_SPECIFIED_REGIONS )
00216 {
00217 return "ExtractSpecifiedRegions";
00218 }
00219 else if ( this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS )
00220 {
00221 return "ExtractAllRegions";
00222 }
00223 else if ( this->ExtractionMode == VTK_EXTRACT_CLOSEST_POINT_REGION )
00224 {
00225 return "ExtractClosestPointRegion";
00226 }
00227 else
00228 {
00229 return "ExtractLargestRegion";
00230 }
00231 }
00232
00233 #endif
00234
00235