コード例 #1
0
ファイル: nd_image.c プロジェクト: kapteyn-astro/kapteyn
static PyObject *Py_Label(PyObject *obj, PyObject *args)
{
    PyArrayObject *input = NULL, *output = NULL, *strct = NULL;
    maybelong max_label;

    if (!PyArg_ParseTuple(args, "O&O&O&", NI_ObjectToInputArray, &input,
                    NI_ObjectToInputArray, &strct, NI_ObjectToOutputArray, &output))
        goto exit;

    if (!NI_Label(input, strct, &max_label, output))
        goto exit;

exit:
    Py_XDECREF(input);
    Py_XDECREF(strct);
    Py_XDECREF(output);
    return PyErr_Occurred() ? NULL : Py_BuildValue("l", (long)max_label);
}
コード例 #2
0
static PyObject *Py_Label(PyObject *obj, PyObject *args)
{
    PyArrayObject *input = NULL, *output = NULL, *strct = NULL;
    npy_intp max_label;

    if (!PyArg_ParseTuple(args, "O&O&O&",
                          NI_ObjectToInputArray, &input,
                          NI_ObjectToInputArray, &strct,
                          NI_ObjectToOutputArray, &output))
        goto exit;

    if (!NI_Label(input, strct, &max_label, output))
        goto exit;

exit:
    Py_XDECREF(input);
    Py_XDECREF(strct);
    Py_XDECREF(output);
#if PY_VERSION_HEX < 0x02050000
    return PyErr_Occurred() ? NULL : Py_BuildValue("l", (long)max_label);
#else
    return PyErr_Occurred() ? NULL : Py_BuildValue("n", (npy_intp)max_label);
#endif
}