forked from BlueBrain/MorphIO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsoma.cpp
40 lines (32 loc) · 973 Bytes
/
soma.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <morphio/section.h>
#include <morphio/soma.h>
#include <morphio/vector_types.h>
#include "point_utils.h"
#include "shared_utils.hpp"
namespace morphio {
Soma::Soma(const std::shared_ptr<Property::Properties>& properties)
: properties_(properties) {}
Point Soma::center() const {
return centerOfGravity(properties_->_somaLevel._points);
}
floatType Soma::volume() const {
switch (properties_->_cellLevel._somaType) {
case SOMA_NEUROMORPHO_THREE_POINT_CYLINDERS: {
floatType radius = diameters()[0] / 2;
return 4 * morphio::PI * radius * radius;
}
case SOMA_SINGLE_POINT:
case SOMA_CYLINDERS:
case SOMA_SIMPLE_CONTOUR:
case SOMA_UNDEFINED:
default:
throw;
}
}
floatType Soma::surface() const {
return _somaSurface(type(), diameters(), points());
}
floatType Soma::maxDistance() const {
return maxDistanceToCenterOfGravity(properties_->_somaLevel._points);
}
} // namespace morphio