HeartGeometryInformation.hpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2009
00004 
00005 University of Oxford means the Chancellor, Masters and Scholars of the
00006 University of Oxford, having an administrative office at Wellington
00007 Square, Oxford OX1 2JD, UK.
00008 
00009 This file is part of Chaste.
00010 
00011 Chaste is free software: you can redistribute it and/or modify it
00012 under the terms of the GNU Lesser General Public License as published
00013 by the Free Software Foundation, either version 2.1 of the License, or
00014 (at your option) any later version.
00015 
00016 Chaste is distributed in the hope that it will be useful, but WITHOUT
00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00019 License for more details. The offer of Chaste under the terms of the
00020 License is subject to the License being interpreted in accordance with
00021 English Law and subject to any action against the University of Oxford
00022 being under the jurisdiction of the English Courts.
00023 
00024 You should have received a copy of the GNU Lesser General Public License
00025 along with Chaste. If not, see <http://www.gnu.org/licenses/>.
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 

Generated on Tue Aug 4 16:10:22 2009 for Chaste by  doxygen 1.5.5