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 "TetrahedralMesh.hpp"
00036 #include "HeartRegionCodes.hpp"
00037
00039 typedef enum HeartLayerType_
00040 {
00041 ENDO = 0,
00042 MID,
00043 EPI
00044 } HeartLayerType;
00045
00046
00051 template<unsigned SPACE_DIM>
00052 class HeartGeometryInformation
00053 {
00054 private:
00055
00057 static const double LEFT_SEPTUM_SIZE;
00059 static const double RIGHT_SEPTUM_SIZE;
00060
00062 std::vector<unsigned> mEpiSurface;
00063
00065 std::vector<unsigned> mEndoSurface;
00066
00068 std::vector<unsigned> mLVSurface;
00069
00071 std::vector<unsigned> mRVSurface;
00072
00081 void GetNodesAtSurface(const std::string& surfaceFile, std::vector<unsigned>& rSurfaceNodes) const;
00082
00088 void ProcessLine(const std::string& line, std::set<unsigned>& surfaceNodeIndexSet) const;
00089
00097 double GetDistanceToEndo(unsigned nodeIndex);
00098
00105 double GetDistanceToEpi(unsigned nodeIndex);
00106
00108 TetrahedralMesh<SPACE_DIM,SPACE_DIM>& mrMesh;
00109
00111 std::vector<double> mDistMapEpicardium;
00112
00114 std::vector<double> mDistMapEndocardium;
00115
00117 std::vector<double> mDistMapRightVentricle;
00118
00120 std::vector<double> mDistMapLeftVentricle;
00121
00123 unsigned mNumberOfSurfacesProvided;
00124
00126 std::vector<HeartLayerType> mLayerForEachNode;
00127
00128 public:
00136 HeartGeometryInformation (TetrahedralMesh<SPACE_DIM,SPACE_DIM>& rMesh,
00137 std::string mEpiFile,
00138 std::string mEndoFile);
00139
00140
00149 HeartGeometryInformation (TetrahedralMesh<SPACE_DIM,SPACE_DIM>& rMesh,
00150 std::string mEpiFile,
00151 std::string mLVFile,
00152 std::string mRVFile);
00153
00161 HeartGeometryInformation (TetrahedralMesh<SPACE_DIM,SPACE_DIM>& rMesh,
00162 std::vector<unsigned>& rNodesAtEpi,
00163 std::vector<unsigned>& rNodesAtEndo);
00164
00173 HeartGeometryInformation (TetrahedralMesh<SPACE_DIM,SPACE_DIM>& rMesh,
00174 std::vector<unsigned>& rNodesAtEpi,
00175 std::vector<unsigned>& rNodesAtLv,
00176 std::vector<unsigned>& rNodesAtRv);
00177
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 };
00284 #endif //HEARTGEOMETRYINFORMATION_HPP_
00285