-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ba82b5
commit a5b7df2
Showing
19 changed files
with
175 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
|
||
#include <pybind11/numpy.h> | ||
#include <pybind11/pybind11.h> | ||
|
||
#include <morphio/soma.h> | ||
#include <morphio/types.h> | ||
|
||
#include "bind_soma.h" | ||
#include "bindings_utils.h" | ||
|
||
namespace py = pybind11; | ||
|
||
void bind_soma_module(py::module& m) { | ||
|
||
py::class_<morphio::Soma, std::shared_ptr<morphio::Soma>>(m, "Soma") | ||
.def(py::init<const morphio::Soma&>()) | ||
|
||
.def_property( | ||
"points", | ||
[](morphio::Soma* soma) { | ||
return py::array(static_cast<py::ssize_t>(soma->points().size()), | ||
soma->points().data()); | ||
}, | ||
[](morphio::Soma* soma, py::array_t<morphio::floatType> _points) { | ||
soma->points() = array_to_points(_points); | ||
}, | ||
"Returns the coordinates (x,y,z) of all soma point" | ||
) | ||
|
||
.def_property( | ||
"diameters", | ||
[](morphio::Soma* soma) { | ||
return py::array(static_cast<py::ssize_t>(soma->diameters().size()), | ||
soma->diameters().data()); | ||
}, | ||
[](morphio::Soma* soma, py::array_t<morphio::floatType> _diameters) { | ||
soma->diameters() = _diameters.cast<std::vector<morphio::floatType>>(); | ||
}, | ||
"Returns the diameters of all soma points" | ||
) | ||
|
||
.def_property_readonly( | ||
"center", | ||
[](morphio::Soma* soma) { return py::array(3, soma->center().data()); }, | ||
"Returns the center of gravity of the soma points" | ||
) | ||
|
||
.def_property_readonly( | ||
"max_distance", | ||
&morphio::Soma::maxDistance, | ||
"Return the maximum distance between the center of gravity " | ||
"and any of the soma points" | ||
) | ||
|
||
.def_property_readonly("type", &morphio::Soma::type, "Returns the soma type") | ||
|
||
.def_property_readonly( | ||
"surface", | ||
&morphio::Soma::surface, | ||
"Returns the soma surface\n\n" | ||
"Note: the soma surface computation depends on the soma type" | ||
); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#pragma once | ||
#include <pybind11/pybind11.h> | ||
|
||
void bind_soma_module(pybind11::module& m); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.