00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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 CellularAggregate : public CellularAggregateBase
00042 {
00043 public:
00045 typedef CellularAggregate Self;
00046 typedef CellularAggregateBase Superclass;
00047 typedef itk::SmartPointer<Self> Pointer;
00048 typedef itk::SmartPointer<const Self> ConstPointer;
00049
00050
00051 itkTypeMacro(CellularAggregate, CellularAggregateBase);
00052
00054 itkNewMacro(Self);
00055
00056 itkStaticConstMacro( SpaceDimension, unsigned int, NSpaceDimension);
00057
00058
00059 typedef Cell<NSpaceDimension> BioCellType;
00060 typedef BioCellType * PointPixelType;
00061 typedef double CellPixelType;
00062
00063
00065 typedef itk::DefaultDynamicMeshTraits<
00066 PointPixelType,
00067 NSpaceDimension,
00068 NSpaceDimension,
00069 double,
00070 double,
00071 CellPixelType
00072 > MeshTraits;
00073
00075 typedef itk::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 itk::CellInterface<
00100 typename MeshType::CellPixelType,
00101 typename MeshType::CellTraits > CellInterfaceType;
00102 typedef itk::PolygonCell< CellInterfaceType > VoronoiRegionType;
00103 typedef typename VoronoiRegionType::SelfAutoPointer VoronoiRegionAutoPointer;
00104
00106 typedef float ImagePixelType;
00107 typedef itk::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, itk::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 }
00166
00167 }
00168
00169
00170 #ifndef ITK_MANUAL_INSTANTIATION
00171 #include "itkBioCellularAggregate.txx"
00172 #endif
00173
00174 #endif
00175