00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00046 #ifndef __vtkPolyDataConnectivityFilter_h
00047 #define __vtkPolyDataConnectivityFilter_h
00048
00049 #include "vtkPolyDataAlgorithm.h"
00050
00051 #define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
00052 #define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
00053 #define VTK_EXTRACT_SPECIFIED_REGIONS 3
00054 #define VTK_EXTRACT_LARGEST_REGION 4
00055 #define VTK_EXTRACT_ALL_REGIONS 5
00056 #define VTK_EXTRACT_CLOSEST_POINT_REGION 6
00057
00058 class vtkDataArray;
00059 class vtkIdList;
00060 class vtkIdTypeArray;
00061
00062 class VTK_GRAPHICS_EXPORT vtkPolyDataConnectivityFilter : public vtkPolyDataAlgorithm
00063 {
00064 public:
00065 vtkTypeRevisionMacro(vtkPolyDataConnectivityFilter,vtkPolyDataAlgorithm);
00066 void PrintSelf(ostream& os, vtkIndent indent);
00067
00069 static vtkPolyDataConnectivityFilter *New();
00070
00072
00075 vtkSetMacro(ScalarConnectivity,int);
00076 vtkGetMacro(ScalarConnectivity,int);
00077 vtkBooleanMacro(ScalarConnectivity,int);
00079
00081
00083 vtkSetVector2Macro(ScalarRange,double);
00084 vtkGetVector2Macro(ScalarRange,double);
00086
00088
00089 vtkSetClampMacro(ExtractionMode,int,
00090 VTK_EXTRACT_POINT_SEEDED_REGIONS,
00091 VTK_EXTRACT_CLOSEST_POINT_REGION);
00092 vtkGetMacro(ExtractionMode,int);
00093 void SetExtractionModeToPointSeededRegions()
00094 {this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);};
00095 void SetExtractionModeToCellSeededRegions()
00096 {this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);};
00097 void SetExtractionModeToLargestRegion()
00098 {this->SetExtractionMode(VTK_EXTRACT_LARGEST_REGION);};
00099 void SetExtractionModeToSpecifiedRegions()
00100 {this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);};
00101 void SetExtractionModeToClosestPointRegion()
00102 {this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);};
00103 void SetExtractionModeToAllRegions()
00104 {this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS);};
00105 const char *GetExtractionModeAsString();
00107
00109 void InitializeSeedList();
00110
00112 void AddSeed(int id);
00113
00115 void DeleteSeed(int id);
00116
00118 void InitializeSpecifiedRegionList();
00119
00121 void AddSpecifiedRegion(int id);
00122
00124 void DeleteSpecifiedRegion(int id);
00125
00127
00129 vtkSetVector3Macro(ClosestPoint,double);
00130 vtkGetVectorMacro(ClosestPoint,double,3);
00132
00134 int GetNumberOfExtractedRegions();
00135
00137
00138 vtkSetMacro(ColorRegions,int);
00139 vtkGetMacro(ColorRegions,int);
00140 vtkBooleanMacro(ColorRegions,int);
00142
00143 protected:
00144 vtkPolyDataConnectivityFilter();
00145 ~vtkPolyDataConnectivityFilter();
00146
00147
00148 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00149
00150 int ColorRegions;
00151 int ExtractionMode;
00152 vtkIdList *Seeds;
00153 vtkIdList *SpecifiedRegionIds;
00154 vtkIdTypeArray *RegionSizes;
00155
00156 double ClosestPoint[3];
00157
00158 int ScalarConnectivity;
00159 double ScalarRange[2];
00160
00161 void TraverseAndMark();
00162
00163 private:
00164
00165 vtkDataArray *CellScalars;
00166 vtkIdList *NeighborCellPointIds;
00167 vtkIdType *Visited;
00168 vtkIdType *PointMap;
00169 vtkDataArray *NewScalars;
00170 vtkIdType RegionNumber;
00171 vtkIdType PointNumber;
00172 vtkIdType NumCellsInRegion;
00173 vtkDataArray *InScalars;
00174 vtkPolyData *Mesh;
00175 vtkIdList *Wave;
00176 vtkIdList *Wave2;
00177 vtkIdList *PointIds;
00178 vtkIdList *CellIds;
00179 private:
00180 vtkPolyDataConnectivityFilter(const vtkPolyDataConnectivityFilter&);
00181 void operator=(const vtkPolyDataConnectivityFilter&);
00182 };
00183
00185 inline const char *vtkPolyDataConnectivityFilter::GetExtractionModeAsString(void)
00186 {
00187 if ( this->ExtractionMode == VTK_EXTRACT_POINT_SEEDED_REGIONS )
00188 {
00189 return "ExtractPointSeededRegions";
00190 }
00191 else if ( this->ExtractionMode == VTK_EXTRACT_CELL_SEEDED_REGIONS )
00192 {
00193 return "ExtractCellSeededRegions";
00194 }
00195 else if ( this->ExtractionMode == VTK_EXTRACT_SPECIFIED_REGIONS )
00196 {
00197 return "ExtractSpecifiedRegions";
00198 }
00199 else if ( this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS )
00200 {
00201 return "ExtractAllRegions";
00202 }
00203 else if ( this->ExtractionMode == VTK_EXTRACT_CLOSEST_POINT_REGION )
00204 {
00205 return "ExtractClosestPointRegion";
00206 }
00207 else
00208 {
00209 return "ExtractLargestRegion";
00210 }
00211 }
00212
00213
00214 #endif