VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Filters/Core/vtkPolyDataConnectivityFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkPolyDataConnectivityFilter.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00052 #ifndef vtkPolyDataConnectivityFilter_h
00053 #define vtkPolyDataConnectivityFilter_h
00054 
00055 #include "vtkFiltersCoreModule.h" // For export macro
00056 #include "vtkPolyDataAlgorithm.h"
00057 
00058 #define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
00059 #define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
00060 #define VTK_EXTRACT_SPECIFIED_REGIONS 3
00061 #define VTK_EXTRACT_LARGEST_REGION 4
00062 #define VTK_EXTRACT_ALL_REGIONS 5
00063 #define VTK_EXTRACT_CLOSEST_POINT_REGION 6
00064 
00065 class vtkDataArray;
00066 class vtkIdList;
00067 class vtkIdTypeArray;
00068 
00069 class VTKFILTERSCORE_EXPORT vtkPolyDataConnectivityFilter : public vtkPolyDataAlgorithm
00070 {
00071 public:
00072   vtkTypeMacro(vtkPolyDataConnectivityFilter,vtkPolyDataAlgorithm);
00073   void PrintSelf(ostream& os, vtkIndent indent);
00074 
00076 
00077   vtkGetObjectMacro(RegionSizes,vtkIdTypeArray);
00079 
00081   static vtkPolyDataConnectivityFilter *New();
00082 
00084 
00087   vtkSetMacro(ScalarConnectivity,int);
00088   vtkGetMacro(ScalarConnectivity,int);
00089   vtkBooleanMacro(ScalarConnectivity,int);
00091 
00093 
00100   vtkSetMacro(FullScalarConnectivity,int);
00101   vtkGetMacro(FullScalarConnectivity,int);
00102   vtkBooleanMacro(FullScalarConnectivity,int);
00104 
00106 
00108   vtkSetVector2Macro(ScalarRange,double);
00109   vtkGetVector2Macro(ScalarRange,double);
00111 
00113 
00114   vtkSetClampMacro(ExtractionMode,int,
00115                    VTK_EXTRACT_POINT_SEEDED_REGIONS,
00116                    VTK_EXTRACT_CLOSEST_POINT_REGION);
00117   vtkGetMacro(ExtractionMode,int);
00118   void SetExtractionModeToPointSeededRegions()
00119     {this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);};
00120   void SetExtractionModeToCellSeededRegions()
00121     {this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);};
00122   void SetExtractionModeToLargestRegion()
00123     {this->SetExtractionMode(VTK_EXTRACT_LARGEST_REGION);};
00124   void SetExtractionModeToSpecifiedRegions()
00125     {this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);};
00126   void SetExtractionModeToClosestPointRegion()
00127     {this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);};
00128   void SetExtractionModeToAllRegions()
00129     {this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS);};
00130   const char *GetExtractionModeAsString();
00132 
00134   void InitializeSeedList();
00135 
00137   void AddSeed(int id);
00138 
00140   void DeleteSeed(int id);
00141 
00143   void InitializeSpecifiedRegionList();
00144 
00146   void AddSpecifiedRegion(int id);
00147 
00149   void DeleteSpecifiedRegion(int id);
00150 
00152 
00154   vtkSetVector3Macro(ClosestPoint,double);
00155   vtkGetVectorMacro(ClosestPoint,double,3);
00157 
00159   int GetNumberOfExtractedRegions();
00160 
00162 
00163   vtkSetMacro(ColorRegions,int);
00164   vtkGetMacro(ColorRegions,int);
00165   vtkBooleanMacro(ColorRegions,int);
00167 
00169 
00171   vtkSetMacro( MarkVisitedPointIds, int );
00172   vtkGetMacro( MarkVisitedPointIds, int );
00173   vtkBooleanMacro( MarkVisitedPointIds, int );
00175 
00177 
00179   vtkGetObjectMacro( VisitedPointIds, vtkIdList );
00181 
00183 
00186   vtkSetMacro(OutputPointsPrecision,int);
00187   vtkGetMacro(OutputPointsPrecision,int);
00189 
00190 protected:
00191   vtkPolyDataConnectivityFilter();
00192   ~vtkPolyDataConnectivityFilter();
00193 
00194   // Usual data generation method
00195   int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00196 
00197   int ColorRegions; //boolean turns on/off scalar gen for separate regions
00198   int ExtractionMode; //how to extract regions
00199   vtkIdList *Seeds; //id's of points or cells used to seed regions
00200   vtkIdList *SpecifiedRegionIds; //regions specified for extraction
00201   vtkIdTypeArray *RegionSizes; //size (in cells) of each region extracted
00202 
00203   double ClosestPoint[3];
00204 
00205   int ScalarConnectivity;
00206   int FullScalarConnectivity;
00207 
00208   // Does this cell qualify as being scalar connected ?
00209   int IsScalarConnected( vtkIdType cellId );
00210 
00211   double ScalarRange[2];
00212 
00213   void TraverseAndMark();
00214 
00215   // used to support algorithm execution
00216   vtkDataArray *CellScalars;
00217   vtkIdList *NeighborCellPointIds;
00218   vtkIdType *Visited;
00219   vtkIdType *PointMap;
00220   vtkDataArray *NewScalars;
00221   vtkIdType RegionNumber;
00222   vtkIdType PointNumber;
00223   vtkIdType NumCellsInRegion;
00224   vtkDataArray *InScalars;
00225   vtkPolyData *Mesh;
00226   vtkIdList *Wave;
00227   vtkIdList *Wave2;
00228   vtkIdList *PointIds;
00229   vtkIdList *CellIds;
00230   vtkIdList *VisitedPointIds;
00231 
00232   int MarkVisitedPointIds;
00233   int OutputPointsPrecision;
00234 
00235 private:
00236   vtkPolyDataConnectivityFilter(const vtkPolyDataConnectivityFilter&);  // Not implemented.
00237   void operator=(const vtkPolyDataConnectivityFilter&);  // Not implemented.
00238 };
00239 
00241 
00242 inline const char *vtkPolyDataConnectivityFilter::GetExtractionModeAsString(void)
00243 {
00244   if ( this->ExtractionMode == VTK_EXTRACT_POINT_SEEDED_REGIONS )
00245     {
00246     return "ExtractPointSeededRegions";
00247     }
00248   else if ( this->ExtractionMode == VTK_EXTRACT_CELL_SEEDED_REGIONS )
00249     {
00250     return "ExtractCellSeededRegions";
00251     }
00252   else if ( this->ExtractionMode == VTK_EXTRACT_SPECIFIED_REGIONS )
00253     {
00254     return "ExtractSpecifiedRegions";
00255     }
00256   else if ( this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS )
00257     {
00258     return "ExtractAllRegions";
00259     }
00260   else if ( this->ExtractionMode == VTK_EXTRACT_CLOSEST_POINT_REGION )
00261     {
00262     return "ExtractClosestPointRegion";
00263     }
00264   else
00265     {
00266     return "ExtractLargestRegion";
00267     }
00268 }
00270 
00271 
00272 #endif