diff --git a/pystackreg/__init__.py b/pystackreg/__init__.py index 880a8dd..9d60142 100644 --- a/pystackreg/__init__.py +++ b/pystackreg/__init__.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- -from .pystackreg import StackReg -from .version import __version__ +from pystackreg.pystackreg import StackReg +from pystackreg.version import __version__ diff --git a/src/pymain.cpp b/src/pymain.cpp index 4f00c10..71d8bfe 100644 --- a/src/pymain.cpp +++ b/src/pymain.cpp @@ -193,8 +193,10 @@ PyObject *turbogreg_register(PyObject *self, PyObject *args) { double *img_ref = (double *)PyArray_DATA(ref_array); double *img_mov = (double *)PyArray_DATA(mov_array); + Py_BEGIN_ALLOW_THREADS registerImg(img_ref, img_mov, (Transformation)tf, Ny_ref, Nx_ref, rm); // width and height (Nx/Ny) have to be swapped! + Py_END_ALLOW_THREADS /* clean up */ Py_XDECREF(ref_array); @@ -282,9 +284,13 @@ PyArrayObject *turbogreg_transform(PyObject *self, PyObject *args) { matrix m(Nx_mat, Ny_mat); memcpy(m.begin(), tmat, (Nx_mat * Ny_mat * sizeof(double))); - std::vector imgout = + std::vector imgout; + + Py_BEGIN_ALLOW_THREADS + imgout = transformImg(m, img_mov, Ny_mov, Nx_mov); // width and height (Nx/Ny) have to be swapped! + Py_END_ALLOW_THREADS /* clean up */ Py_XDECREF(mat_array);