Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkConnectedRegionsMeshFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkConnectedRegionsMeshFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-10-23 16:15:23 $
00007   Version:   $Revision: 1.26 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012   Portions of this code are covered under the VTK copyright.
00013   See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
00014 
00015      This software is distributed WITHOUT ANY WARRANTY; without even 
00016      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00017      PURPOSE.  See the above copyright notices for more information.
00018 
00019 =========================================================================*/
00020 #ifndef __itkConnectedRegionsMeshFilter_h
00021 #define __itkConnectedRegionsMeshFilter_h
00022 
00023 #include "itkMeshToMeshFilter.h"
00024 
00025 namespace itk
00026 {
00027   
00040 template <class TInputMesh, class TOutputMesh>
00041 class ITK_EXPORT ConnectedRegionsMeshFilter 
00042 : public MeshToMeshFilter<TInputMesh, TOutputMesh> 
00043 {
00044 public:
00048   typedef ConnectedRegionsMeshFilter               Self;
00049 
00053   typedef MeshToMeshFilter<TInputMesh, TOutputMesh> Superclass;
00054 
00058   typedef SmartPointer<Self>                       Pointer;
00059   typedef SmartPointer<const Self>                 ConstPointer;
00060 
00064   itkNewMacro( Self );
00065 
00069   typedef TInputMesh                               InputMeshType;
00070   typedef TOutputMesh                              OutputMeshType;
00071   typedef typename TInputMesh::Pointer             InputMeshPointer;
00072   typedef typename TOutputMesh::Pointer            OutputMeshPointer;
00073 
00074   itkStaticConstMacro( PointDimension, unsigned int,
00075                        TInputMesh::PointDimension );
00076 
00077   typedef typename TInputMesh::PointType           InputMeshPointType;
00078   typedef typename TInputMesh::PointIdentifier     InputMeshPointIdentifier;
00079   typedef typename TInputMesh::PointsContainerPointer 
00080                                                    InputMeshPointsContainerPointer;
00081   typedef typename TInputMesh::CellsContainer      InputMeshCellsContainer;
00082   typedef typename TInputMesh::CellsContainerPointer 
00083                                                    InputMeshCellsContainerPointer;
00084   typedef typename TInputMesh::CellDataContainer   InputMeshCellDataContainer;
00085   typedef typename TInputMesh::CellDataContainerPointer 
00086                                                    InputMeshCellDataContainerPointer;
00087   typedef typename InputMeshType::PointsContainer::ConstIterator 
00088                                                    PointsContainerConstIterator;
00089   typedef typename InputMeshType::CellsContainer::ConstIterator
00090                                                    CellsContainerConstIterator;
00091   typedef typename InputMeshType::CellDataContainer::ConstIterator
00092                                                    CellDataContainerConstIterator;
00093   typedef typename TInputMesh::CellAutoPointer     InputMeshCellPointer;
00094   typedef typename TInputMesh::CellTraits::PointIdConstIterator 
00095                                                    InputMeshPointIdConstIterator;
00096   typedef typename TInputMesh::CellLinksContainerPointer
00097                                                    InputMeshCellLinksContainerPointer;
00098   typedef typename TInputMesh::PointCellLinksContainer
00099                                                    InputMeshCellLinksContainer;
00100   typedef typename TInputMesh::CellIdentifier      InputMeshCellIdentifier;
00101 
00106   enum { PointSeededRegions = 0,
00107          CellSeededRegions = 1,
00108          SpecifiedRegions = 2,
00109          LargestRegion = 3,
00110          AllRegions = 4,
00111          ClosestPointRegion = 5 };
00112 
00119   itkSetMacro( ExtractionMode, int );
00120   itkGetMacro( ExtractionMode, int );
00122 
00123   void SetExtractionModeToPointSeededRegions( void )
00124     {
00125     this->SetExtractionMode( Self::PointSeededRegions );
00126     }
00127 
00128   void SetExtractionModeToCellSeededRegions( void )
00129     {
00130     this->SetExtractionMode( Self::CellSeededRegions );
00131     }
00132 
00133   void SetExtractionModeToSpecifiedRegions( void )
00134     {
00135     this->SetExtractionMode( Self::SpecifiedRegions );
00136     }
00137 
00138   void SetExtractionModeToLargestRegion( void )
00139     {
00140     this->SetExtractionMode( Self::LargestRegion );
00141     }
00142 
00143   void SetExtractionModeToAllRegions( void )
00144     {
00145     this->SetExtractionMode( Self::AllRegions );
00146     }
00147 
00148   void SetExtractionModeToClosestPointRegion( void )
00149     {
00150     this->SetExtractionMode( Self::ClosestPointRegion );
00151     }
00152 
00156   void InitializeSeedList( void )
00157     {
00158     this->Modified();
00159     m_SeedList.clear();
00160     }
00162 
00166   void AddSeed( unsigned long id )
00167     {
00168     this->Modified();
00169     m_SeedList.push_back(id);
00170     }
00172 
00176   void DeleteSeed( unsigned long id );
00177 
00181   void InitializeSpecifiedRegionList( void )
00182     {
00183     this->Modified();
00184     m_RegionList.clear();
00185     }
00187 
00191   void AddSpecifiedRegion( unsigned long id )
00192     {
00193     this->Modified();
00194     m_RegionList.push_back(id);
00195     }
00197 
00201   void DeleteSpecifiedRegion( unsigned long id );
00202 
00207   void SetClosestPoint( InputMeshPointType& p )
00208     {
00209     if( m_ClosestPoint != p )
00210       {
00211       m_ClosestPoint = p;
00212       this->Modified();
00213       }
00214     }
00216 
00217   InputMeshPointType& GetClosestPoint( InputMeshPointType& p )
00218     {
00219     return m_ClosestPoint;
00220     }
00221 
00225   unsigned long GetNumberOfExtractedRegions()
00226     {
00227     return m_RegionList.size();
00228     }
00229 
00230 protected:
00231 
00232   ConnectedRegionsMeshFilter( void );
00233   virtual ~ConnectedRegionsMeshFilter( void ) {}
00234 
00235   void PrintSelf( std::ostream& os, Indent indent ) const;
00236 
00237   virtual void GenerateData( void );
00238 
00239   void PropagateConnectedWave( void );
00240 
00241 private:  
00242 
00243   ConnectedRegionsMeshFilter( const Self& ); //purposely not implemented
00244   void operator=( const Self& ); //purposely not implemented
00245 
00246   int                         m_ExtractionMode;
00247   InputMeshPointType          m_ClosestPoint;
00248   std::vector<unsigned long>  m_SeedList;
00249   std::vector<unsigned long>  m_RegionList;
00250   std::vector<unsigned long>  m_RegionSizes;
00251   
00252   std::vector<long>           m_Visited;
00253   unsigned long               m_NumberOfCellsInRegion;
00254   unsigned long               m_RegionNumber;
00255   std::vector<unsigned long> *m_Wave;
00256   std::vector<unsigned long> *m_Wave2;
00257   
00258 }; // class declaration
00259 
00260 } // end namespace itk
00261 
00262 #ifndef ITK_MANUAL_INSTANTIATION
00263 #include "itkConnectedRegionsMeshFilter.txx"
00264 #endif
00265 
00266 #endif
00267 

Generated at Wed Nov 5 20:56:47 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000