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 #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
00184 HeartGeometryInformation (AbstractTetrahedralMesh<SPACE_DIM,SPACE_DIM>& rMesh,
00185 const std::string& rEpiFile,
00186 const std::string& rLVFile,
00187 const std::string& rRVFile,
00188 bool indexFromZero);
00189
00199 HeartGeometryInformation (std::string nodeHeterogeneityFileName);
00200
00205 HeartRegionType GetHeartRegion (unsigned nodeIndex) const;
00206
00211 std::vector<double>& rGetDistanceMapEpicardium()
00212 {
00213 return mDistMapEpicardium;
00214 }
00215
00220 std::vector<double>& rGetDistanceMapEndocardium()
00221 {
00222 assert(mNumberOfSurfacesProvided==2);
00223 return mDistMapEndocardium;
00224 }
00225
00230 std::vector<double>& rGetDistanceMapRightVentricle()
00231 {
00232 assert(mNumberOfSurfacesProvided==3);
00233 return mDistMapRightVentricle;
00234 }
00235
00240 std::vector<double>& rGetDistanceMapLeftVentricle()
00241 {
00242 assert(mNumberOfSurfacesProvided==3);
00243 return mDistMapLeftVentricle;
00244 }
00245
00247 const std::vector<unsigned>& rGetNodesOnEpiSurface()
00248 {
00249 return mEpiSurface;
00250 }
00251
00252
00254 const std::vector<unsigned>& rGetNodesOnEndoSurface()
00255 {
00256 assert(mNumberOfSurfacesProvided==2);
00257 return mEndoSurface;
00258 }
00259
00261 const std::vector<unsigned>& rGetNodesOnLVSurface()
00262 {
00263 assert(mNumberOfSurfacesProvided==3);
00264 return mLVSurface;
00265 }
00266
00268 const std::vector<unsigned>& rGetNodesOnRVSurface()
00269 {
00270 assert(mNumberOfSurfacesProvided==3);
00271 return mRVSurface;
00272 }
00273
00277 const std::vector<HeartLayerType>& rGetLayerForEachNode()
00278 {
00279 assert(mLayerForEachNode.size()>0);
00280 return mLayerForEachNode;
00281 }
00282
00288 double CalculateRelativeWallPosition(unsigned nodeIndex);
00289
00295 void DetermineLayerForEachNode(double epiFraction, double endoFraction);
00296
00304 void WriteLayerForEachNode(std::string outputDir, std::string file);
00305
00312 inline ChasteCuboid<SPACE_DIM> CalculateBoundingBoxOfEpi()
00313 {
00314 return CalculateBoundingBoxOfSurface(mEpiSurface);
00315 }
00322 inline ChasteCuboid<SPACE_DIM> CalculateBoundingBoxOfEndo()
00323 {
00324 return CalculateBoundingBoxOfSurface(mEndoSurface);
00325 }
00332 inline ChasteCuboid<SPACE_DIM> CalculateBoundingBoxOfLV()
00333 {
00334 return CalculateBoundingBoxOfSurface(mLVSurface);
00335 }
00342 inline ChasteCuboid<SPACE_DIM> CalculateBoundingBoxOfRV()
00343 {
00344 return CalculateBoundingBoxOfSurface(mRVSurface);
00345 }
00346 };
00347 #endif //HEARTGEOMETRYINFORMATION_HPP_
00348