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

itkBioCellularAggregate.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkBioCellularAggregate.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-05-12 17:26:20 $
00007   Version:   $Revision: 1.9 $
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      This software is distributed WITHOUT ANY WARRANTY; without even
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkBioCellularAggregate_h
00018 #define __itkBioCellularAggregate_h
00019 
00020 #include "itkBioCellularAggregateBase.h"
00021 #include "itkDefaultDynamicMeshTraits.h"
00022 #include "itkMesh.h"
00023 #include "itkImage.h"
00024 #include "itkBioCell.h"
00025 #include "itkPolygonCell.h"
00026 
00027 #include <iostream>
00028 #include <vector>
00029 
00030 
00031 namespace itk {
00032 
00033 namespace bio {
00034 
00040 template<unsigned int NSpaceDimension=3>
00041 class ITK_EXPORT CellularAggregate : public CellularAggregateBase
00042 {
00043 public:
00045   typedef CellularAggregate              Self;
00046   typedef CellularAggregateBase          Superclass;
00047   typedef SmartPointer<Self>             Pointer;
00048   typedef SmartPointer<const Self>       ConstPointer;
00049 
00050 /*** Run-time type information (and related methods). */
00051   itkTypeMacro(BioCellularAggregate, CellularAggregateBase);
00052 
00054   itkNewMacro(Self);  
00055 
00056   itkStaticConstMacro( SpaceDimension, unsigned int, NSpaceDimension);
00057 
00058 /*** Type to be used for data associated with each point in the mesh. */
00059   typedef    Cell<NSpaceDimension>      BioCellType;
00060   typedef    BioCellType *              PointPixelType;
00061   typedef    double                     CellPixelType;
00062 
00063 
00065   typedef DefaultDynamicMeshTraits<  
00066               PointPixelType,           // PixelType
00067               NSpaceDimension,           // Points Dimension
00068               NSpaceDimension,           // Max.Topological Dimension
00069               double,                   // Type for coordinates
00070               double,                   // Type for interpolation 
00071               CellPixelType             // Type for values in the cells  
00072               >  MeshTraits;
00073 
00075   typedef Mesh<  PointPixelType,
00076                       NSpaceDimension,
00077                       MeshTraits  >               MeshType;
00078 
00080   typedef typename MeshType::Pointer                       MeshPointer;
00081   typedef typename MeshType::ConstPointer                  MeshConstPointer;
00082   typedef typename MeshType::PointType                     PointType;
00083   typedef typename BioCellType::VectorType                 VectorType;
00084 
00085 
00086   typedef typename MeshType::PointsContainer               PointsContainer;
00087   typedef typename MeshType::PointDataContainer            PointDataContainer;
00088   typedef typename MeshType::CellsContainer                VoronoiRegionsContainer;
00089   typedef typename PointsContainer::Iterator               PointsIterator;
00090   typedef typename PointDataContainer::Iterator            CellsIterator;
00091   typedef typename VoronoiRegionsContainer::Iterator       VoronoiIterator;
00092   typedef typename PointsContainer::ConstIterator          PointsConstIterator;
00093   typedef typename PointDataContainer::ConstIterator       CellsConstIterator;
00094   typedef typename VoronoiRegionsContainer::ConstIterator  VoronoiConstIterator;
00095   typedef typename MeshType::PointIdentifier               IdentifierType;
00096   typedef typename MeshType::CellAutoPointer               CellAutoPointer;
00097 
00099   typedef CellInterface<  
00100                      typename MeshType::CellPixelType, 
00101                      typename MeshType::CellTraits >      CellInterfaceType;
00102   typedef PolygonCell<  CellInterfaceType >               VoronoiRegionType;
00103   typedef typename VoronoiRegionType::SelfAutoPointer     VoronoiRegionAutoPointer;
00104 
00106   typedef float                                        ImagePixelType;
00107   typedef Image<ImagePixelType, NSpaceDimension >      SubstrateType;
00108   typedef typename SubstrateType::Pointer              SubstratePointer;
00109   typedef ImagePixelType                               SubstrateValueType;
00110   typedef std::vector< SubstratePointer >              SubstratesVector;
00111 
00112 public:
00113   unsigned int GetNumberOfCells(void) const;
00114  
00115   static unsigned int GetDimension() { return SpaceDimension; }
00116     
00117   void SetGrowthRadiusLimit( double value );
00118   void SetGrowthRadiusIncrement( double value );
00119   
00120   itkGetObjectMacro( Mesh, MeshType );
00121   itkGetConstObjectMacro( Mesh, MeshType );
00122 
00123   virtual void AdvanceTimeStep(void);
00124 
00125   virtual void SetEgg( BioCellType * cell, const PointType & position );
00126   virtual void Add( CellBase * cell );
00127   virtual void Add( CellBase * cell, const VectorType & perturbation );
00128   virtual void Add( CellBase * cellA, CellBase * cellB, double perturbationLength );
00129   virtual void Remove( CellBase * cell );
00130   
00131   virtual void GetVoronoi( unsigned long int cellId, VoronoiRegionAutoPointer & ) const;
00132 
00133   void DumpContent( std::ostream & os ) const;
00134 
00135   virtual void AddSubstrate( SubstrateType * substrate );
00136   virtual SubstratesVector & GetSubstrates( void );
00137   virtual SubstrateValueType GetSubstrateValue( unsigned long int cellId,
00138                                                 unsigned int substrateId ) const;
00139 
00140   virtual void KillAll(void);
00141 
00142 
00143 protected:
00144   CellularAggregate();
00145   virtual ~CellularAggregate();
00146   CellularAggregate( const Self & );
00147   void operator=(const Self&);
00148   void PrintSelf(std::ostream& os, Indent indent) const;
00149 
00150   virtual void ComputeForces(void);
00151   virtual void UpdatePositions(void);
00152   virtual void ComputeClosestPoints(void);
00153   virtual void ClearForces(void);
00154   
00155 private:
00156  
00157   MeshPointer           m_Mesh;
00158   SubstratesVector      m_Substrates;
00159   double                m_FrictionForce;
00160   unsigned long         m_Iteration;
00161   unsigned long         m_ClosestPointComputationInterval;
00162 
00163 };
00164 
00165 } // end namespace bio
00166 
00167 } // end namespace itk
00168 
00169 
00170 #ifndef ITK_MANUAL_INSTANTIATION
00171 #include "itkBioCellularAggregate.txx"
00172 #endif
00173 
00174 #endif
00175 

Generated at Tue Sep 15 02:21:26 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000