diff --git a/skimage/morphology/ccomp.pxd b/skimage/morphology/ccomp.pxd index 569921fa..62d21fec 100644 --- a/skimage/morphology/ccomp.pxd +++ b/skimage/morphology/ccomp.pxd @@ -5,6 +5,6 @@ DTYPE = cnp.intp ctypedef cnp.intp_t DTYPE_t cdef DTYPE_t find_root(DTYPE_t *forest, DTYPE_t n) -cdef set_root(DTYPE_t *forest, DTYPE_t n, DTYPE_t root) -cdef join_trees(DTYPE_t *forest, DTYPE_t n, DTYPE_t m) -cdef link_bg(DTYPE_t *forest, DTYPE_t n, DTYPE_t *background_node) +cdef void set_root(DTYPE_t *forest, DTYPE_t n, DTYPE_t root) +cdef void join_trees(DTYPE_t *forest, DTYPE_t n, DTYPE_t m) +cdef void link_bg(DTYPE_t *forest, DTYPE_t n, DTYPE_t *background_node) diff --git a/skimage/morphology/ccomp.pyx b/skimage/morphology/ccomp.pyx index 1db78a6d..5d449e62 100644 --- a/skimage/morphology/ccomp.pyx +++ b/skimage/morphology/ccomp.pyx @@ -39,7 +39,7 @@ cdef DTYPE_t find_root(DTYPE_t *forest, DTYPE_t n): return root -cdef set_root(DTYPE_t *forest, DTYPE_t n, DTYPE_t root): +cdef inline void set_root(DTYPE_t *forest, DTYPE_t n, DTYPE_t root): """ Set all nodes on a path to point to new_root. @@ -53,7 +53,7 @@ cdef set_root(DTYPE_t *forest, DTYPE_t n, DTYPE_t root): forest[n] = root -cdef join_trees(DTYPE_t *forest, DTYPE_t n, DTYPE_t m): +cdef inline void join_trees(DTYPE_t *forest, DTYPE_t n, DTYPE_t m): """Join two trees containing nodes n and m. """ @@ -70,7 +70,7 @@ cdef join_trees(DTYPE_t *forest, DTYPE_t n, DTYPE_t m): set_root(forest, m, root) -cdef link_bg(DTYPE_t *forest, DTYPE_t n, DTYPE_t *background_node): +cdef inline void link_bg(DTYPE_t *forest, DTYPE_t n, DTYPE_t *background_node): """ Link a node to the background node. @@ -80,8 +80,8 @@ cdef link_bg(DTYPE_t *forest, DTYPE_t n, DTYPE_t *background_node): join_trees(forest, n, background_node[0]) -# Connected components search as described in Fiorio et al. +# Connected components search as described in Fiorio et al. def label(input, DTYPE_t neighbors=8, DTYPE_t background=-1): """Label connected regions of an integer array. @@ -202,7 +202,6 @@ def label(input, DTYPE_t neighbors=8, DTYPE_t background=-1): join_trees(forest_p, i*cols + j, i*cols + j - 1) # Label output - cdef DTYPE_t ctr = 0 for i in range(rows): for j in range(cols):