diff --git a/invesalius_cy/cy_mesh.pyx b/invesalius_cy/cy_mesh.pyx index 6d074f8..4c8b605 100644 --- a/invesalius_cy/cy_mesh.pyx +++ b/invesalius_cy/cy_mesh.pyx @@ -1,4 +1,5 @@ # distutils: language = c++ +# cython: language_level=3str #cython: boundscheck=False #cython: wraparound=False #cython: initializedcheck=False @@ -21,7 +22,7 @@ from libcpp cimport bool from libcpp.deque cimport deque as cdeque from cython.parallel import prange -from cy_my_types cimport vertex_t, normal_t, vertex_id_t +from .cy_my_types cimport vertex_t, normal_t, vertex_id_t import numpy as np import vtk @@ -451,16 +452,16 @@ def ca_smoothing(Mesh mesh, double T, double tmax, double bmin, int n_iters): t0 = time.time() cdef vector[vertex_id_t]* vertices_staircase = find_staircase_artifacts(mesh, stack_orientation, T) - print "vertices staircase", time.time() - t0 + print("vertices staircase", time.time() - t0) t0 = time.time() cdef vector[weight_t]* weights = calc_artifacts_weight(mesh, deref(vertices_staircase), tmax, bmin) - print "Weights", time.time() - t0 + print("Weights", time.time() - t0) del vertices_staircase t0 = time.time() taubin_smooth(mesh, deref(weights), 0.5, -0.53, n_iters) - print "taubin", time.time() - t0 + print("taubin", time.time() - t0) del weights diff --git a/invesalius_cy/floodfill.pyx b/invesalius_cy/floodfill.pyx index 6636cc9..4183459 100644 --- a/invesalius_cy/floodfill.pyx +++ b/invesalius_cy/floodfill.pyx @@ -1,3 +1,5 @@ +#cython: language_level=3str + import numpy as np cimport numpy as np cimport cython @@ -10,7 +12,7 @@ from libcpp cimport bool from libcpp.deque cimport deque as cdeque from libcpp.vector cimport vector -from cy_my_types cimport image_t, mask_t +from .cy_my_types cimport image_t, mask_t cdef struct s_coord: int x @@ -117,9 +119,9 @@ def floodfill_threshold(np.ndarray[image_t, ndim=3] data, list seeds, int t0, in cdef cdeque[coord] stack cdef coord c - offset_z = odz / 2 - offset_y = ody / 2 - offset_x = odx / 2 + offset_z = odz // 2 + offset_y = ody // 2 + offset_x = odx // 2 for i, j, k in seeds: if data[k, j, i] >= t0 and data[k, j, i] <= t1: @@ -191,13 +193,13 @@ def floodfill_auto_threshold(np.ndarray[image_t, ndim=3] data, list seeds, float for i, j, k in seeds: append_queue(stack, i, j, k, d, h, w) out[k, j, i] = fill - print i, j, k, d, h, w + print(i, j, k, d, h, w) with nogil: while stack.size(): pop_queue(stack, &x, &y, &z, d, h, w) - # print x, y, z, d, h, w + # print(x, y, z, d, h, w) xo = x yo = y diff --git a/invesalius_cy/interpolation.pyx b/invesalius_cy/interpolation.pyx index 9f44648..a314d32 100644 --- a/invesalius_cy/interpolation.pyx +++ b/invesalius_cy/interpolation.pyx @@ -1,3 +1,4 @@ +#cython: language_level=3str # from interpolation cimport interpolate import numpy as np diff --git a/invesalius_cy/mips.pyx b/invesalius_cy/mips.pyx index 6b0e0a2..93b2641 100644 --- a/invesalius_cy/mips.pyx +++ b/invesalius_cy/mips.pyx @@ -1,3 +1,5 @@ +#cython: language_level=3str + #http://en.wikipedia.org/wiki/Local_maximum_intensity_projection import numpy as np cimport numpy as np @@ -90,8 +92,8 @@ def lmip(np.ndarray[DTYPE16_t, ndim=3] image, int axis, DTYPE16_t tmin, cdef DTYPE16_t get_colour(DTYPE16_t vl, DTYPE16_t wl, DTYPE16_t ww): cdef DTYPE16_t out_colour - cdef DTYPE16_t min_value = wl - (ww / 2) - cdef DTYPE16_t max_value = wl + (ww / 2) + cdef DTYPE16_t min_value = wl - (ww // 2) + cdef DTYPE16_t max_value = wl + (ww // 2) if vl < min_value: out_colour = min_value elif vl > max_value: @@ -105,8 +107,8 @@ cdef DTYPE16_t get_colour(DTYPE16_t vl, DTYPE16_t wl, DTYPE16_t ww): @cython.cdivision(True) cdef float get_opacity(DTYPE16_t vl, DTYPE16_t wl, DTYPE16_t ww) nogil: cdef float out_opacity - cdef DTYPE16_t min_value = wl - (ww / 2) - cdef DTYPE16_t max_value = wl + (ww / 2) + cdef DTYPE16_t min_value = wl - (ww // 2) + cdef DTYPE16_t max_value = wl + (ww // 2) if vl < min_value: out_opacity = 0.0 elif vl > max_value: @@ -120,8 +122,8 @@ cdef float get_opacity(DTYPE16_t vl, DTYPE16_t wl, DTYPE16_t ww) nogil: @cython.cdivision(True) cdef float get_opacity_f32(DTYPEF32_t vl, DTYPE16_t wl, DTYPE16_t ww) nogil: cdef float out_opacity - cdef DTYPE16_t min_value = wl - (ww / 2) - cdef DTYPE16_t max_value = wl + (ww / 2) + cdef DTYPE16_t min_value = wl - (ww // 2) + cdef DTYPE16_t max_value = wl + (ww // 2) if vl < min_value: out_opacity = 0.0 elif vl > max_value: @@ -144,8 +146,8 @@ def mida(np.ndarray[DTYPE16_t, ndim=3] image, int axis, DTYPE16_t wl, cdef DTYPE16_t max = image.max() cdef DTYPE16_t vl - cdef DTYPE16_t min_value = wl - (ww / 2) - cdef DTYPE16_t max_value = wl + (ww / 2) + cdef DTYPE16_t min_value = wl - (ww // 2) + cdef DTYPE16_t max_value = wl + (ww // 2) cdef float fmax=0.0 cdef float fpi diff --git a/invesalius_cy/transforms.pyx b/invesalius_cy/transforms.pyx index 5c746d2..8c2c10a 100644 --- a/invesalius_cy/transforms.pyx +++ b/invesalius_cy/transforms.pyx @@ -1,3 +1,5 @@ +#cython: language_level=3str + import numpy as np cimport numpy as np cimport cython -- libgit2 0.21.2