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: 2003/09/10 14:28:29 $
00007   Version:   $Revision: 1.24 $
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 
00062 
00065   typedef TInputMesh InputMeshType;
00066   typedef TOutputMesh OutputMeshType;
00067   typedef typename TInputMesh::Pointer InputMeshPointer;
00068   typedef typename TOutputMesh::Pointer OutputMeshPointer;
00069   itkStaticConstMacro(PointDimension, unsigned int,TInputMesh::PointDimension);
00070   typedef typename TInputMesh::PointType InputMeshPointType;
00071   typedef typename TInputMesh::PointIdentifier InputMeshPointIdentifier;
00072   typedef typename TInputMesh::PointsContainerPointer 
00073   InputMeshPointsContainerPointer;
00074   typedef typename TInputMesh::CellsContainer InputMeshCellsContainer;
00075   typedef typename TInputMesh::CellsContainerPointer 
00076   InputMeshCellsContainerPointer;
00077   typedef typename TInputMesh::CellDataContainer InputMeshCellDataContainer;
00078   typedef typename TInputMesh::CellDataContainerPointer 
00079   InputMeshCellDataContainerPointer;
00080   typedef typename InputMeshType::PointsContainer::ConstIterator 
00081   PointsContainerConstIterator;
00082   typedef typename InputMeshType::CellsContainer::ConstIterator
00083   CellsContainerConstIterator;
00084   typedef typename InputMeshType::CellDataContainer::ConstIterator
00085   CellDataContainerConstIterator;
00086   typedef typename TInputMesh::CellAutoPointer InputMeshCellPointer;
00087   typedef typename TInputMesh::CellTraits::PointIdConstIterator 
00088   InputMeshPointIdConstIterator;
00089   typedef typename TInputMesh::CellLinksContainerPointer
00090   InputMeshCellLinksContainerPointer;
00091   typedef typename TInputMesh::PointCellLinksContainer
00092   InputMeshCellLinksContainer;
00093   typedef typename TInputMesh::CellIdentifier InputMeshCellIdentifier;
00095 
00099   itkNewMacro(Self);
00100 
00105   enum { PointSeededRegions = 0,
00106          CellSeededRegions = 1,
00107          SpecifiedRegions = 2,
00108          LargestRegion = 3,
00109          AllRegions = 4,
00110          ClosestPointRegion = 5 };
00111 
00118   itkSetMacro(ExtractionMode,int);
00119   itkGetMacro(ExtractionMode,int);
00120   void SetExtractionModeToPointSeededRegions ()
00121   {this->SetExtractionMode(Self::PointSeededRegions);}
00122   void SetExtractionModeToCellSeededRegions ()
00123   {this->SetExtractionMode(Self::CellSeededRegions);}
00124   void SetExtractionModeToSpecifiedRegions ()
00125   {this->SetExtractionMode(Self::SpecifiedRegions);}
00126   void SetExtractionModeToLargestRegion ()
00127   {this->SetExtractionMode(Self::LargestRegion);}
00128   void SetExtractionModeToAllRegions ()
00129   {this->SetExtractionMode(Self::AllRegions);}
00130   void SetExtractionModeToClosestPointRegion ()
00131   {this->SetExtractionMode(Self::ClosestPointRegion);}
00133 
00137   void InitializeSeedList()
00138   {this->Modified(); m_SeedList.clear();}
00139 
00143   void AddSeed(unsigned long id)
00144   {this->Modified(); m_SeedList.push_back(id);}
00145 
00149   void DeleteSeed(unsigned long id);
00150 
00154   void InitializeSpecifiedRegionList()
00155   {this->Modified(); m_RegionList.clear();}
00156 
00160   void AddSpecifiedRegion(unsigned long id)
00161   {this->Modified(); m_RegionList.push_back(id);}
00162 
00166   void DeleteSpecifiedRegion(unsigned long id);
00167 
00172   void SetClosestPoint(InputMeshPointType& p)
00173   {
00174     if ( m_ClosestPoint != p )
00175       {
00176       m_ClosestPoint = p;
00177       this->Modified();
00178       }
00179   }
00180   InputMeshPointType& GetClosestPoint(InputMeshPointType& p)
00181   {return m_ClosestPoint;}
00183 
00187   unsigned long GetNumberOfExtractedRegions();
00188 
00189 protected:
00190   ConnectedRegionsMeshFilter();
00191   virtual ~ConnectedRegionsMeshFilter() {}
00192   void PrintSelf(std::ostream& os, Indent indent) const;
00193 
00194   virtual void GenerateData();
00195   void PropagateConnectedWave();
00196 
00197 private:  
00198   ConnectedRegionsMeshFilter(const Self&); //purposely not implemented
00199   void operator=(const Self&); //purposely not implemented
00200 
00201   int                        m_ExtractionMode;
00202   InputMeshPointType         m_ClosestPoint;
00203   std::vector<unsigned long> m_SeedList;
00204   std::vector<unsigned long> m_RegionList;
00205   std::vector<unsigned long> m_RegionSizes;
00206   
00207   std::vector<long>          m_Visited;
00208   unsigned long              m_NumberOfCellsInRegion;
00209   unsigned long              m_RegionNumber;
00210   std::vector<unsigned long> *m_Wave;
00211   std::vector<unsigned long> *m_Wave2;
00212   
00213 }; // class declaration
00214 
00215 } // end namespace itk
00216 
00217 #ifndef ITK_MANUAL_INSTANTIATION
00218 #include "itkConnectedRegionsMeshFilter.txx"
00219 #endif
00220 
00221 #endif
00222 

Generated at Sun Sep 23 12:15:50 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000