diff --git a/skimage/measure/_marching_cubes_cy.pyx b/skimage/measure/_marching_cubes_cy.pyx index cf3ad93d..18e14ddb 100644 --- a/skimage/measure/_marching_cubes_cy.pyx +++ b/skimage/measure/_marching_cubes_cy.pyx @@ -78,14 +78,7 @@ def iterate_and_store_3d(cnp.ndarray[double, ndim=3] arr, cdef Py_ssize_t n cdef bint odd_sampling, plus_z plus_z = False - if ((sampling == (1., 1., 1.)) or - (sampling == (1., 1., 1)) or - (sampling == (1., 1, 1.)) or - (sampling == (1, 1., 1.)) or - (sampling == (1, 1, 1.)) or - (sampling == (1., 1, 1)) or - (sampling == (1, 1., 1)) or - (sampling == (1, 1, 1))): + if [float(i) for i in sampling] == [1.0, 1.0, 1.0]: odd_sampling = False else: odd_sampling = True @@ -159,14 +152,14 @@ def iterate_and_store_3d(cnp.ndarray[double, ndim=3] arr, # We use a right-handed coordinate system, UNlike the paper, but want # to index in agreement - the coordinate adjustment takes place here. - v1 = arr[x0, y0, z0] - v2 = arr[x1, y0, z0] - v3 = arr[x1, y1, z0] - v4 = arr[x0, y1, z0] - v5 = arr[x0, y0, z1] - v6 = arr[x1, y0, z1] - v7 = arr[x1, y1, z1] - v8 = arr[x0, y1, z1] + v1 = arr[z0, y0, x0] + v2 = arr[z0, y0, x1] + v3 = arr[z0, y1, x1] + v4 = arr[z0, y1, x0] + v5 = arr[z1, y0, x0] + v6 = arr[z1, y0, x1] + v7 = arr[z1, y1, x1] + v8 = arr[z1, y1, x0] # Unique triangulation cases cube_case = 0 @@ -240,7 +233,7 @@ def iterate_and_store_3d(cnp.ndarray[double, ndim=3] arr, e6, e7, e8, e9, e10, e11, e12) # Advance the coords indices - if coords[2] < arr.shape[2] - 2: + if coords[2] < arr.shape[0] - 2: coords[2] += 1 plus_z = True elif coords[1] < arr.shape[1] - 2: