[Scipy-svn] r3964 - trunk/scipy/ndimage/src/register
scipy-svn at scipy.org
scipy-svn at scipy.org
Fri Feb 29 19:43:55 EST 2008
Author: tom.waite
Date: 2008-02-29 18:43:51 -0600 (Fri, 29 Feb 2008)
New Revision: 3964
Modified:
trunk/scipy/ndimage/src/register/Register_EXT.c
Log:
Bug fix and enhancements
Modified: trunk/scipy/ndimage/src/register/Register_EXT.c
===================================================================
--- trunk/scipy/ndimage/src/register/Register_EXT.c 2008-02-29 17:30:15 UTC (rev 3963)
+++ trunk/scipy/ndimage/src/register/Register_EXT.c 2008-03-01 00:43:51 UTC (rev 3964)
@@ -80,6 +80,7 @@
*/
int num;
+ int numG;
int nd;
int type;
int itype;
@@ -114,6 +115,7 @@
dimsG = PyArray_DIMS(imgArray2);
type = PyArray_TYPE(imgArray1);
num = PyArray_SIZE(imgArray1);
+ numG = PyArray_SIZE(imgArray2);
M = (double *)PyArray_DATA(rotArray);
nd_rotmatrix = PyArray_NDIM(rotArray);
@@ -140,7 +142,51 @@
}
+static PyObject *Register_VolumeResample(PyObject *self, PyObject *args)
+{
+ int num;
+ int nd;
+ int type;
+ int itype;
+ int mode;
+ int scale;
+ npy_intp *dimsF;
+ npy_intp *dimsG;
+ unsigned char *imageG;
+ unsigned char *imageF;
+ double *Z;
+ PyObject *imgArray1 = NULL;
+ PyObject *imgArray2 = NULL;
+ PyObject *coordZoom = NULL;
+
+ if(!PyArg_ParseTuple(args, "OOOii", &imgArray1, &imgArray2, &coordZoom, &scale, &mode))
+ goto exit;
+
+ /* check in the Python code that F and G are the same dims, type */
+ imageF = (unsigned char *)PyArray_DATA(imgArray1);
+ imageG = (unsigned char *)PyArray_DATA(imgArray2);
+ Z = (double *)PyArray_DATA(coordZoom);
+ /* reads dims as 0 = layers, 1 = rows, 2 = cols */
+ nd = PyArray_NDIM(imgArray1);
+ dimsF = PyArray_DIMS(imgArray1);
+ dimsG = PyArray_DIMS(imgArray2);
+ type = PyArray_TYPE(imgArray1);
+ num = PyArray_SIZE(imgArray1);
+
+ if(!NI_VolumeResample((int)dimsF[0], (int)dimsF[1], (int)dimsF[2],
+ (int)dimsG[0], (int)dimsG[1], (int)dimsG[2],
+ scale, mode, imageG, imageF, Z))
+ goto exit;
+
+exit:
+
+ return PyErr_Occurred() ? NULL : (PyObject*)Py_BuildValue("");
+
+}
+
+
+
static PyObject *Register_CubicResample(PyObject *self, PyObject *args)
{
@@ -301,6 +347,7 @@
{ "register_histogram_lite", Register_HistogramLite, METH_VARARGS, NULL },
{ "register_linear_resample", Register_LinearResample, METH_VARARGS, NULL },
{ "register_cubic_resample", Register_CubicResample, METH_VARARGS, NULL },
+ { "register_volume_resample", Register_VolumeResample, METH_VARARGS, NULL },
{ "register_image_threshold", Register_ImageThreshold, METH_VARARGS, NULL },
{ NULL, NULL, 0, NULL},
};
More information about the Scipy-svn
mailing list