diff --git a/scikits/image/morphology/cmorph.c b/scikits/image/morphology/cmorph.c index 6cc67d72..64a4bf7a 100644 --- a/scikits/image/morphology/cmorph.c +++ b/scikits/image/morphology/cmorph.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.10.3 on Tue Aug 25 07:58:52 2009 */ +/* Generated by Cython 0.10.3 on Wed Nov 18 21:26:57 2009 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -400,7 +400,7 @@ static char __pyx_k_20[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_21[] = "Format string allocated too short."; static char __pyx_k_22[] = "unknown dtype code in numpy.pxd (%d)"; -/* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":18 +/* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":18 * ctypedef np.uint8_t IMAGE_DTYPE_t * * cdef inline int int_max(int a, int b): return a if a >= b else b # <<<<<<<<<<<<<< @@ -424,7 +424,7 @@ static INLINE int __pyx_f_7scikits_5image_10morphology_6cmorph_int_max(int __pyx return __pyx_r; } -/* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":19 +/* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":19 * * cdef inline int int_max(int a, int b): return a if a >= b else b * cdef inline int int_min(int a, int b): return a if a <= b else b # <<<<<<<<<<<<<< @@ -448,12 +448,12 @@ static INLINE int __pyx_f_7scikits_5image_10morphology_6cmorph_int_min(int __pyx return __pyx_r; } -/* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":22 +/* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":22 * * @cython.boundscheck(False) - * def dilate(np.ndarray[IMAGE_DTYPE_t, ndim=2] image not None, np.ndarray[IMAGE_DTYPE_t, ndim=2] selem not None, np.ndarray[IMAGE_DTYPE_t, ndim=2] out): # <<<<<<<<<<<<<< - * cdef int hw = selem.shape[0] / 2 - * cdef int hh = selem.shape[1] / 2 + * def dilate(np.ndarray[IMAGE_DTYPE_t, ndim=2] image not None, # <<<<<<<<<<<<<< + * np.ndarray[IMAGE_DTYPE_t, ndim=2] selem not None, + * np.ndarray[IMAGE_DTYPE_t, ndim=2] out): */ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ @@ -587,8 +587,8 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * __pyx_bstruct_selem.buf = NULL; __pyx_bstruct_out.buf = NULL; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_image), __pyx_ptype_5numpy_ndarray, 0, "image", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_selem), __pyx_ptype_5numpy_ndarray, 0, "selem", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_selem), __pyx_ptype_5numpy_ndarray, 0, "selem", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(__Pyx_GetBuffer_nn___pyx_t_7scikits_5image_10morphology_6cmorph_IMAGE_DTYPE_t((PyObject*)__pyx_v_image, &__pyx_bstruct_image, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_bstride_0_image = __pyx_bstruct_image.strides[0]; __pyx_bstride_1_image = __pyx_bstruct_image.strides[1]; __pyx_bshape_0_image = __pyx_bstruct_image.shape[0]; __pyx_bshape_1_image = __pyx_bstruct_image.shape[1]; @@ -599,17 +599,17 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * __pyx_bstride_0_out = __pyx_bstruct_out.strides[0]; __pyx_bstride_1_out = __pyx_bstruct_out.strides[1]; __pyx_bshape_0_out = __pyx_bstruct_out.shape[0]; __pyx_bshape_1_out = __pyx_bstruct_out.shape[1]; - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":23 - * @cython.boundscheck(False) - * def dilate(np.ndarray[IMAGE_DTYPE_t, ndim=2] image not None, np.ndarray[IMAGE_DTYPE_t, ndim=2] selem not None, np.ndarray[IMAGE_DTYPE_t, ndim=2] out): + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":25 + * np.ndarray[IMAGE_DTYPE_t, ndim=2] selem not None, + * np.ndarray[IMAGE_DTYPE_t, ndim=2] out): * cdef int hw = selem.shape[0] / 2 # <<<<<<<<<<<<<< * cdef int hh = selem.shape[1] / 2 * cdef int width = image.shape[0], height = image.shape[1] */ __pyx_v_hw = ((__pyx_v_selem->dimensions[0]) / 2); - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":24 - * def dilate(np.ndarray[IMAGE_DTYPE_t, ndim=2] image not None, np.ndarray[IMAGE_DTYPE_t, ndim=2] selem not None, np.ndarray[IMAGE_DTYPE_t, ndim=2] out): + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":26 + * np.ndarray[IMAGE_DTYPE_t, ndim=2] out): * cdef int hw = selem.shape[0] / 2 * cdef int hh = selem.shape[1] / 2 # <<<<<<<<<<<<<< * cdef int width = image.shape[0], height = image.shape[1] @@ -617,7 +617,7 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * */ __pyx_v_hh = ((__pyx_v_selem->dimensions[1]) / 2); - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":25 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":27 * cdef int hw = selem.shape[0] / 2 * cdef int hh = selem.shape[1] / 2 * cdef int width = image.shape[0], height = image.shape[1] # <<<<<<<<<<<<<< @@ -627,7 +627,7 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * __pyx_v_width = (__pyx_v_image->dimensions[0]); __pyx_v_height = (__pyx_v_image->dimensions[1]); - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":26 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":28 * cdef int hh = selem.shape[1] / 2 * cdef int width = image.shape[0], height = image.shape[1] * if out is None: # <<<<<<<<<<<<<< @@ -637,35 +637,35 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * __pyx_1 = (((PyObject *)__pyx_v_out) == Py_None); if (__pyx_1) { - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":27 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":29 * cdef int width = image.shape[0], height = image.shape[1] * if out is None: * out = np.zeros([width, height], dtype=IMAGE_DTYPE) # <<<<<<<<<<<<<< * * assert out.shape[0] == image.shape[0] */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_zeros); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_zeros); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyInt_FromLong(__pyx_v_width); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyInt_FromLong(__pyx_v_height); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyList_New(2); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_2 = PyInt_FromLong(__pyx_v_width); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = PyInt_FromLong(__pyx_v_height); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_5 = PyList_New(2); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyList_SET_ITEM(__pyx_5, 0, __pyx_2); PyList_SET_ITEM(__pyx_5, 1, __pyx_4); __pyx_2 = 0; __pyx_4 = 0; - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_5)); __pyx_5 = 0; - __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_IMAGE_DTYPE); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_4, __pyx_kp_dtype, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_IMAGE_DTYPE); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_4, __pyx_kp_dtype, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_5 = PyEval_CallObjectWithKeywords(__pyx_3, ((PyObject *)__pyx_2), ((PyObject *)__pyx_4)); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_5 = PyEval_CallObjectWithKeywords(__pyx_3, ((PyObject *)__pyx_2), ((PyObject *)__pyx_4)); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; - if (!(__Pyx_TypeTest(__pyx_5, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(__Pyx_TypeTest(__pyx_5, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = ((PyArrayObject *)__pyx_5); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); __pyx_t_2 = __Pyx_GetBuffer_nn___pyx_t_7scikits_5image_10morphology_6cmorph_IMAGE_DTYPE_t((PyObject*)__pyx_t_1, &__pyx_bstruct_out, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0); @@ -681,7 +681,7 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * } __pyx_bstride_0_out = __pyx_bstruct_out.strides[0]; __pyx_bstride_1_out = __pyx_bstruct_out.strides[1]; __pyx_bshape_0_out = __pyx_bstruct_out.shape[0]; __pyx_bshape_1_out = __pyx_bstruct_out.shape[1]; - if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = 0; Py_DECREF(((PyObject *)__pyx_v_out)); __pyx_v_out = ((PyArrayObject *)__pyx_5); @@ -690,7 +690,7 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * } __pyx_L6:; - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":29 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":31 * out = np.zeros([width, height], dtype=IMAGE_DTYPE) * * assert out.shape[0] == image.shape[0] # <<<<<<<<<<<<<< @@ -700,11 +700,11 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * #ifndef PYREX_WITHOUT_ASSERTIONS if (unlikely(!((__pyx_v_out->dimensions[0]) == (__pyx_v_image->dimensions[0])))) { PyErr_SetNone(PyExc_AssertionError); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":30 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":32 * * assert out.shape[0] == image.shape[0] * assert out.shape[1] == image.shape[1] # <<<<<<<<<<<<<< @@ -714,11 +714,11 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * #ifndef PYREX_WITHOUT_ASSERTIONS if (unlikely(!((__pyx_v_out->dimensions[1]) == (__pyx_v_image->dimensions[1])))) { PyErr_SetNone(PyExc_AssertionError); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":35 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":37 * cdef IMAGE_DTYPE_t max_so_far * * cdef int sw = selem.shape[0], sh = selem.shape[1] # <<<<<<<<<<<<<< @@ -728,41 +728,41 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * __pyx_v_sw = (__pyx_v_selem->dimensions[0]); __pyx_v_sh = (__pyx_v_selem->dimensions[1]); - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":37 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":39 * cdef int sw = selem.shape[0], sh = selem.shape[1] * * cdef np.ndarray[np.int_t, ndim=2] xinc = np.zeros([sw, sh], dtype=np.int) # <<<<<<<<<<<<<< * cdef np.ndarray[np.int_t, ndim=2] yinc = np.zeros([sw, sh], dtype=np.int) * */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_kp_zeros); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_kp_zeros); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_4 = PyInt_FromLong(__pyx_v_sw); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyInt_FromLong(__pyx_v_sh); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyList_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = PyInt_FromLong(__pyx_v_sw); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_5 = PyInt_FromLong(__pyx_v_sh); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = PyList_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyList_SET_ITEM(__pyx_3, 0, __pyx_4); PyList_SET_ITEM(__pyx_3, 1, __pyx_5); __pyx_4 = 0; __pyx_5 = 0; - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_3)); __pyx_3 = 0; - __pyx_5 = PyDict_New(); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_6 = PyObject_GetAttr(__pyx_3, __pyx_kp_int); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_5 = PyDict_New(); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_6 = PyObject_GetAttr(__pyx_3, __pyx_kp_int); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_3); __pyx_3 = 0; - if (PyDict_SetItem(__pyx_5, __pyx_kp_dtype, __pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_5, __pyx_kp_dtype, __pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_3 = PyEval_CallObjectWithKeywords(__pyx_2, ((PyObject *)__pyx_4), ((PyObject *)__pyx_5)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = PyEval_CallObjectWithKeywords(__pyx_2, ((PyObject *)__pyx_4), ((PyObject *)__pyx_5)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; Py_DECREF(((PyObject *)__pyx_5)); __pyx_5 = 0; - if (!(__Pyx_TypeTest(__pyx_3, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(__Pyx_TypeTest(__pyx_3, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_3); if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_int_t((PyObject*)__pyx_t_6, &__pyx_bstruct_xinc, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0) == -1)) { __pyx_v_xinc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_bstruct_xinc.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_xinc = __pyx_bstruct_xinc.strides[0]; __pyx_bstride_1_xinc = __pyx_bstruct_xinc.strides[1]; __pyx_bshape_0_xinc = __pyx_bstruct_xinc.shape[0]; __pyx_bshape_1_xinc = __pyx_bstruct_xinc.shape[1]; } @@ -770,41 +770,41 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * __pyx_v_xinc = ((PyArrayObject *)__pyx_3); __pyx_3 = 0; - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":38 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":40 * * cdef np.ndarray[np.int_t, ndim=2] xinc = np.zeros([sw, sh], dtype=np.int) * cdef np.ndarray[np.int_t, ndim=2] yinc = np.zeros([sw, sh], dtype=np.int) # <<<<<<<<<<<<<< * * for x in range(sw): */ - __pyx_6 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_6, __pyx_kp_zeros); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_6 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_2 = PyObject_GetAttr(__pyx_6, __pyx_kp_zeros); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_4 = PyInt_FromLong(__pyx_v_sw); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyInt_FromLong(__pyx_v_sh); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyList_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = PyInt_FromLong(__pyx_v_sw); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_5 = PyInt_FromLong(__pyx_v_sh); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = PyList_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyList_SET_ITEM(__pyx_3, 0, __pyx_4); PyList_SET_ITEM(__pyx_3, 1, __pyx_5); __pyx_4 = 0; __pyx_5 = 0; - __pyx_6 = PyTuple_New(1); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_6 = PyTuple_New(1); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyTuple_SET_ITEM(__pyx_6, 0, ((PyObject *)__pyx_3)); __pyx_3 = 0; - __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_kp_int); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_kp_int); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_5); __pyx_5 = 0; - if (PyDict_SetItem(__pyx_4, __pyx_kp_dtype, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_4, __pyx_kp_dtype, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_5 = PyEval_CallObjectWithKeywords(__pyx_2, ((PyObject *)__pyx_6), ((PyObject *)__pyx_4)); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_5 = PyEval_CallObjectWithKeywords(__pyx_2, ((PyObject *)__pyx_6), ((PyObject *)__pyx_4)); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(((PyObject *)__pyx_6)); __pyx_6 = 0; Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; - if (!(__Pyx_TypeTest(__pyx_5, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(__Pyx_TypeTest(__pyx_5, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = ((PyArrayObject *)__pyx_5); if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_int_t((PyObject*)__pyx_t_7, &__pyx_bstruct_yinc, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0) == -1)) { __pyx_v_yinc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_bstruct_yinc.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_yinc = __pyx_bstruct_yinc.strides[0]; __pyx_bstride_1_yinc = __pyx_bstruct_yinc.strides[1]; __pyx_bshape_0_yinc = __pyx_bstruct_yinc.shape[0]; __pyx_bshape_1_yinc = __pyx_bstruct_yinc.shape[1]; } @@ -812,7 +812,7 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * __pyx_v_yinc = ((PyArrayObject *)__pyx_5); __pyx_5 = 0; - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":40 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":42 * cdef np.ndarray[np.int_t, ndim=2] yinc = np.zeros([sw, sh], dtype=np.int) * * for x in range(sw): # <<<<<<<<<<<<<< @@ -821,7 +821,7 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * */ for (__pyx_v_x = 0; __pyx_v_x < __pyx_v_sw; __pyx_v_x+=1) { - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":41 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":43 * * for x in range(sw): * for y in range(sh): # <<<<<<<<<<<<<< @@ -830,7 +830,7 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * */ for (__pyx_v_y = 0; __pyx_v_y < __pyx_v_sh; __pyx_v_y+=1) { - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":42 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":44 * for x in range(sw): * for y in range(sh): * xinc[x, y] = (x - hw) # <<<<<<<<<<<<<< @@ -843,7 +843,7 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_1_xinc; *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int_t *, __pyx_bstruct_xinc.buf, __pyx_t_2, __pyx_bstride_0_xinc, __pyx_t_8, __pyx_bstride_1_xinc) = (__pyx_v_x - __pyx_v_hw); - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":43 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":45 * for y in range(sh): * xinc[x, y] = (x - hw) * yinc[x, y] = (y - hh) # <<<<<<<<<<<<<< @@ -858,7 +858,7 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * } } - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":46 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":48 * * * for x in range(width): # <<<<<<<<<<<<<< @@ -867,35 +867,35 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * */ for (__pyx_v_x = 0; __pyx_v_x < __pyx_v_width; __pyx_v_x+=1) { - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":47 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":49 * * for x in range(width): * for y in range(height): # <<<<<<<<<<<<<< * max_so_far = 0 - * #for cx in range(int_max(0, x - hw), int_min(x + hw, out.shape[0])): + * for cx in range(0, sw): */ for (__pyx_v_y = 0; __pyx_v_y < __pyx_v_height; __pyx_v_y+=1) { - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":48 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":50 * for x in range(width): * for y in range(height): * max_so_far = 0 # <<<<<<<<<<<<<< - * #for cx in range(int_max(0, x - hw), int_min(x + hw, out.shape[0])): - * #for cy in range(int_max(0, y - hh), int_min(y + hh, out.shape[1])): + * for cx in range(0, sw): + * for cy in range(0, sh): */ __pyx_v_max_so_far = 0; - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":51 - * #for cx in range(int_max(0, x - hw), int_min(x + hw, out.shape[0])): - * #for cy in range(int_max(0, y - hh), int_min(y + hh, out.shape[1])): + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":51 + * for y in range(height): + * max_so_far = 0 * for cx in range(0, sw): # <<<<<<<<<<<<<< * for cy in range(0, sh): * ix = x + xinc[cx,cy] */ for (__pyx_v_cx = 0; __pyx_v_cx < __pyx_v_sw; __pyx_v_cx+=1) { - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":52 - * #for cy in range(int_max(0, y - hh), int_min(y + hh, out.shape[1])): + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":52 + * max_so_far = 0 * for cx in range(0, sw): * for cy in range(0, sh): # <<<<<<<<<<<<<< * ix = x + xinc[cx,cy] @@ -903,12 +903,12 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * */ for (__pyx_v_cy = 0; __pyx_v_cy < __pyx_v_sh; __pyx_v_cy+=1) { - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":53 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":53 * for cx in range(0, sw): * for cy in range(0, sh): * ix = x + xinc[cx,cy] # <<<<<<<<<<<<<< * iy = y + yinc[cx,cy] - * if ix>=0 and iy>=0 and ix < width and iy < height and selem[cx, cy] == 1 and image[ix,iy] > max_so_far: + * if ix>=0 and iy>=0 and ix < width and iy < height \ */ __pyx_t_11 = __pyx_v_cx; __pyx_t_12 = __pyx_v_cy; @@ -916,12 +916,12 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_1_xinc; __pyx_v_ix = (__pyx_v_x + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int_t *, __pyx_bstruct_xinc.buf, __pyx_t_11, __pyx_bstride_0_xinc, __pyx_t_12, __pyx_bstride_1_xinc))); - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":54 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":54 * for cy in range(0, sh): * ix = x + xinc[cx,cy] * iy = y + yinc[cx,cy] # <<<<<<<<<<<<<< - * if ix>=0 and iy>=0 and ix < width and iy < height and selem[cx, cy] == 1 and image[ix,iy] > max_so_far: - * max_so_far = image[ix,iy] + * if ix>=0 and iy>=0 and ix < width and iy < height \ + * and selem[cx, cy] == 1 \ */ __pyx_t_13 = __pyx_v_cx; __pyx_t_14 = __pyx_v_cy; @@ -929,12 +929,12 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_1_yinc; __pyx_v_iy = (__pyx_v_y + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int_t *, __pyx_bstruct_yinc.buf, __pyx_t_13, __pyx_bstride_0_yinc, __pyx_t_14, __pyx_bstride_1_yinc))); - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":55 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":55 * ix = x + xinc[cx,cy] * iy = y + yinc[cx,cy] - * if ix>=0 and iy>=0 and ix < width and iy < height and selem[cx, cy] == 1 and image[ix,iy] > max_so_far: # <<<<<<<<<<<<<< - * max_so_far = image[ix,iy] - * out[x,y] = max_so_far + * if ix>=0 and iy>=0 and ix < width and iy < height \ # <<<<<<<<<<<<<< + * and selem[cx, cy] == 1 \ + * and image[ix,iy] > max_so_far: */ __pyx_1 = (__pyx_v_ix >= 0); if (__pyx_1) { @@ -942,6 +942,14 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * if (__pyx_1) { __pyx_1 = (__pyx_v_ix < __pyx_v_width); if (__pyx_1) { + + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":56 + * iy = y + yinc[cx,cy] + * if ix>=0 and iy>=0 and ix < width and iy < height \ + * and selem[cx, cy] == 1 \ # <<<<<<<<<<<<<< + * and image[ix,iy] > max_so_far: + * max_so_far = image[ix,iy] + */ __pyx_1 = (__pyx_v_iy < __pyx_v_height); if (__pyx_1) { __pyx_t_15 = __pyx_v_cx; @@ -950,6 +958,14 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_1_selem; __pyx_1 = ((*__Pyx_BufPtrStrided2d(__pyx_t_7scikits_5image_10morphology_6cmorph_IMAGE_DTYPE_t *, __pyx_bstruct_selem.buf, __pyx_t_15, __pyx_bstride_0_selem, __pyx_t_16, __pyx_bstride_1_selem)) == 1); if (__pyx_1) { + + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":57 + * if ix>=0 and iy>=0 and ix < width and iy < height \ + * and selem[cx, cy] == 1 \ + * and image[ix,iy] > max_so_far: # <<<<<<<<<<<<<< + * max_so_far = image[ix,iy] + * out[x,y] = max_so_far + */ __pyx_t_17 = __pyx_v_ix; __pyx_t_18 = __pyx_v_iy; if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_0_image; @@ -962,9 +978,9 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * } if (__pyx_1) { - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":56 - * iy = y + yinc[cx,cy] - * if ix>=0 and iy>=0 and ix < width and iy < height and selem[cx, cy] == 1 and image[ix,iy] > max_so_far: + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":58 + * and selem[cx, cy] == 1 \ + * and image[ix,iy] > max_so_far: * max_so_far = image[ix,iy] # <<<<<<<<<<<<<< * out[x,y] = max_so_far * @@ -980,8 +996,8 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * } } - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":57 - * if ix>=0 and iy>=0 and ix < width and iy < height and selem[cx, cy] == 1 and image[ix,iy] > max_so_far: + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":59 + * and image[ix,iy] > max_so_far: * max_so_far = image[ix,iy] * out[x,y] = max_so_far # <<<<<<<<<<<<<< * @@ -995,7 +1011,7 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * } } - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":59 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":61 * out[x,y] = max_so_far * * return out # <<<<<<<<<<<<<< @@ -1038,12 +1054,12 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_dilate(PyObject * return __pyx_r; } -/* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":63 +/* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":65 * * @cython.boundscheck(False) - * def erode(np.ndarray[IMAGE_DTYPE_t, ndim=2] image not None, np.ndarray[IMAGE_DTYPE_t, ndim=2] selem not None, np.ndarray[IMAGE_DTYPE_t, ndim=2] out): # <<<<<<<<<<<<<< - * cdef int hw = selem.shape[0] / 2 - * cdef int hh = selem.shape[1] / 2 + * def erode(np.ndarray[IMAGE_DTYPE_t, ndim=2] image not None, # <<<<<<<<<<<<<< + * np.ndarray[IMAGE_DTYPE_t, ndim=2] selem not None, + * np.ndarray[IMAGE_DTYPE_t, ndim=2] out): */ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ @@ -1141,17 +1157,17 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_selem); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("erode", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("erode", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_out); if (likely(values[2])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("erode", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("erode", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "erode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "erode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_image = ((PyArrayObject *)values[0]); __pyx_v_selem = ((PyArrayObject *)values[1]); @@ -1165,7 +1181,7 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("erode", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("erode", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("scikits.image.morphology.cmorph.erode"); return NULL; @@ -1176,30 +1192,30 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ __pyx_bstruct_image.buf = NULL; __pyx_bstruct_selem.buf = NULL; __pyx_bstruct_out.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_image), __pyx_ptype_5numpy_ndarray, 0, "image", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_selem), __pyx_ptype_5numpy_ndarray, 0, "selem", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(__Pyx_GetBuffer_nn___pyx_t_7scikits_5image_10morphology_6cmorph_IMAGE_DTYPE_t((PyObject*)__pyx_v_image, &__pyx_bstruct_image, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_image), __pyx_ptype_5numpy_ndarray, 0, "image", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_selem), __pyx_ptype_5numpy_ndarray, 0, "selem", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBuffer_nn___pyx_t_7scikits_5image_10morphology_6cmorph_IMAGE_DTYPE_t((PyObject*)__pyx_v_image, &__pyx_bstruct_image, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_bstride_0_image = __pyx_bstruct_image.strides[0]; __pyx_bstride_1_image = __pyx_bstruct_image.strides[1]; __pyx_bshape_0_image = __pyx_bstruct_image.shape[0]; __pyx_bshape_1_image = __pyx_bstruct_image.shape[1]; - if (unlikely(__Pyx_GetBuffer_nn___pyx_t_7scikits_5image_10morphology_6cmorph_IMAGE_DTYPE_t((PyObject*)__pyx_v_selem, &__pyx_bstruct_selem, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBuffer_nn___pyx_t_7scikits_5image_10morphology_6cmorph_IMAGE_DTYPE_t((PyObject*)__pyx_v_selem, &__pyx_bstruct_selem, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_bstride_0_selem = __pyx_bstruct_selem.strides[0]; __pyx_bstride_1_selem = __pyx_bstruct_selem.strides[1]; __pyx_bshape_0_selem = __pyx_bstruct_selem.shape[0]; __pyx_bshape_1_selem = __pyx_bstruct_selem.shape[1]; - if (unlikely(__Pyx_GetBuffer_nn___pyx_t_7scikits_5image_10morphology_6cmorph_IMAGE_DTYPE_t((PyObject*)__pyx_v_out, &__pyx_bstruct_out, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBuffer_nn___pyx_t_7scikits_5image_10morphology_6cmorph_IMAGE_DTYPE_t((PyObject*)__pyx_v_out, &__pyx_bstruct_out, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_bstride_0_out = __pyx_bstruct_out.strides[0]; __pyx_bstride_1_out = __pyx_bstruct_out.strides[1]; __pyx_bshape_0_out = __pyx_bstruct_out.shape[0]; __pyx_bshape_1_out = __pyx_bstruct_out.shape[1]; - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":64 - * @cython.boundscheck(False) - * def erode(np.ndarray[IMAGE_DTYPE_t, ndim=2] image not None, np.ndarray[IMAGE_DTYPE_t, ndim=2] selem not None, np.ndarray[IMAGE_DTYPE_t, ndim=2] out): + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":68 + * np.ndarray[IMAGE_DTYPE_t, ndim=2] selem not None, + * np.ndarray[IMAGE_DTYPE_t, ndim=2] out): * cdef int hw = selem.shape[0] / 2 # <<<<<<<<<<<<<< * cdef int hh = selem.shape[1] / 2 * cdef int width = image.shape[0], height = image.shape[1] */ __pyx_v_hw = ((__pyx_v_selem->dimensions[0]) / 2); - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":65 - * def erode(np.ndarray[IMAGE_DTYPE_t, ndim=2] image not None, np.ndarray[IMAGE_DTYPE_t, ndim=2] selem not None, np.ndarray[IMAGE_DTYPE_t, ndim=2] out): + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":69 + * np.ndarray[IMAGE_DTYPE_t, ndim=2] out): * cdef int hw = selem.shape[0] / 2 * cdef int hh = selem.shape[1] / 2 # <<<<<<<<<<<<<< * cdef int width = image.shape[0], height = image.shape[1] @@ -1207,7 +1223,7 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ */ __pyx_v_hh = ((__pyx_v_selem->dimensions[1]) / 2); - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":66 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":70 * cdef int hw = selem.shape[0] / 2 * cdef int hh = selem.shape[1] / 2 * cdef int width = image.shape[0], height = image.shape[1] # <<<<<<<<<<<<<< @@ -1217,7 +1233,7 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ __pyx_v_width = (__pyx_v_image->dimensions[0]); __pyx_v_height = (__pyx_v_image->dimensions[1]); - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":67 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":71 * cdef int hh = selem.shape[1] / 2 * cdef int width = image.shape[0], height = image.shape[1] * if out is None: # <<<<<<<<<<<<<< @@ -1227,35 +1243,35 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ __pyx_1 = (((PyObject *)__pyx_v_out) == Py_None); if (__pyx_1) { - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":68 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":72 * cdef int width = image.shape[0], height = image.shape[1] * if out is None: * out = np.zeros([width, height], dtype=IMAGE_DTYPE) # <<<<<<<<<<<<<< * * assert out.shape[0] == image.shape[0] */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_zeros); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_zeros); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyInt_FromLong(__pyx_v_width); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyInt_FromLong(__pyx_v_height); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyList_New(2); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_2 = PyInt_FromLong(__pyx_v_width); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = PyInt_FromLong(__pyx_v_height); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_5 = PyList_New(2); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyList_SET_ITEM(__pyx_5, 0, __pyx_2); PyList_SET_ITEM(__pyx_5, 1, __pyx_4); __pyx_2 = 0; __pyx_4 = 0; - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_5)); __pyx_5 = 0; - __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_IMAGE_DTYPE); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_4, __pyx_kp_dtype, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_IMAGE_DTYPE); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_4, __pyx_kp_dtype, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_5 = PyEval_CallObjectWithKeywords(__pyx_3, ((PyObject *)__pyx_2), ((PyObject *)__pyx_4)); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_5 = PyEval_CallObjectWithKeywords(__pyx_3, ((PyObject *)__pyx_2), ((PyObject *)__pyx_4)); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; - if (!(__Pyx_TypeTest(__pyx_5, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(__Pyx_TypeTest(__pyx_5, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = ((PyArrayObject *)__pyx_5); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); __pyx_t_2 = __Pyx_GetBuffer_nn___pyx_t_7scikits_5image_10morphology_6cmorph_IMAGE_DTYPE_t((PyObject*)__pyx_t_1, &__pyx_bstruct_out, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0); @@ -1271,7 +1287,7 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ } __pyx_bstride_0_out = __pyx_bstruct_out.strides[0]; __pyx_bstride_1_out = __pyx_bstruct_out.strides[1]; __pyx_bshape_0_out = __pyx_bstruct_out.shape[0]; __pyx_bshape_1_out = __pyx_bstruct_out.shape[1]; - if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = 0; Py_DECREF(((PyObject *)__pyx_v_out)); __pyx_v_out = ((PyArrayObject *)__pyx_5); @@ -1280,7 +1296,7 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ } __pyx_L6:; - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":70 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":74 * out = np.zeros([width, height], dtype=IMAGE_DTYPE) * * assert out.shape[0] == image.shape[0] # <<<<<<<<<<<<<< @@ -1290,11 +1306,11 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ #ifndef PYREX_WITHOUT_ASSERTIONS if (unlikely(!((__pyx_v_out->dimensions[0]) == (__pyx_v_image->dimensions[0])))) { PyErr_SetNone(PyExc_AssertionError); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":71 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":75 * * assert out.shape[0] == image.shape[0] * assert out.shape[1] == image.shape[1] # <<<<<<<<<<<<<< @@ -1304,11 +1320,11 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ #ifndef PYREX_WITHOUT_ASSERTIONS if (unlikely(!((__pyx_v_out->dimensions[1]) == (__pyx_v_image->dimensions[1])))) { PyErr_SetNone(PyExc_AssertionError); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":76 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":80 * cdef IMAGE_DTYPE_t min_so_far * * cdef int sw = selem.shape[0], sh = selem.shape[1] # <<<<<<<<<<<<<< @@ -1318,41 +1334,41 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ __pyx_v_sw = (__pyx_v_selem->dimensions[0]); __pyx_v_sh = (__pyx_v_selem->dimensions[1]); - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":78 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":82 * cdef int sw = selem.shape[0], sh = selem.shape[1] * * cdef np.ndarray[np.int_t, ndim=2] xinc = np.zeros([sw, sh], dtype=np.int) # <<<<<<<<<<<<<< * cdef np.ndarray[np.int_t, ndim=2] yinc = np.zeros([sw, sh], dtype=np.int) * */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_kp_zeros); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_kp_zeros); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_4 = PyInt_FromLong(__pyx_v_sw); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyInt_FromLong(__pyx_v_sh); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyList_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = PyInt_FromLong(__pyx_v_sw); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_5 = PyInt_FromLong(__pyx_v_sh); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = PyList_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyList_SET_ITEM(__pyx_3, 0, __pyx_4); PyList_SET_ITEM(__pyx_3, 1, __pyx_5); __pyx_4 = 0; __pyx_5 = 0; - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_3)); __pyx_3 = 0; - __pyx_5 = PyDict_New(); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_6 = PyObject_GetAttr(__pyx_3, __pyx_kp_int); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_5 = PyDict_New(); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_6 = PyObject_GetAttr(__pyx_3, __pyx_kp_int); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_3); __pyx_3 = 0; - if (PyDict_SetItem(__pyx_5, __pyx_kp_dtype, __pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_5, __pyx_kp_dtype, __pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_3 = PyEval_CallObjectWithKeywords(__pyx_2, ((PyObject *)__pyx_4), ((PyObject *)__pyx_5)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = PyEval_CallObjectWithKeywords(__pyx_2, ((PyObject *)__pyx_4), ((PyObject *)__pyx_5)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; Py_DECREF(((PyObject *)__pyx_5)); __pyx_5 = 0; - if (!(__Pyx_TypeTest(__pyx_3, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(__Pyx_TypeTest(__pyx_3, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_3); if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_int_t((PyObject*)__pyx_t_6, &__pyx_bstruct_xinc, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0) == -1)) { __pyx_v_xinc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_bstruct_xinc.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_xinc = __pyx_bstruct_xinc.strides[0]; __pyx_bstride_1_xinc = __pyx_bstruct_xinc.strides[1]; __pyx_bshape_0_xinc = __pyx_bstruct_xinc.shape[0]; __pyx_bshape_1_xinc = __pyx_bstruct_xinc.shape[1]; } @@ -1360,41 +1376,41 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ __pyx_v_xinc = ((PyArrayObject *)__pyx_3); __pyx_3 = 0; - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":79 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":83 * * cdef np.ndarray[np.int_t, ndim=2] xinc = np.zeros([sw, sh], dtype=np.int) * cdef np.ndarray[np.int_t, ndim=2] yinc = np.zeros([sw, sh], dtype=np.int) # <<<<<<<<<<<<<< * * for x in range(sw): */ - __pyx_6 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_6, __pyx_kp_zeros); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_6 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_2 = PyObject_GetAttr(__pyx_6, __pyx_kp_zeros); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_4 = PyInt_FromLong(__pyx_v_sw); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyInt_FromLong(__pyx_v_sh); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyList_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = PyInt_FromLong(__pyx_v_sw); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_5 = PyInt_FromLong(__pyx_v_sh); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = PyList_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyList_SET_ITEM(__pyx_3, 0, __pyx_4); PyList_SET_ITEM(__pyx_3, 1, __pyx_5); __pyx_4 = 0; __pyx_5 = 0; - __pyx_6 = PyTuple_New(1); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_6 = PyTuple_New(1); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyTuple_SET_ITEM(__pyx_6, 0, ((PyObject *)__pyx_3)); __pyx_3 = 0; - __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_kp_int); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_kp_int); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_5); __pyx_5 = 0; - if (PyDict_SetItem(__pyx_4, __pyx_kp_dtype, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_4, __pyx_kp_dtype, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_5 = PyEval_CallObjectWithKeywords(__pyx_2, ((PyObject *)__pyx_6), ((PyObject *)__pyx_4)); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_5 = PyEval_CallObjectWithKeywords(__pyx_2, ((PyObject *)__pyx_6), ((PyObject *)__pyx_4)); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(((PyObject *)__pyx_6)); __pyx_6 = 0; Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; - if (!(__Pyx_TypeTest(__pyx_5, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(__Pyx_TypeTest(__pyx_5, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = ((PyArrayObject *)__pyx_5); if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_int_t((PyObject*)__pyx_t_7, &__pyx_bstruct_yinc, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0) == -1)) { __pyx_v_yinc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_bstruct_yinc.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_yinc = __pyx_bstruct_yinc.strides[0]; __pyx_bstride_1_yinc = __pyx_bstruct_yinc.strides[1]; __pyx_bshape_0_yinc = __pyx_bstruct_yinc.shape[0]; __pyx_bshape_1_yinc = __pyx_bstruct_yinc.shape[1]; } @@ -1402,7 +1418,7 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ __pyx_v_yinc = ((PyArrayObject *)__pyx_5); __pyx_5 = 0; - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":81 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":85 * cdef np.ndarray[np.int_t, ndim=2] yinc = np.zeros([sw, sh], dtype=np.int) * * for x in range(sw): # <<<<<<<<<<<<<< @@ -1411,7 +1427,7 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ */ for (__pyx_v_x = 0; __pyx_v_x < __pyx_v_sw; __pyx_v_x+=1) { - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":82 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":86 * * for x in range(sw): * for y in range(sh): # <<<<<<<<<<<<<< @@ -1420,7 +1436,7 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ */ for (__pyx_v_y = 0; __pyx_v_y < __pyx_v_sh; __pyx_v_y+=1) { - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":83 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":87 * for x in range(sw): * for y in range(sh): * xinc[x, y] = (x - hw) # <<<<<<<<<<<<<< @@ -1433,7 +1449,7 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_1_xinc; *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int_t *, __pyx_bstruct_xinc.buf, __pyx_t_2, __pyx_bstride_0_xinc, __pyx_t_8, __pyx_bstride_1_xinc) = (__pyx_v_x - __pyx_v_hw); - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":84 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":88 * for y in range(sh): * xinc[x, y] = (x - hw) * yinc[x, y] = (y - hh) # <<<<<<<<<<<<<< @@ -1448,7 +1464,7 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ } } - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":86 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":90 * yinc[x, y] = (y - hh) * * for x in range(width): # <<<<<<<<<<<<<< @@ -1457,35 +1473,35 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ */ for (__pyx_v_x = 0; __pyx_v_x < __pyx_v_width; __pyx_v_x+=1) { - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":87 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":91 * * for x in range(width): * for y in range(height): # <<<<<<<<<<<<<< * min_so_far = 255 - * #for cx in range(int_max(0, x - hw), int_min(x + hw, out.shape[0])): + * for cx in range(0, sw): */ for (__pyx_v_y = 0; __pyx_v_y < __pyx_v_height; __pyx_v_y+=1) { - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":88 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":92 * for x in range(width): * for y in range(height): * min_so_far = 255 # <<<<<<<<<<<<<< - * #for cx in range(int_max(0, x - hw), int_min(x + hw, out.shape[0])): - * #for cy in range(int_max(0, y - hh), int_min(y + hh, out.shape[1])): + * for cx in range(0, sw): + * for cy in range(0, sh): */ __pyx_v_min_so_far = 255; - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":91 - * #for cx in range(int_max(0, x - hw), int_min(x + hw, out.shape[0])): - * #for cy in range(int_max(0, y - hh), int_min(y + hh, out.shape[1])): + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":93 + * for y in range(height): + * min_so_far = 255 * for cx in range(0, sw): # <<<<<<<<<<<<<< * for cy in range(0, sh): * ix = x + xinc[cx,cy] */ for (__pyx_v_cx = 0; __pyx_v_cx < __pyx_v_sw; __pyx_v_cx+=1) { - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":92 - * #for cy in range(int_max(0, y - hh), int_min(y + hh, out.shape[1])): + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":94 + * min_so_far = 255 * for cx in range(0, sw): * for cy in range(0, sh): # <<<<<<<<<<<<<< * ix = x + xinc[cx,cy] @@ -1493,12 +1509,12 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ */ for (__pyx_v_cy = 0; __pyx_v_cy < __pyx_v_sh; __pyx_v_cy+=1) { - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":93 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":95 * for cx in range(0, sw): * for cy in range(0, sh): * ix = x + xinc[cx,cy] # <<<<<<<<<<<<<< * iy = y + yinc[cx,cy] - * if ix>=0 and iy>=0 and ix < width and iy < height and selem[cx, cy] == 1 and image[ix,iy] < min_so_far: + * if ix>=0 and iy>=0 and ix < width \ */ __pyx_t_11 = __pyx_v_cx; __pyx_t_12 = __pyx_v_cy; @@ -1506,12 +1522,12 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_1_xinc; __pyx_v_ix = (__pyx_v_x + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int_t *, __pyx_bstruct_xinc.buf, __pyx_t_11, __pyx_bstride_0_xinc, __pyx_t_12, __pyx_bstride_1_xinc))); - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":94 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":96 * for cy in range(0, sh): * ix = x + xinc[cx,cy] * iy = y + yinc[cx,cy] # <<<<<<<<<<<<<< - * if ix>=0 and iy>=0 and ix < width and iy < height and selem[cx, cy] == 1 and image[ix,iy] < min_so_far: - * min_so_far = image[ix,iy] + * if ix>=0 and iy>=0 and ix < width \ + * and iy < height and selem[cx, cy] == 1 \ */ __pyx_t_13 = __pyx_v_cx; __pyx_t_14 = __pyx_v_cy; @@ -1519,17 +1535,25 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_1_yinc; __pyx_v_iy = (__pyx_v_y + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int_t *, __pyx_bstruct_yinc.buf, __pyx_t_13, __pyx_bstride_0_yinc, __pyx_t_14, __pyx_bstride_1_yinc))); - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":95 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":97 * ix = x + xinc[cx,cy] * iy = y + yinc[cx,cy] - * if ix>=0 and iy>=0 and ix < width and iy < height and selem[cx, cy] == 1 and image[ix,iy] < min_so_far: # <<<<<<<<<<<<<< - * min_so_far = image[ix,iy] - * out[x,y] = min_so_far + * if ix>=0 and iy>=0 and ix < width \ # <<<<<<<<<<<<<< + * and iy < height and selem[cx, cy] == 1 \ + * and image[ix,iy] < min_so_far: */ __pyx_1 = (__pyx_v_ix >= 0); if (__pyx_1) { __pyx_1 = (__pyx_v_iy >= 0); if (__pyx_1) { + + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":98 + * iy = y + yinc[cx,cy] + * if ix>=0 and iy>=0 and ix < width \ + * and iy < height and selem[cx, cy] == 1 \ # <<<<<<<<<<<<<< + * and image[ix,iy] < min_so_far: + * min_so_far = image[ix,iy] + */ __pyx_1 = (__pyx_v_ix < __pyx_v_width); if (__pyx_1) { __pyx_1 = (__pyx_v_iy < __pyx_v_height); @@ -1540,6 +1564,14 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_1_selem; __pyx_1 = ((*__Pyx_BufPtrStrided2d(__pyx_t_7scikits_5image_10morphology_6cmorph_IMAGE_DTYPE_t *, __pyx_bstruct_selem.buf, __pyx_t_15, __pyx_bstride_0_selem, __pyx_t_16, __pyx_bstride_1_selem)) == 1); if (__pyx_1) { + + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":99 + * if ix>=0 and iy>=0 and ix < width \ + * and iy < height and selem[cx, cy] == 1 \ + * and image[ix,iy] < min_so_far: # <<<<<<<<<<<<<< + * min_so_far = image[ix,iy] + * out[x,y] = min_so_far + */ __pyx_t_17 = __pyx_v_ix; __pyx_t_18 = __pyx_v_iy; if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_0_image; @@ -1552,9 +1584,9 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ } if (__pyx_1) { - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":96 - * iy = y + yinc[cx,cy] - * if ix>=0 and iy>=0 and ix < width and iy < height and selem[cx, cy] == 1 and image[ix,iy] < min_so_far: + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":100 + * and iy < height and selem[cx, cy] == 1 \ + * and image[ix,iy] < min_so_far: * min_so_far = image[ix,iy] # <<<<<<<<<<<<<< * out[x,y] = min_so_far * @@ -1570,8 +1602,8 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ } } - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":97 - * if ix>=0 and iy>=0 and ix < width and iy < height and selem[cx, cy] == 1 and image[ix,iy] < min_so_far: + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":101 + * and image[ix,iy] < min_so_far: * min_so_far = image[ix,iy] * out[x,y] = min_so_far # <<<<<<<<<<<<<< * @@ -1585,7 +1617,7 @@ static PyObject *__pyx_pf_7scikits_5image_10morphology_6cmorph_erode(PyObject *_ } } - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":99 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":103 * out[x,y] = min_so_far * * return out # <<<<<<<<<<<<<< @@ -2975,7 +3007,7 @@ PyMODINIT_FUNC PyInit_cmorph(void) /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":7 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":7 * * from __future__ import division * import numpy as np # <<<<<<<<<<<<<< @@ -2986,7 +3018,7 @@ PyMODINIT_FUNC PyInit_cmorph(void) if (PyObject_SetAttr(__pyx_m, __pyx_kp_np, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":12 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":12 * cimport cython * * STREL_DTYPE = np.uint8 # <<<<<<<<<<<<<< @@ -2999,7 +3031,7 @@ PyMODINIT_FUNC PyInit_cmorph(void) if (PyObject_SetAttr(__pyx_m, __pyx_kp_STREL_DTYPE, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; - /* "/home/eads/work/repo/try/scikits.image/scikits/image/morphology/cmorph.pyx":15 + /* "/home/eads/work/repo/scikits.image/scikits/image/morphology/cmorph.pyx":15 * ctypedef np.uint8_t STREL_DTYPE_t * * IMAGE_DTYPE = np.uint8 # <<<<<<<<<<<<<< diff --git a/scikits/image/morphology/cmorph.pyx b/scikits/image/morphology/cmorph.pyx index fb190f83..c0c1d920 100644 --- a/scikits/image/morphology/cmorph.pyx +++ b/scikits/image/morphology/cmorph.pyx @@ -18,7 +18,7 @@ ctypedef np.uint8_t IMAGE_DTYPE_t cdef inline int int_max(int a, int b): return a if a >= b else b cdef inline int int_min(int a, int b): return a if a <= b else b -@cython.boundsgcheck(False) +@cython.boundscheck(False) def dilate(np.ndarray[IMAGE_DTYPE_t, ndim=2] image not None, np.ndarray[IMAGE_DTYPE_t, ndim=2] selem not None, np.ndarray[IMAGE_DTYPE_t, ndim=2] out): diff --git a/scikits/image/morphology/grey.py b/scikits/image/morphology/grey.py index 64880ccf..58a93a67 100644 --- a/scikits/image/morphology/grey.py +++ b/scikits/image/morphology/grey.py @@ -35,7 +35,7 @@ def greyscale_erode(image, selem, out=None): if image is out: raise NotImplementedError("In-place erosion not supported!") try: - import cmorph + import scikits.image.morphology.cmorph as cmorph out = cmorph.erode(image, selem, out=out) return out; except ImportError: diff --git a/scikits/image/morphology/selem.py b/scikits/image/morphology/selem.py index 327f3deb..cf786d6d 100644 --- a/scikits/image/morphology/selem.py +++ b/scikits/image/morphology/selem.py @@ -86,7 +86,7 @@ def diamond(radius, dtype=np.uint8): s = np.abs(I-half)+np.abs(J-half) return np.array(s <= radius, dtype=dtype) -def disk(radius, N=0, dtype=np.uint8): +def disk(radius, dtype=np.uint8): """ Generates a flat, disk-shaped structuring element of a given radius. A pixel is within the neighborhood iff the euclidean distance between @@ -106,109 +106,8 @@ def disk(radius, N=0, dtype=np.uint8): The structuring element where elements of the neighborhood are 1 and 0 otherwise. """ - half = radius - (I, J) = np.meshgrid(xrange(0, radius*2+1), xrange(0, radius*2+1)) - if N == 0: - s = (I-half)**2.+(J-half)**2. - #print s - else: - raise NotImplementedError(""" - scikits.image.morphology.disk: approximations not implemented. - - Try N=0 for now. - """) + L = np.linspace(-radius, radius, 2*radius+1) + (X, Y) = np.meshgrid(L, L) + s = X**2 + s += Y**2 return np.array(s <= radius * radius, dtype=dtype) - -def ellipse(size, angle, ratio=0.5, dtype=np.uint8): - """ - Generates an elliptically-shaped structuring element of a given - angle, ratio, and kernel size. - - Parameters - ---------- - size : int - The half-width of the kernel. The kernel size is 2*size+1. - - angle : float - The angle of rotation of the ellipse in radians. - - ratio : float - The aspect ratio of the ellipse. - - dtype : data-type - The data type of the structuring element. - - Returns - ------- - selem : ndarray - The structuring element where elements of the neighborhood - are 1 and 0 otherwise. - """ - structure = np.zeros((2*size+1, 2*size+1), dtype=dtype) - - a = np.matrix([np.cos(angle), np.sin(angle)]) - b = np.matrix([-np.sin(angle), np.cos(angle)]) - aspect = a.T * a + b.T * b / ratio - - for y in xrange(-size, size+ 1): - for x in xrange(-size, size + 1): - i = x+size - j = y+size - - v = np.matrix([x,y], dtype='f') / float(size) - n = v * aspect * v.T - - if n < 1: - structure[i, j] = 1 - return structure - -def strel(shape='disk', N=0, radius=3, width=3, height=3, angle=0., length=3, - dtype=np.uint8, out=None): - """ - Generates a structuring element for greyscale or binary morphology. - The interface of this function is similar to MATLAB(TM)'s strel function. - - Parameters - ---------- - shape : string - A string identifier for the shape of the structuring element, - which can be any of the following: 'arbitrary', 'ball', - 'diamond', 'disk', 'pair', 'rectangle', 'square'. - - N : int - When non-zero, the number of lines to approximate the - structuring element. (not implemented) - - radius : int - The radius for disk or diamond structuring elements. - - width : int - The height for square, ball or rectangle-shaped structuring elements. - - height : int - The height for ball or rectangle-shaped structuring elements. - - size : int - The half-width of an elliptical structuring element. - - aspect : float - The aspect ratio of an ellipse. - - Returns - ------- - neighborhood : ndarray - The structuring element. - """ - shape = shape.lower().strip() - if shape == 'disk': - return disk(radius, dtype=dtype) - elif shape == 'diamond': - return diamond(radius, dtype=dtype) - elif shape == 'square': - return square(width, dtype=dtype) - elif shape == 'rectangle': - return rectangle(width, height, dtype=dtype) - elif shape == 'ellipse': - return ellipse(size, angle, ratio, dtype=dtype) - else: - raise ValueError("Unknown structuring element type '%s'" % shape) diff --git a/scikits/image/version.py b/scikits/image/version.py index f3e7125f..48bcda85 100644 --- a/scikits/image/version.py +++ b/scikits/image/version.py @@ -1,2 +1,2 @@ -version='unbuilt-dev' - +# THIS FILE IS GENERATED FROM THE SCIKITS.IMAGE SETUP.PY +version='0.2dev'