00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef HEARTGEOMETRYINFORMATION_HPP_
00029 #define HEARTGEOMETRYINFORMATION_HPP_
00030
00031 #include <vector>
00032 #include <string>
00033 #include <set>
00034 #include "DistanceMapCalculator.hpp"
00035 #include "AbstractTetrahedralMesh.hpp"
00036 #include "ChasteCuboid.hpp"
00037
00039 typedef enum HeartLayerType_
00040 {
00041 ENDO = 0,
00042 MID,
00043 EPI
00044 } HeartLayerType;
00045
00047 typedef unsigned HeartRegionType;
00048
00049
00054 template<unsigned SPACE_DIM>
00055 class HeartGeometryInformation
00056 {
00057 private:
00058
00060 static const double LEFT_SEPTUM_SIZE;
00062 static const double RIGHT_SEPTUM_SIZE;
00063
00065 std::vector<unsigned> mEpiSurface;
00066
00068 std::vector<unsigned> mEndoSurface;
00069
00071 std::vector<unsigned> mLVSurface;
00072
00074 std::vector<unsigned> mRVSurface;
00075
00085 void GetNodesAtSurface(const std::string& surfaceFile, std::vector<unsigned>& rSurfaceNodes, bool indexFromZero=true) const;
00086
00093 void ProcessLine(const std::string& line, std::set<unsigned>& rSurfaceNodeIndexSet, unsigned offset) const;
00094
00102 double GetDistanceToEndo(unsigned nodeIndex);
00103
00110 double GetDistanceToEpi(unsigned nodeIndex);
00111
00113 AbstractTetrahedralMesh<SPACE_DIM,SPACE_DIM>* mpMesh;
00114
00116 std::vector<double> mDistMapEpicardium;
00117
00119 std::vector<double> mDistMapEndocardium;
00120
00122 std::vector<double> mDistMapRightVentricle;
00123
00125 std::vector<double> mDistMapLeftVentricle;
00126
00128 unsigned mNumberOfSurfacesProvided;
00129
00131 std::vector<HeartLayerType> mLayerForEachNode;
00132
00138 ChasteCuboid<SPACE_DIM> CalculateBoundingBoxOfSurface(const std::vector<unsigned>& rSurfaceNodes);
00139
00140 public:
00142
00143 static const HeartRegionType LEFT_VENTRICLE_WALL=1001;
00145 static const HeartRegionType RIGHT_VENTRICLE_WALL=1002;
00147 static const HeartRegionType LEFT_SEPTUM=1003;
00149 static const HeartRegionType RIGHT_SEPTUM=1004;
00151 static const HeartRegionType LEFT_VENTRICLE_SURFACE=1005;
00153 static const HeartRegionType RIGHT_VENTRICLE_SURFACE=1006;
00155 static const HeartRegionType UNKNOWN=1007;
00156
00165 HeartGeometryInformation (AbstractTetrahedralMesh<SPACE_DIM,SPACE_DIM>& rMesh,
00166 const std::string& rEpiFile,
00167 const std::string& rEndoFile,
00168 bool indexFromZero);
00169
00170
00180 HeartGeometryInformation (AbstractTetrahedralMesh<SPACE_DIM,SPACE_DIM>& rMesh,
00181 const std::string& rEpiFile,
00182 const std::string& rLVFile,
00183 const std::string& rRVFile,
00184 bool indexFromZero);
00185
00195 HeartGeometryInformation (std::string nodeHeterogeneityFileName);
00196
00201 HeartRegionType GetHeartRegion (unsigned nodeIndex) const;
00202
00207 std::vector<double>& rGetDistanceMapEpicardium()
00208 {
00209 return mDistMapEpicardium;
00210 }
00211
00216 std::vector<double>& rGetDistanceMapEndocardium()
00217 {
00218 assert(mNumberOfSurfacesProvided==2);
00219 return mDistMapEndocardium;
00220 }
00221
00226 std::vector<double>& rGetDistanceMapRightVentricle()
00227 {
00228 assert(mNumberOfSurfacesProvided==3);
00229 return mDistMapRightVentricle;
00230 }
00231
00236 std::vector<double>& rGetDistanceMapLeftVentricle()
00237 {
00238 assert(mNumberOfSurfacesProvided==3);
00239 return mDistMapLeftVentricle;
00240 }
00241
00243 const std::vector<unsigned>& rGetNodesOnEpiSurface()
00244 {
00245 return mEpiSurface;
00246 }
00247
00248
00250 const std::vector<unsigned>& rGetNodesOnEndoSurface()
00251 {
00252 assert(mNumberOfSurfacesProvided==2);
00253 return mEndoSurface;
00254 }
00255
00257 const std::vector<unsigned>& rGetNodesOnLVSurface()
00258 {
00259 assert(mNumberOfSurfacesProvided==3);
00260 return mLVSurface;
00261 }
00262
00264 const std::vector<unsigned>& rGetNodesOnRVSurface()
00265 {
00266 assert(mNumberOfSurfacesProvided==3);
00267 return mRVSurface;
00268 }
00269
00273 const std::vector<HeartLayerType>& rGetLayerForEachNode()
00274 {
00275 assert(mLayerForEachNode.size()>0);
00276 return mLayerForEachNode;
00277 }
00278
00284 double CalculateRelativeWallPosition(unsigned nodeIndex);
00285
00291 void DetermineLayerForEachNode(double epiFraction, double endoFraction);
00292
00300 void WriteLayerForEachNode(std::string outputDir, std::string file);
00301
00308 inline ChasteCuboid<SPACE_DIM> CalculateBoundingBoxOfEpi()
00309 {
00310 return CalculateBoundingBoxOfSurface(mEpiSurface);
00311 }
00318 inline ChasteCuboid<SPACE_DIM> CalculateBoundingBoxOfEndo()
00319 {
00320 return CalculateBoundingBoxOfSurface(mEndoSurface);
00321 }
00328 inline ChasteCuboid<SPACE_DIM> CalculateBoundingBoxOfLV()
00329 {
00330 return CalculateBoundingBoxOfSurface(mLVSurface);
00331 }
00338 inline ChasteCuboid<SPACE_DIM> CalculateBoundingBoxOfRV()
00339 {
00340 return CalculateBoundingBoxOfSurface(mRVSurface);
00341 }
00342 };
00343 #endif //HEARTGEOMETRYINFORMATION_HPP_
00344