Commit 19abbab5316692e7e884924525d8ef5300b4bf5a
1 parent
92127932
Exists in
master
and in
18 other branches
FIX: To compile cython codes in windows
Showing
3 changed files
with
11 additions
and
11 deletions
Show diff stats
invesalius/data/interpolation.pxd
| 1 | from .cy_my_types cimport image_t | 1 | from .cy_my_types cimport image_t |
| 2 | 2 | ||
| 3 | -cdef inline double interpolate(image_t[:, :, :], double, double, double) nogil | ||
| 4 | -cdef inline double tricub_interpolate(image_t[:, :, :], double, double, double) nogil | ||
| 5 | -cdef inline double tricubicInterpolate (image_t[:, :, :], double, double, double) nogil | 3 | +cdef double interpolate(image_t[:, :, :], double, double, double) nogil |
| 4 | +cdef double tricub_interpolate(image_t[:, :, :], double, double, double) nogil | ||
| 5 | +cdef double tricubicInterpolate (image_t[:, :, :], double, double, double) nogil |
invesalius/data/interpolation.pyx
| @@ -77,7 +77,7 @@ cdef double[64][64] temp = [ | @@ -77,7 +77,7 @@ cdef double[64][64] temp = [ | ||
| 77 | @cython.boundscheck(False) # turn of bounds-checking for entire function | 77 | @cython.boundscheck(False) # turn of bounds-checking for entire function |
| 78 | @cython.cdivision(True) | 78 | @cython.cdivision(True) |
| 79 | @cython.wraparound(False) | 79 | @cython.wraparound(False) |
| 80 | -cdef inline double interpolate(image_t[:, :, :] V, double x, double y, double z) nogil: | 80 | +cdef double interpolate(image_t[:, :, :] V, double x, double y, double z) nogil: |
| 81 | cdef double xd, yd, zd | 81 | cdef double xd, yd, zd |
| 82 | cdef double c00, c10, c01, c11 | 82 | cdef double c00, c10, c01, c11 |
| 83 | cdef double c0, c1 | 83 | cdef double c0, c1 |
| @@ -123,7 +123,7 @@ cdef inline double interpolate(image_t[:, :, :] V, double x, double y, double z) | @@ -123,7 +123,7 @@ cdef inline double interpolate(image_t[:, :, :] V, double x, double y, double z) | ||
| 123 | @cython.boundscheck(False) # turn of bounds-checking for entire function | 123 | @cython.boundscheck(False) # turn of bounds-checking for entire function |
| 124 | @cython.cdivision(True) | 124 | @cython.cdivision(True) |
| 125 | @cython.wraparound(False) | 125 | @cython.wraparound(False) |
| 126 | -cdef inline image_t _G(image_t[:, :, :] V, int x, int y, int z) nogil: | 126 | +cdef image_t _G(image_t[:, :, :] V, int x, int y, int z) nogil: |
| 127 | cdef int dz, dy, dx | 127 | cdef int dz, dy, dx |
| 128 | dz = V.shape[0] - 1 | 128 | dz = V.shape[0] - 1 |
| 129 | dy = V.shape[1] - 1 | 129 | dy = V.shape[1] - 1 |
| @@ -236,7 +236,7 @@ cdef void calc_coef_tricub(image_t[:, :, :] V, double x, double y, double z, dou | @@ -236,7 +236,7 @@ cdef void calc_coef_tricub(image_t[:, :, :] V, double x, double y, double z, dou | ||
| 236 | @cython.boundscheck(False) # turn of bounds-checking for entire function | 236 | @cython.boundscheck(False) # turn of bounds-checking for entire function |
| 237 | @cython.cdivision(True) | 237 | @cython.cdivision(True) |
| 238 | @cython.wraparound(False) | 238 | @cython.wraparound(False) |
| 239 | -cdef inline double tricub_interpolate(image_t[:, :, :] V, double x, double y, double z) nogil: | 239 | +cdef double tricub_interpolate(image_t[:, :, :] V, double x, double y, double z) nogil: |
| 240 | # From: Tricubic interpolation in three dimensions. Lekien and Marsden | 240 | # From: Tricubic interpolation in three dimensions. Lekien and Marsden |
| 241 | cdef double[64] coef | 241 | cdef double[64] coef |
| 242 | cdef double result = 0.0 | 242 | cdef double result = 0.0 |
| @@ -261,14 +261,14 @@ cdef inline double tricub_interpolate(image_t[:, :, :] V, double x, double y, do | @@ -261,14 +261,14 @@ cdef inline double tricub_interpolate(image_t[:, :, :] V, double x, double y, do | ||
| 261 | @cython.boundscheck(False) # turn of bounds-checking for entire function | 261 | @cython.boundscheck(False) # turn of bounds-checking for entire function |
| 262 | @cython.cdivision(True) | 262 | @cython.cdivision(True) |
| 263 | @cython.wraparound(False) | 263 | @cython.wraparound(False) |
| 264 | -cdef inline double cubicInterpolate(double p[4], double x) nogil: | 264 | +cdef double cubicInterpolate(double p[4], double x) nogil: |
| 265 | return p[1] + 0.5 * x*(p[2] - p[0] + x*(2.0*p[0] - 5.0*p[1] + 4.0*p[2] - p[3] + x*(3.0*(p[1] - p[2]) + p[3] - p[0]))) | 265 | return p[1] + 0.5 * x*(p[2] - p[0] + x*(2.0*p[0] - 5.0*p[1] + 4.0*p[2] - p[3] + x*(3.0*(p[1] - p[2]) + p[3] - p[0]))) |
| 266 | 266 | ||
| 267 | 267 | ||
| 268 | @cython.boundscheck(False) # turn of bounds-checking for entire function | 268 | @cython.boundscheck(False) # turn of bounds-checking for entire function |
| 269 | @cython.cdivision(True) | 269 | @cython.cdivision(True) |
| 270 | @cython.wraparound(False) | 270 | @cython.wraparound(False) |
| 271 | -cdef inline double bicubicInterpolate (double p[4][4], double x, double y) nogil: | 271 | +cdef double bicubicInterpolate (double p[4][4], double x, double y) nogil: |
| 272 | cdef double arr[4] | 272 | cdef double arr[4] |
| 273 | arr[0] = cubicInterpolate(p[0], y) | 273 | arr[0] = cubicInterpolate(p[0], y) |
| 274 | arr[1] = cubicInterpolate(p[1], y) | 274 | arr[1] = cubicInterpolate(p[1], y) |
| @@ -280,7 +280,7 @@ cdef inline double bicubicInterpolate (double p[4][4], double x, double y) nogil | @@ -280,7 +280,7 @@ cdef inline double bicubicInterpolate (double p[4][4], double x, double y) nogil | ||
| 280 | @cython.boundscheck(False) # turn of bounds-checking for entire function | 280 | @cython.boundscheck(False) # turn of bounds-checking for entire function |
| 281 | @cython.cdivision(True) | 281 | @cython.cdivision(True) |
| 282 | @cython.wraparound(False) | 282 | @cython.wraparound(False) |
| 283 | -cdef inline double tricubicInterpolate(image_t[:, :, :] V, double x, double y, double z) nogil: | 283 | +cdef double tricubicInterpolate(image_t[:, :, :] V, double x, double y, double z) nogil: |
| 284 | # From http://www.paulinternet.nl/?page=bicubic | 284 | # From http://www.paulinternet.nl/?page=bicubic |
| 285 | cdef double p[4][4][4] | 285 | cdef double p[4][4][4] |
| 286 | 286 |
invesalius/data/transforms.pyx
| @@ -12,7 +12,7 @@ from cython.parallel import prange | @@ -12,7 +12,7 @@ from cython.parallel import prange | ||
| 12 | @cython.boundscheck(False) # turn of bounds-checking for entire function | 12 | @cython.boundscheck(False) # turn of bounds-checking for entire function |
| 13 | @cython.cdivision(True) | 13 | @cython.cdivision(True) |
| 14 | @cython.wraparound(False) | 14 | @cython.wraparound(False) |
| 15 | -cdef inline void mul_mat4_vec4(double[:, :] M, | 15 | +cdef void mul_mat4_vec4(double[:, :] M, |
| 16 | double* coord, | 16 | double* coord, |
| 17 | double* out) nogil: | 17 | double* out) nogil: |
| 18 | 18 | ||
| @@ -77,7 +77,7 @@ def apply_view_matrix_transform(image_t[:, :, :] volume, | @@ -77,7 +77,7 @@ def apply_view_matrix_transform(image_t[:, :, :] volume, | ||
| 77 | image_t cval, | 77 | image_t cval, |
| 78 | image_t[:, :, :] out): | 78 | image_t[:, :, :] out): |
| 79 | 79 | ||
| 80 | - cdef unsigned int dz, dy, dx | 80 | + cdef int dz, dy, dx |
| 81 | cdef int z, y, x | 81 | cdef int z, y, x |
| 82 | dz = volume.shape[0] | 82 | dz = volume.shape[0] |
| 83 | dy = volume.shape[1] | 83 | dy = volume.shape[1] |