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: 2004/10/04 20:50:58 $
00007   Version:   $Revision: 1.4 $
00008 
00009   Copyright (c) 2002 Insight 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 __Bio_Cellular_Aggregate_H
00018 #define __Bio_Cellular_Aggregate_H
00019 
00020 
00021 #include "itkBioCellularAggregateBase.h"
00022 #include "itkDefaultDynamicMeshTraits.h"
00023 #include "itkMesh.h"
00024 #include "itkImage.h"
00025 #include "itkBioCell.h"
00026 #include "itkPolygonCell.h"
00027 
00028 #include <iostream>
00029 #include <vector>
00030 
00031 
00032 
00033 namespace itk {
00034 
00035 namespace bio {
00036 
00042 template<unsigned int NSpaceDimension=3>
00043 class CellularAggregate : public CellularAggregateBase
00044 {
00045 public:
00047   typedef CellularAggregate      Self;
00048   typedef CellularAggregateBase  Superclass;
00049   typedef itk::SmartPointer<Self>        Pointer;
00050   typedef itk::SmartPointer<const Self>  ConstPointer;
00051 
00052   /*** Run-time type information (and related methods). */
00053   itkTypeMacro(CellularAggregate, CellularAggregateBase);
00054 
00056   itkNewMacro(Self);  
00057 
00058   itkStaticConstMacro( SpaceDimension, unsigned int, NSpaceDimension);
00059 
00060   /*** Type to be used for data associated with each point in the mesh. */
00061   typedef    Cell<NSpaceDimension>      BioCellType;
00062   typedef    BioCellType *              PointPixelType;
00063   typedef    double                     CellPixelType;
00064 
00065 
00067   typedef itk::DefaultDynamicMeshTraits<  
00068               PointPixelType,           // PixelType
00069               NSpaceDimension,           // Points Dimension
00070               NSpaceDimension,           // Max.Topological Dimension
00071               double,                   // Type for coordinates
00072               double,                   // Type for interpolation 
00073               CellPixelType             // Type for values in the cells  
00074               >  MeshTraits;
00075   
00077   typedef itk::Mesh<  PointPixelType,
00078                       NSpaceDimension,
00079                       MeshTraits  >               MeshType;
00080 
00082   typedef typename MeshType::Pointer                       MeshPointer;
00083   typedef typename MeshType::ConstPointer                  MeshConstPointer;
00084   typedef typename MeshType::PointType                     PointType;
00085   typedef typename BioCellType::VectorType                 VectorType;
00086 
00087 
00088   typedef typename MeshType::PointsContainer               PointsContainer;
00089   typedef typename MeshType::PointDataContainer            PointDataContainer;
00090   typedef typename MeshType::CellsContainer                VoronoiRegionsContainer;
00091   typedef typename PointsContainer::Iterator               PointsIterator;
00092   typedef typename PointDataContainer::Iterator            CellsIterator;
00093   typedef typename VoronoiRegionsContainer::Iterator       VoronoiIterator;
00094   typedef typename PointsContainer::ConstIterator          PointsConstIterator;
00095   typedef typename PointDataContainer::ConstIterator       CellsConstIterator;
00096   typedef typename VoronoiRegionsContainer::ConstIterator  VoronoiConstIterator;
00097   typedef typename MeshType::PointIdentifier               IdentifierType;
00098   typedef typename MeshType::CellAutoPointer               CellAutoPointer;
00099 
00101   typedef itk::CellInterface<  
00102                      typename MeshType::CellPixelType, 
00103                      typename MeshType::CellTraits >      CellInterfaceType;
00104   typedef itk::PolygonCell<  CellInterfaceType >          VoronoiRegionType;
00105   typedef typename VoronoiRegionType::SelfAutoPointer     VoronoiRegionAutoPointer;
00106 
00108   typedef float                                        ImagePixelType;
00109   typedef itk::Image<ImagePixelType, NSpaceDimension > SubstrateType;
00110   typedef typename SubstrateType::Pointer              SubstratePointer;
00111   typedef ImagePixelType                               SubstrateValueType;
00112   typedef std::vector< SubstratePointer >              SubstratesVector;
00113 
00114 public:
00115   unsigned int GetNumberOfCells(void) const;
00116  
00117   static unsigned int GetDimension() { return SpaceDimension; }
00118     
00119   void SetGrowthRadiusLimit( double value );
00120   void SetGrowthRadiusIncrement( double value );
00121   
00122   itkGetObjectMacro( Mesh, MeshType );
00123   itkGetConstObjectMacro( Mesh, MeshType );
00124 
00125   virtual void AdvanceTimeStep(void);
00126 
00127   virtual void SetEgg( BioCellType * cell, const PointType & position );
00128   virtual void Add( CellBase * cell );
00129   virtual void Add( CellBase * cell, const VectorType & perturbation );
00130   virtual void Add( CellBase * cellA, CellBase * cellB, double perturbationLength );
00131   virtual void Remove( CellBase * cell );
00132   
00133   virtual void GetVoronoi( unsigned long int cellId, VoronoiRegionAutoPointer & ) const;
00134 
00135   void DumpContent( std::ostream & os ) const;
00136 
00137   virtual void AddSubstrate( SubstrateType * substrate );
00138   virtual SubstratesVector & GetSubstrates( void );
00139   virtual SubstrateValueType GetSubstrateValue( unsigned long int cellId,
00140                                                 unsigned int substrateId ) const;
00141 
00142   virtual void KillAll(void);
00143 
00144 
00145 protected:
00146   CellularAggregate();
00147   virtual ~CellularAggregate();
00148   CellularAggregate( const Self & );
00149   void operator=(const Self&);
00150   void PrintSelf(std::ostream& os, itk::Indent indent) const;
00151 
00152   virtual void ComputeForces(void);
00153   virtual void UpdatePositions(void);
00154   virtual void ComputeClosestPoints(void);
00155   virtual void ClearForces(void);
00156   
00157 private:
00158  
00159   MeshPointer           m_Mesh;
00160   SubstratesVector      m_Substrates;
00161   double                m_FrictionForce;
00162   unsigned long         m_Iteration;
00163   unsigned long         m_ClosestPointComputationInterval;
00164 
00165 };
00166 
00167 } // end namespace bio
00168 
00169 } // end namespace itk
00170 
00171 
00172 #ifndef ITK_MANUAL_INSTANTIATION
00173 #include "itkBioCellularAggregate.txx"
00174 #endif
00175 
00176 #endif
00177 

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