-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into 2315_medfilt_ng_cython
- Loading branch information
Showing
12 changed files
with
411 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ | |
Cython module for doing inpaining of images. | ||
""" | ||
__author__ = "Jérôme Kieffer" | ||
__date__ = "09/03/2023" | ||
__date__ = "12/11/2024" | ||
__contact__ = "[email protected]" | ||
__license__ = "MIT" | ||
|
||
|
@@ -139,10 +139,10 @@ def polar_inpaint(floating[:, :] img not None, | |
:return: image with missing values interpolated from neighbors. | ||
""" | ||
cdef: | ||
int row, col, npt_radial, npt_azim, idx_col, idx_row, tar_row, radius | ||
int row, col, npt_radial, npt_azim, idx_col, idx_row, tar_row, radius, dist | ||
float[:, ::1] res | ||
bint do_dummy = empty is not None | ||
float value, dummy, dist | ||
float value, dummy | ||
double sum, cnt, weight | ||
list values | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,14 +37,14 @@ image (masked) to be able to use more common algorithms. | |
|
||
__author__ = "Jerome Kieffer" | ||
__contact__ = "[email protected]" | ||
__date__ = "03/03/2023" | ||
__date__ = "12/11/2024" | ||
__status__ = "stable" | ||
__license__ = "MIT" | ||
|
||
|
||
import cython | ||
import numpy | ||
from libc.math cimport sqrt, fabs, NAN | ||
from libc.math cimport sqrtf, fabs, NAN | ||
from cython.parallel import prange | ||
from libc.stdint cimport int8_t, uint8_t, int16_t, uint16_t, \ | ||
int32_t, uint32_t, int64_t, uint64_t | ||
|
@@ -55,11 +55,7 @@ cdef inline float invert_distance(Py_ssize_t i0, Py_ssize_t i1, Py_ssize_t p0, P | |
cdef Py_ssize_t d0, d1 | ||
d0 = (i0 - p0) | ||
d1 = (i1 - p1) | ||
return 1. / sqrt(d0*d0 + d1*d1) | ||
# if d0*d1: | ||
# else: | ||
# return NAN | ||
|
||
return (<float> 1.0) / sqrtf(<float> (d0*d0 + d1*d1)) | ||
|
||
cdef inline float processPoint(float[:, ::1] data, | ||
int8_t[:, ::1] mask, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ Some are defined in the associated header file .pxd | |
|
||
__author__ = "Jérôme Kieffer" | ||
__contact__ = "[email protected]" | ||
__date__ = "24/04/2024" | ||
__date__ = "12/11/2024" | ||
__status__ = "stable" | ||
__license__ = "MIT" | ||
|
||
|
@@ -490,14 +490,14 @@ cdef inline void _integrate1d(buffer_t[::1] buffer, | |
if 0 <= start0 < buffer_size: | ||
buffer[istart0] += _calc_area(start0, floor(start0 + 1), slope, intercept) | ||
for i in range(max(istart0 + 1, 0), min(istop0, buffer_size)): | ||
buffer[i] += _calc_area(i, i + 1, slope, intercept) | ||
buffer[i] += _calc_area(<floating>i, <floating>(i + 1), slope, intercept) | ||
if buffer_size > stop0 >= 0: | ||
buffer[istop0] += _calc_area(istop0, stop0, slope, intercept) | ||
buffer[istop0] += _calc_area(<floating> istop0, stop0, slope, intercept) | ||
else: | ||
if 0 <= start0 < buffer_size: | ||
buffer[istart0] += _calc_area(start0, istart0, slope, intercept) | ||
buffer[istart0] += _calc_area(start0, <floating> istart0, slope, intercept) | ||
for i in range(min(istart0, buffer_size) - 1, max(<Py_ssize_t> floor(stop0), -1), -1): | ||
buffer[i] += _calc_area(i + 1, i, slope, intercept) | ||
buffer[i] += _calc_area(<floating>(i + 1), <floating>i, slope, intercept) | ||
if buffer_size > stop0 >= 0: | ||
buffer[istop0] += _calc_area(floor(stop0 + 1), stop0, slope, intercept) | ||
|
||
|
@@ -562,7 +562,7 @@ cdef inline void _integrate2d(buffer_t[:, ::1] box, | |
h += 1 | ||
# subsection P1->Pn | ||
for i in range((<Py_ssize_t> floor(P)), (<Py_ssize_t> floor(stop0))): | ||
segment_area = _calc_area(i, i + 1, slope, intercept) | ||
segment_area = _calc_area(<floating> i, <floating> (i + 1), slope, intercept) | ||
if segment_area != 0: | ||
abs_area = fabs(segment_area) | ||
h = 0 | ||
|
@@ -623,7 +623,7 @@ cdef inline void _integrate2d(buffer_t[:, ::1] box, | |
h += 1 | ||
# subsection P1->Pn | ||
for i in range((<Py_ssize_t> start0), (<Py_ssize_t> ceil(stop0)), -1): | ||
segment_area = _calc_area(i, i - 1, slope, intercept) | ||
segment_area = _calc_area(<floating> i, <floating> (i - 1), slope, intercept) | ||
if segment_area != 0: | ||
abs_area = fabs(segment_area) | ||
h = 0 | ||
|
Oops, something went wrong.