8000 Interpolation error in measure.profile_line · Issue #4279 · scikit-image/scikit-image · GitHub
[go: up one dir, main page]

Skip to content
Interpolation error in measure.profile_line #4279
@lagru

Description

@lagru

Description

#4206, once merged, exposes interesting behavior for measure.profile_line. Consider

image = np.arange(12).reshape(4, 3)
# reduce_func is a new parameter proposed in #4206
prof = profile_line(image, (0, 1), (3, 1), linewidth=3, reduce_func=None)
assert_array_equal(image, prof)

As I understand it, the returned profile should be identical with the original image but we get this (value at (0, 2) is different):

AssertionError: 
Arrays are not equal
Mismatch: 8.33%
Max absolute difference: 2
Max relative difference: 0.
 x: array([[ 0,  1,  2],
       [ 3,  4,  5],
       [ 6,  7,  8],
       [ 9, 10, 11]])
 y: array([[ 0,  1,  0],
       [ 3,  4,  5],
       [ 6,  7,  8],
       [ 9, 10, 11]])

This might originate in scipy.ndimage.map_coordinates. Looks like a potential bug to me but might be an edge case for the underlying interpolation that can be ignored/is not reasonable to fix.
This behavior is already relevant even before merging #4206 because the faulty value will change the mean value of the profile line.

#4206 (comment) also highlights additional strange behavior.

Version information

Current master, exposed once #4206 is merged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0