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 "HeartRegionCodes.hpp"
00037 #include "ChasteCuboid.hpp"
00038
00040 typedef enum HeartLayerType_
00041 {
00042 ENDO = 0,
00043 MID,
00044 EPI
00045 } HeartLayerType;
00046
00047
00052 template<unsigned SPACE_DIM>
00053 class HeartGeometryInformation
00054 {
00055 private:
00056
00058 static const double LEFT_SEPTUM_SIZE;
00060 static const double RIGHT_SEPTUM_SIZE;
00061
00063 std::vector<unsigned> mEpiSurface;
00064
00066 std::vector<unsigned> mEndoSurface;
00067
00069 std::vector<unsigned> mLVSurface;
00070
00072 std::vector<unsigned> mRVSurface;
00073
00083 void GetNodesAtSurface(const std::string& surfaceFile, std::vector<unsigned>& rSurfaceNodes, bool indexFromZero=true) const;
00084
00091 void ProcessLine(const std::string& line, std::set<unsigned>& rSurfaceNodeIndexSet, unsigned offset) const;
00092
00100 double GetDistanceToEndo(unsigned nodeIndex);
00101
00108 double GetDistanceToEpi(unsigned nodeIndex);
00109
00111 AbstractTetrahedralMesh<SPACE_DIM,SPACE_DIM>* mpMesh;
00112
00114 std::vector<double> mDistMapEpicardium;
00115
00117 std::vector<double> mDistMapEndocardium;
00118
00120 std::vector<double> mDistMapRightVentricle;
00121
00123 std::vector<double> mDistMapLeftVentricle;
00124
00126 unsigned mNumberOfSurfacesProvided;
00127
00129 std::vector<HeartLayerType> mLayerForEachNode;
00130
00136 ChasteCuboid<SPACE_DIM> CalculateBoundingBoxOfSurface(const std::vector<unsigned>& rSurfaceNodes);
00137
00138 public:
00147 HeartGeometryInformation (AbstractTetrahedralMesh<SPACE_DIM,SPACE_DIM>& rMesh,
00148 const std::string& rEpiFile,
00149 const std::string& rEndoFile,
00150 bool indexFromZero);
00151
00152
00162 HeartGeometryInformation (AbstractTetrahedralMesh<SPACE_DIM,SPACE_DIM>& rMesh,
00163 const std::string& rEpiFile,
00164 const std::string& rLVFile,
00165 const std::string& rRVFile,
00166 bool indexFromZero);
00167
00177 HeartGeometryInformation (std::string nodeHeterogeneityFileName);
00178
00183 HeartRegionType GetHeartRegion (unsigned nodeIndex) const;
00184
00189 std::vector<double>& rGetDistanceMapEpicardium()
00190 {
00191 return mDistMapEpicardium;
00192 }
00193
00198 std::vector<double>& rGetDistanceMapEndocardium()
00199 {
00200 assert(mNumberOfSurfacesProvided==2);
00201 return mDistMapEndocardium;
00202 }
00203
00208 std::vector<double>& rGetDistanceMapRightVentricle()
00209 {
00210 assert(mNumberOfSurfacesProvided==3);
00211 return mDistMapRightVentricle;
00212 }
00213
00218 std::vector<double>& rGetDistanceMapLeftVentricle()
00219 {
00220 assert(mNumberOfSurfacesProvided==3);
00221 return mDistMapLeftVentricle;
00222 }
00223
00225 const std::vector<unsigned>& rGetNodesOnEpiSurface()
00226 {
00227 return mEpiSurface;
00228 }
00229
00230
00232 const std::vector<unsigned>& rGetNodesOnEndoSurface()
00233 {
00234 assert(mNumberOfSurfacesProvided==2);
00235 return mEndoSurface;
00236 }
00237
00239 const std::vector<unsigned>& rGetNodesOnLVSurface()
00240 {
00241 assert(mNumberOfSurfacesProvided==3);
00242 return mLVSurface;
00243 }
00244
00246 const std::vector<unsigned>& rGetNodesOnRVSurface()
00247 {
00248 assert(mNumberOfSurfacesProvided==3);
00249 return mRVSurface;
00250 }
00251
00255 const std::vector<HeartLayerType>& rGetLayerForEachNode()
00256 {
00257 assert(mLayerForEachNode.size()>0);
00258 return mLayerForEachNode;
00259 }
00260
00266 double CalculateRelativeWallPosition(unsigned nodeIndex);
00267
00273 void DetermineLayerForEachNode(double epiFraction, double endoFraction);
00274
00282 void WriteLayerForEachNode(std::string outputDir, std::string file);
00283
00290 inline ChasteCuboid<SPACE_DIM> CalculateBoundingBoxOfEpi()
00291 {
00292 return CalculateBoundingBoxOfSurface(mEpiSurface);
00293 }
00300 inline ChasteCuboid<SPACE_DIM> CalculateBoundingBoxOfEndo()
00301 {
00302 return CalculateBoundingBoxOfSurface(mEndoSurface);
00303 }
00310 inline ChasteCuboid<SPACE_DIM> CalculateBoundingBoxOfLV()
00311 {
00312 return CalculateBoundingBoxOfSurface(mLVSurface);
00313 }
00320 inline ChasteCuboid<SPACE_DIM> CalculateBoundingBoxOfRV()
00321 {
00322 return CalculateBoundingBoxOfSurface(mRVSurface);
00323 }
00324 };
00325 #endif //HEARTGEOMETRYINFORMATION_HPP_
00326