Chaste Commit::ca8ccdedf819b6e02855bc0e8e6f50bdecbc5208
HeartGeometryInformation.hpp
1/*
2
3Copyright (c) 2005-2024, University of Oxford.
4All rights reserved.
5
6University of Oxford means the Chancellor, Masters and Scholars of the
7University of Oxford, having an administrative office at Wellington
8Square, Oxford OX1 2JD, UK.
9
10This file is part of Chaste.
11
12Redistribution and use in source and binary forms, with or without
13modification, are permitted provided that the following conditions are met:
14 * Redistributions of source code must retain the above copyright notice,
15 this list of conditions and the following disclaimer.
16 * Redistributions in binary form must reproduce the above copyright notice,
17 this list of conditions and the following disclaimer in the documentation
18 and/or other materials provided with the distribution.
19 * Neither the name of the University of Oxford nor the names of its
20 contributors may be used to endorse or promote products derived from this
21 software without specific prior written permission.
22
23THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34*/
35#ifndef HEARTGEOMETRYINFORMATION_HPP_
36#define HEARTGEOMETRYINFORMATION_HPP_
37
38#include <vector>
39#include <string>
40#include <set>
41#include "DistanceMapCalculator.hpp"
42#include "AbstractTetrahedralMesh.hpp"
43#include "ChasteCuboid.hpp"
44
46typedef enum HeartLayerType_
47{
48 ENDO = 0,
49 MID,
50 EPI
51} HeartLayerType;
52
54typedef unsigned HeartRegionType;
55
56
61template<unsigned SPACE_DIM>
63{
64private:
65
67 static const double LEFT_SEPTUM_SIZE;
69 static const double RIGHT_SEPTUM_SIZE;
70
72 std::vector<unsigned> mEpiSurface;
73
75 std::vector<unsigned> mEndoSurface;
76
78 std::vector<unsigned> mLVSurface;
79
81 std::vector<unsigned> mRVSurface;
82
96 void GetNodesAtSurface(const std::string& rSurfaceFileName,
97 std::vector<unsigned>& rSurfaceNodes,
98 bool indexFromZero=true) const;
99
106 void ProcessLine(const std::string& rLineFromFile,
107 std::set<unsigned>& rSurfaceNodeIndexSet,
108 unsigned offset) const;
109
117 double GetDistanceToEndo(unsigned nodeIndex);
118
125 double GetDistanceToEpi(unsigned nodeIndex);
126
129
131 std::vector<double> mDistMapEpicardium;
132
134 std::vector<double> mDistMapEndocardium;
135
137 std::vector<double> mDistMapRightVentricle;
138
140 std::vector<double> mDistMapLeftVentricle;
141
144
146 std::vector<HeartLayerType> mLayerForEachNode;
147
153 ChasteCuboid<SPACE_DIM> CalculateBoundingBoxOfSurface(const std::vector<unsigned>& rSurfaceNodes);
154
155public:
157
162 static const HeartRegionType LEFT_SEPTUM=1003;
164 static const HeartRegionType RIGHT_SEPTUM=1004;
170 static const HeartRegionType UNKNOWN=1007;
171
182 const std::string& rEpiFile,
183 const std::string& rEndoFile,
184 bool indexFromZero);
185
186
202 const std::string& rEpiFile,
203 const std::string& rLVFile,
204 const std::string& rRVFile,
205 bool indexFromZero);
206
216 HeartGeometryInformation (std::string nodeHeterogeneityFileName);
217
222 HeartRegionType GetHeartRegion (unsigned nodeIndex) const;
223
228 std::vector<double>& rGetDistanceMapEpicardium()
229 {
230 return mDistMapEpicardium;
231 }
232
237 std::vector<double>& rGetDistanceMapEndocardium()
238 {
239 assert(mNumberOfSurfacesProvided==2);
240 return mDistMapEndocardium;
241 }
242
247 std::vector<double>& rGetDistanceMapRightVentricle()
248 {
249 assert(mNumberOfSurfacesProvided==3);
251 }
252
257 std::vector<double>& rGetDistanceMapLeftVentricle()
258 {
259 assert(mNumberOfSurfacesProvided==3);
261 }
262
264 const std::vector<unsigned>& rGetNodesOnEpiSurface()
265 {
266 return mEpiSurface;
267 }
268
269
271 const std::vector<unsigned>& rGetNodesOnEndoSurface()
272 {
273 assert(mNumberOfSurfacesProvided==2);
274 return mEndoSurface;
275 }
276
278 const std::vector<unsigned>& rGetNodesOnLVSurface()
279 {
280 assert(mNumberOfSurfacesProvided==3);
281 return mLVSurface;
282 }
283
285 const std::vector<unsigned>& rGetNodesOnRVSurface()
286 {
287 assert(mNumberOfSurfacesProvided==3);
288 return mRVSurface;
289 }
290
294 const std::vector<HeartLayerType>& rGetLayerForEachNode()
295 {
296 assert(mLayerForEachNode.size()>0);
297 return mLayerForEachNode;
298 }
299
305 double CalculateRelativeWallPosition(unsigned nodeIndex);
306
312 void DetermineLayerForEachNode(double epiFraction, double endoFraction);
313
321 void WriteLayerForEachNode(std::string outputDir, std::string file);
322
367};
368#endif //HEARTGEOMETRYINFORMATION_HPP_
369
AbstractTetrahedralMesh< SPACE_DIM, SPACE_DIM > * mpMesh
double CalculateRelativeWallPosition(unsigned nodeIndex)
std::vector< double > & rGetDistanceMapRightVentricle()
void ProcessLine(const std::string &rLineFromFile, std::set< unsigned > &rSurfaceNodeIndexSet, unsigned offset) const
static const HeartRegionType LEFT_VENTRICLE_WALL
const std::vector< unsigned > & rGetNodesOnLVSurface()
ChasteCuboid< SPACE_DIM > CalculateBoundingBoxOfLV()
static const HeartRegionType LEFT_VENTRICLE_SURFACE
std::vector< double > & rGetDistanceMapEpicardium()
ChasteCuboid< SPACE_DIM > CalculateBoundingBoxOfEpi()
std::vector< HeartLayerType > mLayerForEachNode
std::vector< unsigned > mEpiSurface
std::vector< unsigned > mLVSurface
ChasteCuboid< SPACE_DIM > CalculateBoundingBoxOfSurface(const std::vector< unsigned > &rSurfaceNodes)
static const HeartRegionType LEFT_SEPTUM
std::vector< double > mDistMapLeftVentricle
ChasteCuboid< SPACE_DIM > CalculateBoundingBoxOfEndo()
double GetDistanceToEndo(unsigned nodeIndex)
HeartRegionType GetHeartRegion(unsigned nodeIndex) const
std::vector< double > mDistMapRightVentricle
double GetDistanceToEpi(unsigned nodeIndex)
void GetNodesAtSurface(const std::string &rSurfaceFileName, std::vector< unsigned > &rSurfaceNodes, bool indexFromZero=true) const
void DetermineLayerForEachNode(double epiFraction, double endoFraction)
static const HeartRegionType RIGHT_VENTRICLE_SURFACE
std::vector< double > & rGetDistanceMapEndocardium()
std::vector< unsigned > mEndoSurface
std::vector< double > mDistMapEpicardium
const std::vector< unsigned > & rGetNodesOnEpiSurface()
static const HeartRegionType RIGHT_SEPTUM
static const HeartRegionType UNKNOWN
void WriteLayerForEachNode(std::string outputDir, std::string file)
const std::vector< unsigned > & rGetNodesOnEndoSurface()
const std::vector< HeartLayerType > & rGetLayerForEachNode()
std::vector< double > mDistMapEndocardium
ChasteCuboid< SPACE_DIM > CalculateBoundingBoxOfRV()
std::vector< unsigned > mRVSurface
std::vector< double > & rGetDistanceMapLeftVentricle()
const std::vector< unsigned > & rGetNodesOnRVSurface()
static const HeartRegionType RIGHT_VENTRICLE_WALL