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
00073 #ifndef __vtkPolyDataConnectivityFilter_h
00074 #define __vtkPolyDataConnectivityFilter_h
00075
00076 #include "vtkPolyDataToPolyDataFilter.h"
00077
00078 #define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
00079 #define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
00080 #define VTK_EXTRACT_SPECIFIED_REGIONS 3
00081 #define VTK_EXTRACT_LARGEST_REGION 4
00082 #define VTK_EXTRACT_ALL_REGIONS 5
00083 #define VTK_EXTRACT_CLOSEST_POINT_REGION 6
00084
00085 class VTK_EXPORT vtkPolyDataConnectivityFilter : public vtkPolyDataToPolyDataFilter
00086 {
00087 public:
00088 vtkTypeMacro(vtkPolyDataConnectivityFilter,vtkPolyDataToPolyDataFilter);
00089 void PrintSelf(ostream& os, vtkIndent indent);
00090
00092 static vtkPolyDataConnectivityFilter *New();
00093
00097 vtkSetMacro(ScalarConnectivity,int);
00098 vtkGetMacro(ScalarConnectivity,int);
00099 vtkBooleanMacro(ScalarConnectivity,int);
00100
00103 vtkSetVectorMacro(ScalarRange,float,2);
00104 vtkGetVectorMacro(ScalarRange,float,2);
00105
00107 vtkSetClampMacro(ExtractionMode,int,
00108 VTK_EXTRACT_POINT_SEEDED_REGIONS,
00109 VTK_EXTRACT_CLOSEST_POINT_REGION);
00110 vtkGetMacro(ExtractionMode,int);
00111 void SetExtractionModeToPointSeededRegions()
00112 {this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);};
00113 void SetExtractionModeToCellSeededRegions()
00114 {this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);};
00115 void SetExtractionModeToLargestRegion()
00116 {this->SetExtractionMode(VTK_EXTRACT_LARGEST_REGION);};
00117 void SetExtractionModeToSpecifiedRegions()
00118 {this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);};
00119 void SetExtractionModeToClosestPointRegion()
00120 {this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);};
00121 void SetExtractionModeToAllRegions()
00122 {this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS);};
00123 const char *GetExtractionModeAsString();
00124
00126 void InitializeSeedList();
00127
00129 void AddSeed(int id);
00130
00132 void DeleteSeed(int id);
00133
00135 void InitializeSpecifiedRegionList();
00136
00138 void AddSpecifiedRegion(int id);
00139
00141 void DeleteSpecifiedRegion(int id);
00142
00145 vtkSetVector3Macro(ClosestPoint,float);
00146 vtkGetVectorMacro(ClosestPoint,float,3);
00147
00149 int GetNumberOfExtractedRegions();
00150
00152 vtkSetMacro(ColorRegions,int);
00153 vtkGetMacro(ColorRegions,int);
00154 vtkBooleanMacro(ColorRegions,int);
00155
00156 #ifndef VTK_REMOVE_LEGACY_CODE
00157
00160 void SetMaxRecursionDepth(int)
00161 {VTK_LEGACY_METHOD(SetMaxRecursionDepth,"3.2");}
00162 int GetMaxRecursionDepth()
00163 {VTK_LEGACY_METHOD(GetMaxRecursionDepth,"3.2"); return 0;}
00164 #endif
00165
00166 protected:
00167 vtkPolyDataConnectivityFilter();
00168 ~vtkPolyDataConnectivityFilter();
00169 vtkPolyDataConnectivityFilter(const vtkPolyDataConnectivityFilter&) {};
00170 void operator=(const vtkPolyDataConnectivityFilter&) {};
00171
00172
00173 void Execute();
00174
00175 int ColorRegions;
00176 int ExtractionMode;
00177 vtkIdList *Seeds;
00178 vtkIdList *SpecifiedRegionIds;
00179 vtkIntArray *RegionSizes;
00180
00181 float ClosestPoint[3];
00182
00183 int ScalarConnectivity;
00184 float ScalarRange[2];
00185
00186 void TraverseAndMark();
00187
00188 private:
00189
00190 vtkScalars *CellScalars;
00191 vtkIdList *NeighborCellPointIds;
00192 int *Visited;
00193 int *PointMap;
00194 vtkScalars *NewScalars;
00195 int RegionNumber;
00196 int PointNumber;
00197 int NumCellsInRegion;
00198 vtkScalars *InScalars;
00199 vtkPolyData *Mesh;
00200 vtkIdList *Wave;
00201 vtkIdList *Wave2;
00202 vtkIdList *PointIds;
00203 vtkIdList *CellIds;
00204 };
00205
00207 inline const char *vtkPolyDataConnectivityFilter::GetExtractionModeAsString(void)
00208 {
00209 if ( this->ExtractionMode == VTK_EXTRACT_POINT_SEEDED_REGIONS )
00210 {
00211 return "ExtractPointSeededRegions";
00212 }
00213 else if ( this->ExtractionMode == VTK_EXTRACT_CELL_SEEDED_REGIONS )
00214 {
00215 return "ExtractCellSeededRegions";
00216 }
00217 else if ( this->ExtractionMode == VTK_EXTRACT_SPECIFIED_REGIONS )
00218 {
00219 return "ExtractSpecifiedRegions";
00220 }
00221 else if ( this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS )
00222 {
00223 return "ExtractAllRegions";
00224 }
00225 else if ( this->ExtractionMode == VTK_EXTRACT_CLOSEST_POINT_REGION )
00226 {
00227 return "ExtractClosestPointRegion";
00228 }
00229 else
00230 {
00231 return "ExtractLargestRegion";
00232 }
00233 }
00234
00235
00236 #endif
00237
00238