JuliaImages / ImageFiltering.jl

Julia implementations of multidimensional array convolution and nonlinear stencil operations
Other
99 stars 49 forks source link

LinearIndices() for BorderArray are out of bounds #139

Closed Cody-G closed 4 years ago

Cody-G commented 4 years ago

I'm pretty sure calling LinearIndices on a BorderArray should return indices in the same format as calling LinearIndices on an OffsetArray, but that's not the case. This seems to be because axes() returns generic range objects for BorderArrays while it returns IdentityUnitRanges for OffsetArrays, and LinearIndices only gives the correct answer with IdentityUnitRanges. I have a fix, will make a PR.

using ImageFiltering, OffsetArrays

b = BorderArray(zeros(10), Fill(1.0, (3,), (0,)))
all(LinearIndices(b) .== LinearIndices(OffsetArray(zeros(13), -3)))  # false, should be true
jw3126 commented 4 years ago

Fixed by #138