[Scipy-svn] r3894 - trunk/scipy/ndimage/register
scipy-svn at scipy.org
scipy-svn at scipy.org
Tue Feb 5 20:16:58 EST 2008
Author: tom.waite
Date: 2008-02-05 19:16:48 -0600 (Tue, 05 Feb 2008)
New Revision: 3894
Modified:
trunk/scipy/ndimage/register/Register_EXT.c
Log:
Bug fix and added resampler
Modified: trunk/scipy/ndimage/register/Register_EXT.c
===================================================================
--- trunk/scipy/ndimage/register/Register_EXT.c 2008-02-03 19:44:39 UTC (rev 3893)
+++ trunk/scipy/ndimage/register/Register_EXT.c 2008-02-06 01:16:48 UTC (rev 3894)
@@ -37,8 +37,8 @@
goto exit;
/* check in the Python code that F and G are the same dims, type */
- imageG = (unsigned char *)PyArray_DATA(imgArray1);
- imageF = (unsigned char *)PyArray_DATA(imgArray2);
+ imageF = (unsigned char *)PyArray_DATA(imgArray1);
+ imageG = (unsigned char *)PyArray_DATA(imgArray2);
nd = PyArray_NDIM(imgArray1);
/* reads dims as 0 = layers, 1 = rows, 2 = cols */
dimsF = PyArray_DIMS(imgArray1);
@@ -106,8 +106,8 @@
goto exit;
/* check in the Python code that F and G are the same dims, type */
- imageG = (unsigned char *)PyArray_DATA(imgArray1);
- imageF = (unsigned char *)PyArray_DATA(imgArray2);
+ imageF = (unsigned char *)PyArray_DATA(imgArray1);
+ imageG = (unsigned char *)PyArray_DATA(imgArray2);
/* reads dims as 0 = layers, 1 = rows, 2 = cols */
nd = PyArray_NDIM(imgArray1);
dimsF = PyArray_DIMS(imgArray1);
@@ -136,15 +136,69 @@
exit:
/* return the 2D histogram */
- return PyErr_Occurred() ? NULL : (PyObject*)Py_BuildValue("O", hArray);
+ return PyErr_Occurred() ? NULL : (PyObject*)Py_BuildValue("");
}
+static PyObject *Register_LinearResample(PyObject *self, PyObject *args)
+{
+ int num;
+ int nd;
+ int type;
+ int itype;
+ int nd_rotmatrix;
+ int nd_S;
+ npy_intp *dimsF;
+ npy_intp *dimsG;
+ npy_intp *dims_rotmatrix;
+ npy_intp *dims_S;
+ unsigned char *imageG;
+ unsigned char *imageF;
+ double *M;
+ int *S;
+ PyObject *imgArray1 = NULL;
+ PyObject *imgArray2 = NULL;
+ PyObject *rotArray = NULL;
+ PyObject *SArray = NULL;
+
+ if(!PyArg_ParseTuple(args, "OOOO", &imgArray1, &imgArray2, &rotArray, &SArray))
+ 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);
+ /* 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);
+
+ M = (double *)PyArray_DATA(rotArray);
+ nd_rotmatrix = PyArray_NDIM(rotArray);
+ dims_rotmatrix = PyArray_DIMS(rotArray);
+
+ S = (int *)PyArray_DATA(SArray);
+ nd_S = PyArray_NDIM(SArray);
+ dims_S = PyArray_DIMS(SArray);
+
+ if(!NI_LinearResample((int)dimsF[0], (int)dimsF[1], (int)dimsF[2],
+ (int)dimsG[0], (int)dimsG[1], (int)dimsG[2],
+ S, M, imageG, imageF))
+ goto exit;
+
+exit:
+
+ return PyErr_Occurred() ? NULL : (PyObject*)Py_BuildValue("");
+
+}
+
static PyMethodDef RegisterMethods[] =
{
- { "register_histogram", Register_Histogram, METH_VARARGS, NULL },
- { "register_histogram_lite", Register_HistogramLite, METH_VARARGS, NULL },
+ { "register_histogram", Register_Histogram, METH_VARARGS, NULL },
+ { "register_histogram_lite", Register_HistogramLite, METH_VARARGS, NULL },
+ { "register_linear_resample", Register_LinearResample, METH_VARARGS, NULL },
{ NULL, NULL, 0, NULL},
};
More information about the Scipy-svn
mailing list