00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00079 #ifndef __vtkConnectivityFilter_h
00080 #define __vtkConnectivityFilter_h
00081
00082 #include "vtkDataSetToUnstructuredGridFilter.h"
00083
00084 #define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
00085 #define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
00086 #define VTK_EXTRACT_SPECIFIED_REGIONS 3
00087 #define VTK_EXTRACT_LARGEST_REGION 4
00088 #define VTK_EXTRACT_ALL_REGIONS 5
00089 #define VTK_EXTRACT_CLOSEST_POINT_REGION 6
00090
00091 class VTK_EXPORT vtkConnectivityFilter : public vtkDataSetToUnstructuredGridFilter
00092 {
00093 public:
00094 vtkTypeMacro(vtkConnectivityFilter,vtkDataSetToUnstructuredGridFilter);
00095 void PrintSelf(ostream& os, vtkIndent indent);
00096
00098 static vtkConnectivityFilter *New();
00099
00103 vtkSetMacro(ScalarConnectivity,int);
00104 vtkGetMacro(ScalarConnectivity,int);
00105 vtkBooleanMacro(ScalarConnectivity,int);
00106
00109 vtkSetVector2Macro(ScalarRange,float);
00110 vtkGetVector2Macro(ScalarRange,float);
00111
00113 vtkSetClampMacro(ExtractionMode,int,
00114 VTK_EXTRACT_POINT_SEEDED_REGIONS,VTK_EXTRACT_CLOSEST_POINT_REGION);
00115 vtkGetMacro(ExtractionMode,int);
00116 void SetExtractionModeToPointSeededRegions()
00117 {this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);};
00118 void SetExtractionModeToCellSeededRegions()
00119 {this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);};
00120 void SetExtractionModeToLargestRegion()
00121 {this->SetExtractionMode(VTK_EXTRACT_LARGEST_REGION);};
00122 void SetExtractionModeToSpecifiedRegions()
00123 {this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);};
00124 void SetExtractionModeToClosestPointRegion()
00125 {this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);};
00126 void SetExtractionModeToAllRegions()
00127 {this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS);};
00128 const char *GetExtractionModeAsString();
00129
00131 void InitializeSeedList();
00132
00134 void AddSeed(int id);
00135
00137 void DeleteSeed(int id);
00138
00140 void InitializeSpecifiedRegionList();
00141
00143 void AddSpecifiedRegion(int id);
00144
00146 void DeleteSpecifiedRegion(int id);
00147
00150 vtkSetVector3Macro(ClosestPoint,float);
00151 vtkGetVectorMacro(ClosestPoint,float,3);
00152
00154 int GetNumberOfExtractedRegions();
00155
00157 vtkSetMacro(ColorRegions,int);
00158 vtkGetMacro(ColorRegions,int);
00159 vtkBooleanMacro(ColorRegions,int);
00160
00161 #ifndef VTK_REMOVE_LEGACY_CODE
00162
00165 void SetMaxRecursionDepth(int)
00166 {VTK_LEGACY_METHOD(SetMaxRecursionDepth,"3.2");}
00167 int GetMaxRecursionDepth()
00168 {VTK_LEGACY_METHOD(GetMaxRecursionDepth,"3.2"); return 0;}
00169 #endif
00170
00171 protected:
00172 vtkConnectivityFilter();
00173 ~vtkConnectivityFilter();
00174 vtkConnectivityFilter(const vtkConnectivityFilter&) {};
00175 void operator=(const vtkConnectivityFilter&) {};
00176
00177
00178 void Execute();
00179
00180 int ColorRegions;
00181 int ExtractionMode;
00182 vtkIdList *Seeds;
00183 vtkIdList *SpecifiedRegionIds;
00184 vtkIntArray *RegionSizes;
00185
00186 float ClosestPoint[3];
00187
00188 int ScalarConnectivity;
00189 float ScalarRange[2];
00190
00191 void TraverseAndMark();
00192
00193 private:
00194
00195 vtkScalars *CellScalars;
00196 vtkIdList *NeighborCellPointIds;
00197 int *Visited;
00198 int *PointMap;
00199 vtkScalars *NewScalars;
00200 int RegionNumber;
00201 int PointNumber;
00202 int NumCellsInRegion;
00203 vtkScalars *InScalars;
00204 vtkIdList *Wave;
00205 vtkIdList *Wave2;
00206 vtkIdList *PointIds;
00207 vtkIdList *CellIds;
00208 };
00209
00211 inline const char *vtkConnectivityFilter::GetExtractionModeAsString(void)
00212 {
00213 if ( this->ExtractionMode == VTK_EXTRACT_POINT_SEEDED_REGIONS )
00214 {
00215 return "ExtractPointSeededRegions";
00216 }
00217 else if ( this->ExtractionMode == VTK_EXTRACT_CELL_SEEDED_REGIONS )
00218 {
00219 return "ExtractCellSeededRegions";
00220 }
00221 else if ( this->ExtractionMode == VTK_EXTRACT_SPECIFIED_REGIONS )
00222 {
00223 return "ExtractSpecifiedRegions";
00224 }
00225 else if ( this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS )
00226 {
00227 return "ExtractAllRegions";
00228 }
00229 else if ( this->ExtractionMode == VTK_EXTRACT_CLOSEST_POINT_REGION )
00230 {
00231 return "ExtractClosestPointRegion";
00232 }
00233 else
00234 {
00235 return "ExtractLargestRegion";
00236 }
00237 }
00238
00239 #endif
00240
00241