From c9ed06ad9225b8a60f84d15099dfd2e455952d8e Mon Sep 17 00:00:00 2001 From: Evgeni Burovski Date: Wed, 27 Jan 2016 08:40:48 +0000 Subject: [PATCH] MAINT: skel3d: statically type Euler LUT --- skimage/morphology/_skel.pyx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/skimage/morphology/_skel.pyx b/skimage/morphology/_skel.pyx index cafe6006..6eedc407 100644 --- a/skimage/morphology/_skel.pyx +++ b/skimage/morphology/_skel.pyx @@ -64,7 +64,7 @@ NUMPOINTS_LUT = fill_numpoints_LUT() def fill_Euler_LUT(): - LUT = np.zeros(256, dtype=int) + LUT = np.zeros(256, dtype=np.intc) LUT[1] = 1 LUT[3] = -1 @@ -200,14 +200,14 @@ def fill_Euler_LUT(): LUT[255] = -1 return LUT -LUT = fill_Euler_LUT() +cdef int[::] LUT = fill_Euler_LUT() ### Octants (indexOctantXXX functions) OCTANTS = tuple(range(8)) NEB, NWB, SEB, SWB, NEU, NWU, SEU, SWU = OCTANTS -_neib_idx = np.empty((8, 7), dtype=np.int32) +_neib_idx = np.empty((8, 7), dtype=np.intc) _neib_idx[NEB, ...] = [2, 1, 11, 10, 5, 4, 14] _neib_idx[NWB, ...] = [0, 9, 3, 12, 1, 10, 4] _neib_idx[SEB, ...] = [8, 7, 17, 16, 5, 4, 14] @@ -241,6 +241,8 @@ def is_surfacepoint(neighbors, points_LUT): return True +@cython.boundscheck(False) +@cython.wraparound(False) cdef bint is_Euler_invariant(neighb_type neighbors): """Check if a point is Euler invariant.