[ismrmrd] 114/281: added initial version of SWIG Python bindings
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Wed Jan 14 20:01:04 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to annotated tag ismrmrd0.5
in repository ismrmrd.
commit 87417bbf5bd9a62979d1de0552b417d058bb8f0b
Author: Joseph Naegele <joseph.naegele at gmail.com>
Date: Tue Mar 26 15:07:14 2013 -0400
added initial version of SWIG Python bindings
---
CMakeLists.txt | 1 +
bindings/CMakeLists.txt | 14 ++++++++++++++
bindings/ismrmrd.i | 31 +++++++++++++++++++++++++++++++
3 files changed, 46 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 41bbfbc..a3adecf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,6 +66,7 @@ INSTALL(TARGETS ismrmrd DESTINATION lib)
INSTALL(TARGETS ismrmrd_xsd DESTINATION lib)
INSTALL(FILES ${MatlabMFiles} DESTINATION matlab/+ismrmrd)
+add_subdirectory(bindings)
add_subdirectory(doc)
add_subdirectory(examples/c++)
add_subdirectory(tests)
diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt
new file mode 100644
index 0000000..5a43e2f
--- /dev/null
+++ b/bindings/CMakeLists.txt
@@ -0,0 +1,14 @@
+find_package(SWIG REQUIRED)
+include(${SWIG_USE_FILE})
+
+find_package(PythonLibs)
+include_directories(${PYTHON_INCLUDE_PATH})
+
+include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
+
+#set(CMAKE_SWIG_FLAGS "-c++")
+set(CMAKE_SWIG_FLAGS "")
+set_source_files_properties(ismrmrd.i PROPERTIES CPLUSPLUS ON)
+#set_source_files_properties(ismrmrd.i PROPERTIES SWIG_FLAGS "-includeall")
+SWIG_ADD_MODULE(ismrmrd python ismrmrd.i)
+SWIG_LINK_LIBRARIES(ismrmrd ${PYTHON_LIBRARIES})
diff --git a/bindings/ismrmrd.i b/bindings/ismrmrd.i
new file mode 100644
index 0000000..0de1724
--- /dev/null
+++ b/bindings/ismrmrd.i
@@ -0,0 +1,31 @@
+%module ismrmrd
+%{
+#define SWIG_FILE_WITH_INIT
+#include "ismrmrd.h"
+%}
+
+%include "stdint.i"
+
+//%include "carrays.i"
+//%array_class(float, floatArray);
+
+%ignore ISMRMRD::Acquisition::getData;
+
+%include "ismrmrd.h"
+
+%extend ISMRMRD::Acquisition {
+
+ float* getData() {
+ return (float*)(&($self->getData()[0]));
+ }
+
+}
+
+namespace ISMRMRD {
+ %template(Image_ushort) Image<unsigned short int>;
+ %template(Image_float) Image<float>;
+ %template(Image_double) Image<double>;
+ %template(Image_cplx_float) Image< std::complex<float> >;
+ %template(Image_cplx_double) Image< std::complex<double> >;
+}
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ismrmrd.git
More information about the debian-science-commits
mailing list