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: 2009-09-17 11:04:00 $
00007   Version:   $Revision: 1.28 $
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::ConstPointer        InputMeshConstPointer;
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::PointsContainerConstPointer 
00080                                                    InputMeshPointsContainerConstPointer;
00081   typedef typename TInputMesh::CellsContainer      InputMeshCellsContainer;
00082   typedef typename TInputMesh::CellsContainerPointer 
00083                                                    InputMeshCellsContainerPointer;
00084   typedef typename TInputMesh::CellsContainerConstPointer 
00085                                                    InputMeshCellsContainerConstPointer;
00086   typedef typename TInputMesh::CellDataContainer   InputMeshCellDataContainer;
00087   typedef typename TInputMesh::CellDataContainerPointer 
00088                                                    InputMeshCellDataContainerPointer;
00089   typedef typename TInputMesh::CellDataContainerConstPointer 
00090                                                    InputMeshCellDataContainerConstPointer;
00091   typedef typename InputMeshType::PointsContainer::ConstIterator 
00092                                                    PointsContainerConstIterator;
00093   typedef typename InputMeshType::CellsContainer::ConstIterator
00094                                                    CellsContainerConstIterator;
00095   typedef typename InputMeshType::CellDataContainer::ConstIterator
00096                                                    CellDataContainerConstIterator;
00097   typedef typename TInputMesh::CellAutoPointer     InputMeshCellPointer;
00098   typedef typename TInputMesh::CellTraits::PointIdConstIterator 
00099                                                    InputMeshPointIdConstIterator;
00100   typedef typename TInputMesh::CellLinksContainerConstPointer
00101                                                    InputMeshCellLinksContainerConstPointer;
00102   typedef typename TInputMesh::PointCellLinksContainer
00103                                                    InputMeshCellLinksContainer;
00104   typedef typename TInputMesh::CellIdentifier      InputMeshCellIdentifier;
00105 
00110   enum { PointSeededRegions = 0,
00111          CellSeededRegions = 1,
00112          SpecifiedRegions = 2,
00113          LargestRegion = 3,
00114          AllRegions = 4,
00115          ClosestPointRegion = 5 };
00116 
00123   itkSetMacro( ExtractionMode, int );
00124   itkGetConstMacro( ExtractionMode, int );
00126 
00127   void SetExtractionModeToPointSeededRegions( void )
00128     {
00129     this->SetExtractionMode( Self::PointSeededRegions );
00130     }
00131 
00132   void SetExtractionModeToCellSeededRegions( void )
00133     {
00134     this->SetExtractionMode( Self::CellSeededRegions );
00135     }
00136 
00137   void SetExtractionModeToSpecifiedRegions( void )
00138     {
00139     this->SetExtractionMode( Self::SpecifiedRegions );
00140     }
00141 
00142   void SetExtractionModeToLargestRegion( void )
00143     {
00144     this->SetExtractionMode( Self::LargestRegion );
00145     }
00146 
00147   void SetExtractionModeToAllRegions( void )
00148     {
00149     this->SetExtractionMode( Self::AllRegions );
00150     }
00151 
00152   void SetExtractionModeToClosestPointRegion( void )
00153     {
00154     this->SetExtractionMode( Self::ClosestPointRegion );
00155     }
00156 
00160   void InitializeSeedList( void )
00161     {
00162     this->Modified();
00163     m_SeedList.clear();
00164     }
00166 
00170   void AddSeed( unsigned long id )
00171     {
00172     this->Modified();
00173     m_SeedList.push_back(id);
00174     }
00176 
00180   void DeleteSeed( unsigned long id );
00181 
00185   void InitializeSpecifiedRegionList( void )
00186     {
00187     this->Modified();
00188     m_RegionList.clear();
00189     }
00191 
00195   void AddSpecifiedRegion( unsigned long id )
00196     {
00197     this->Modified();
00198     m_RegionList.push_back(id);
00199     }
00201 
00205   void DeleteSpecifiedRegion( unsigned long id );
00206 
00211   void SetClosestPoint( InputMeshPointType& p )
00212     {
00213     if( m_ClosestPoint != p )
00214       {
00215       m_ClosestPoint = p;
00216       this->Modified();
00217       }
00218     }
00220 
00221   InputMeshPointType& GetClosestPoint( InputMeshPointType& p )
00222     {
00223     return m_ClosestPoint;
00224     }
00225 
00229   unsigned long GetNumberOfExtractedRegions()
00230     {
00231     return m_RegionList.size();
00232     }
00233 
00234 protected:
00235 
00236   ConnectedRegionsMeshFilter( void );
00237   virtual ~ConnectedRegionsMeshFilter( void ) {}
00238 
00239   void PrintSelf( std::ostream& os, Indent indent ) const;
00240 
00241   virtual void GenerateData( void );
00242 
00243   void PropagateConnectedWave( void );
00244 
00245 private:  
00246 
00247   ConnectedRegionsMeshFilter( const Self& ); //purposely not implemented
00248   void operator=( const Self& ); //purposely not implemented
00249 
00250   int                         m_ExtractionMode;
00251   InputMeshPointType          m_ClosestPoint;
00252   std::vector<unsigned long>  m_SeedList;
00253   std::vector<unsigned long>  m_RegionList;
00254   std::vector<unsigned long>  m_RegionSizes;
00255   
00256   std::vector<long>           m_Visited;
00257   unsigned long               m_NumberOfCellsInRegion;
00258   unsigned long               m_RegionNumber;
00259   std::vector<unsigned long> *m_Wave;
00260   std::vector<unsigned long> *m_Wave2;
00261   
00262 }; // class declaration
00263 
00264 } // end namespace itk
00265 
00266 #ifndef ITK_MANUAL_INSTANTIATION
00267 #include "itkConnectedRegionsMeshFilter.txx"
00268 #endif
00269 
00270 #endif
00271 

Generated at Mon Jul 12 2010 18:06:46 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000