36 #include "Exception.hpp" 37 #include "VesselNetworkGeometryCalculator.hpp" 38 #include "GeometryTools.hpp" 40 template <
unsigned DIM>
47 template <
unsigned DIM>
53 template <
unsigned DIM>
60 template <
unsigned DIM>
65 EXCEPTION(
"Vessel network not set in geometry calculator");
68 std::vector<boost::shared_ptr<Vessel<DIM> > > vessels =
mpVesselNetwork->GetVessels();
69 std::vector<units::quantity<unit::length> > distances;
70 for(
unsigned idx=0; idx<vessels.size(); idx++)
72 units::quantity<unit::length> min_distance = 1.e6 * unit::metres;
73 for(
unsigned jdx=0; jdx<vessels.size(); jdx++)
75 if(vessels[idx]!=vessels[jdx])
77 units::quantity<unit::length> distance = vessels[idx]->GetStartNode()->GetDistance(vessels[jdx]->GetStartNode()->rGetLocation());
78 if(distance < min_distance)
80 min_distance = distance;
84 distances.push_back(min_distance);
89 template <
unsigned DIM>
94 EXCEPTION(
"Vessel network not set in geometry calculator");
97 std::vector<boost::shared_ptr<Vessel<DIM> > > vessels =
mpVesselNetwork->GetVessels();
98 units::quantity<unit::length> length = 0.0* unit::metres;
99 for(
unsigned idx=0; idx<vessels.size(); idx++)
101 length += vessels[idx]->GetLength();
106 template <
unsigned DIM>
111 EXCEPTION(
"Vessel network not set in geometry calculator");
114 units::quantity<unit::volume> volume = 0.0*units::pow<3>(unit::metres);
115 std::vector<boost::shared_ptr<VesselSegment<DIM> > > segments =
mpVesselNetwork->GetVesselSegments();
116 for(
unsigned idx=0; idx< segments.size(); idx++)
118 volume += segments[idx]->GetLength() * segments[idx]->GetRadius() * segments[idx]->GetRadius() * M_PI;
123 template <
unsigned DIM>
128 EXCEPTION(
"Vessel network not set in geometry calculator");
131 units::quantity<unit::area> area = 0.0*units::pow<2>(unit::metres);
132 std::vector<boost::shared_ptr<VesselSegment<DIM> > > segments =
mpVesselNetwork->GetVesselSegments();
133 for(
unsigned idx=0; idx< segments.size(); idx++)
135 area += segments[idx]->GetLength() * 2.0 * segments[idx]->GetRadius() * M_PI;
140 template <
unsigned DIM>
145 EXCEPTION(
"Vessel network not set in geometry calculator");
148 std::vector<boost::shared_ptr<VesselSegment<DIM> > > segments =
mpVesselNetwork->GetVesselSegments();
151 std::vector<DimensionalChastePoint<DIM> > midpoints(segments.size());
152 for(
unsigned idx=0; idx<segments.size(); idx++)
154 midpoints[idx] = segments[idx]->GetMidPoint();
158 units::quantity<unit::length> av_dist = 0.0 * unit::metres;
159 for(
unsigned idx=0; idx<segments.size(); idx++)
161 units::quantity<unit::length> min_dist = 1.e6 * unit::metres;
162 for(
unsigned jdx=0; jdx<segments.size(); jdx++)
164 if(segments[idx] != segments[jdx] && segments[idx]->GetVessel() != segments[jdx]->GetVessel())
166 units::quantity<unit::length> dist = GetDistance(midpoints[idx], midpoints[jdx]);
175 return av_dist / double(segments.size());
178 template <
unsigned DIM>
183 EXCEPTION(
"Vessel network not set in geometry calculator");
189 template <
unsigned DIM>
194 EXCEPTION(
"Vessel network not set in geometry calculator");
197 std::vector<unsigned> bins(numberOfBins, 0);
200 std::vector<boost::shared_ptr<Vessel<DIM> > > vessels =
mpVesselNetwork->GetVessels();
201 for(
unsigned idx=0; idx<vessels.size(); idx++)
203 unsigned bin_label = std::floor(vessels[idx]->GetLength() / (binSpacing*unit::metres));
204 if(bin_label > numberOfBins)
206 bin_label = numberOfBins;
213 template <
unsigned DIM>
units::quantity< unit::length > GetTotalLength()
boost::shared_ptr< VesselNetwork< DIM > > mpVesselNetwork
units::quantity< unit::volume > GetTotalVolume()
units::quantity< unit::area > GetTotalSurfaceArea()
units::quantity< unit::length > GetAverageVesselLength()
std::vector< unsigned > GetVesselLengthDistribution(double binSpacing=10.0, unsigned numberOfBins=10)
units::quantity< unit::length > GetAverageInterSegmentDistance()
std::vector< units::quantity< unit::length > > GetInterCapillaryDistances()
void SetVesselNetwork(boost::shared_ptr< VesselNetwork< DIM > > pVesselNetwork)
static boost::shared_ptr< VesselNetworkGeometryCalculator< DIM > > Create()
~VesselNetworkGeometryCalculator()
VesselNetworkGeometryCalculator()