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);}
00132 
00136   void InitializeSeedList()
00137   {this->Modified(); m_SeedList.clear();}
00138 
00142   void AddSeed(unsigned long id)
00143   {this->Modified(); m_SeedList.push_back(id);}
00144 
00148   void DeleteSeed(unsigned long id);
00149 
00153   void InitializeSpecifiedRegionList()
00154   {this->Modified(); m_RegionList.clear();}
00155 
00159   void AddSpecifiedRegion(unsigned long id)
00160   {this->Modified(); m_RegionList.push_back(id);}
00161 
00165   void DeleteSpecifiedRegion(unsigned long id);
00166 
00171   void SetClosestPoint(InputMeshPointType& p)
00172   {
00173     if ( m_ClosestPoint != p )
00174       {
00175       m_ClosestPoint = p;
00176       this->Modified();
00177       }
00178   }
00179   InputMeshPointType& GetClosestPoint(InputMeshPointType& p)
00180   {return m_ClosestPoint;}
00181 
00185   unsigned long GetNumberOfExtractedRegions();
00186 
00187 protected:
00188   ConnectedRegionsMeshFilter();
00189   virtual ~ConnectedRegionsMeshFilter() {}
00190   void PrintSelf(std::ostream& os, Indent indent) const;
00191 
00192   virtual void GenerateData();
00193   void PropagateConnectedWave();
00194 
00195 private:  
00196   ConnectedRegionsMeshFilter(const Self&); //purposely not implemented
00197   void operator=(const Self&); //purposely not implemented
00198 
00199   int                        m_ExtractionMode;
00200   InputMeshPointType         m_ClosestPoint;
00201   std::vector<unsigned long> m_SeedList;
00202   std::vector<unsigned long> m_RegionList;
00203   std::vector<unsigned long> m_RegionSizes;
00204   
00205   std::vector<long>          m_Visited;
00206   unsigned long              m_NumberOfCellsInRegion;
00207   unsigned long              m_RegionNumber;
00208   std::vector<unsigned long> *m_Wave;
00209   std::vector<unsigned long> *m_Wave2;
00210   
00211 }; // class declaration
00212 
00213 } // end namespace itk
00214 
00215 #ifndef ITK_MANUAL_INSTANTIATION
00216 #include "itkConnectedRegionsMeshFilter.txx"
00217 #endif
00218 
00219 #endif

Generated at Wed May 24 22:58:10 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000