HeartGeometryInformation.hpp
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
00029
00030
00031
00032
00033
00034
00035 #ifndef HEARTGEOMETRYINFORMATION_HPP_
00036 #define HEARTGEOMETRYINFORMATION_HPP_
00037
00038 #include <vector>
00039 #include <string>
00040 #include <set>
00041 #include "DistanceMapCalculator.hpp"
00042 #include "AbstractTetrahedralMesh.hpp"
00043 #include "ChasteCuboid.hpp"
00044
00046 typedef enum HeartLayerType_
00047 {
00048 ENDO = 0,
00049 MID,
00050 EPI
00051 } HeartLayerType;
00052
00054 typedef unsigned HeartRegionType;
00055
00056
00061 template<unsigned SPACE_DIM>
00062 class HeartGeometryInformation
00063 {
00064 private:
00065
00067 static const double LEFT_SEPTUM_SIZE;
00069 static const double RIGHT_SEPTUM_SIZE;
00070
00072 std::vector<unsigned> mEpiSurface;
00073
00075 std::vector<unsigned> mEndoSurface;
00076
00078 std::vector<unsigned> mLVSurface;
00079
00081 std::vector<unsigned> mRVSurface;
00082
00096 void GetNodesAtSurface(const std::string& surfaceFile,
00097 std::vector<unsigned>& rSurfaceNodes,
00098 bool indexFromZero=true) const;
00099
00106 void ProcessLine(const std::string& line,
00107 std::set<unsigned>& rSurfaceNodeIndexSet,
00108 unsigned offset) const;
00109
00117 double GetDistanceToEndo(unsigned nodeIndex);
00118
00125 double GetDistanceToEpi(unsigned nodeIndex);
00126
00128 AbstractTetrahedralMesh<SPACE_DIM,SPACE_DIM>* mpMesh;
00129
00131 std::vector<double> mDistMapEpicardium;
00132
00134 std::vector<double> mDistMapEndocardium;
00135
00137 std::vector<double> mDistMapRightVentricle;
00138
00140 std::vector<double> mDistMapLeftVentricle;
00141
00143 unsigned mNumberOfSurfacesProvided;
00144
00146 std::vector<HeartLayerType> mLayerForEachNode;
00147
00153 ChasteCuboid<SPACE_DIM> CalculateBoundingBoxOfSurface(const std::vector<unsigned>& rSurfaceNodes);
00154
00155 public:
00157
00158 static const HeartRegionType LEFT_VENTRICLE_WALL=1001;
00160 static const HeartRegionType RIGHT_VENTRICLE_WALL=1002;
00162 static const HeartRegionType LEFT_SEPTUM=1003;
00164 static const HeartRegionType RIGHT_SEPTUM=1004;
00166 static const HeartRegionType LEFT_VENTRICLE_SURFACE=1005;
00168 static const HeartRegionType RIGHT_VENTRICLE_SURFACE=1006;
00170 static const HeartRegionType UNKNOWN=1007;
00171
00181 HeartGeometryInformation (AbstractTetrahedralMesh<SPACE_DIM,SPACE_DIM>& rMesh,
00182 const std::string& rEpiFile,
00183 const std::string& rEndoFile,
00184 bool indexFromZero);
00185
00186
00201 HeartGeometryInformation (AbstractTetrahedralMesh<SPACE_DIM,SPACE_DIM>& rMesh,
00202 const std::string& rEpiFile,
00203 const std::string& rLVFile,
00204 const std::string& rRVFile,
00205 bool indexFromZero);
00206
00216 HeartGeometryInformation (std::string nodeHeterogeneityFileName);
00217
00222 HeartRegionType GetHeartRegion (unsigned nodeIndex) const;
00223
00228 std::vector<double>& rGetDistanceMapEpicardium()
00229 {
00230 return mDistMapEpicardium;
00231 }
00232
00237 std::vector<double>& rGetDistanceMapEndocardium()
00238 {
00239 assert(mNumberOfSurfacesProvided==2);
00240 return mDistMapEndocardium;
00241 }
00242
00247 std::vector<double>& rGetDistanceMapRightVentricle()
00248 {
00249 assert(mNumberOfSurfacesProvided==3);
00250 return mDistMapRightVentricle;
00251 }
00252
00257 std::vector<double>& rGetDistanceMapLeftVentricle()
00258 {
00259 assert(mNumberOfSurfacesProvided==3);
00260 return mDistMapLeftVentricle;
00261 }
00262
00264 const std::vector<unsigned>& rGetNodesOnEpiSurface()
00265 {
00266 return mEpiSurface;
00267 }
00268
00269
00271 const std::vector<unsigned>& rGetNodesOnEndoSurface()
00272 {
00273 assert(mNumberOfSurfacesProvided==2);
00274 return mEndoSurface;
00275 }
00276
00278 const std::vector<unsigned>& rGetNodesOnLVSurface()
00279 {
00280 assert(mNumberOfSurfacesProvided==3);
00281 return mLVSurface;
00282 }
00283
00285 const std::vector<unsigned>& rGetNodesOnRVSurface()
00286 {
00287 assert(mNumberOfSurfacesProvided==3);
00288 return mRVSurface;
00289 }
00290
00294 const std::vector<HeartLayerType>& rGetLayerForEachNode()
00295 {
00296 assert(mLayerForEachNode.size()>0);
00297 return mLayerForEachNode;
00298 }
00299
00305 double CalculateRelativeWallPosition(unsigned nodeIndex);
00306
00312 void DetermineLayerForEachNode(double epiFraction, double endoFraction);
00313
00321 void WriteLayerForEachNode(std::string outputDir, std::string file);
00322
00330 inline ChasteCuboid<SPACE_DIM> CalculateBoundingBoxOfEpi()
00331 {
00332 return CalculateBoundingBoxOfSurface(mEpiSurface);
00333 }
00341 inline ChasteCuboid<SPACE_DIM> CalculateBoundingBoxOfEndo()
00342 {
00343 return CalculateBoundingBoxOfSurface(mEndoSurface);
00344 }
00352 inline ChasteCuboid<SPACE_DIM> CalculateBoundingBoxOfLV()
00353 {
00354 return CalculateBoundingBoxOfSurface(mLVSurface);
00355 }
00363 inline ChasteCuboid<SPACE_DIM> CalculateBoundingBoxOfRV()
00364 {
00365 return CalculateBoundingBoxOfSurface(mRVSurface);
00366 }
00367 };
00368 #endif //HEARTGEOMETRYINFORMATION_HPP_
00369