Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with mapwindow and custom function, when the window is greater than 2x the size of the inputs #262

Open
BioTurboNick opened this issue Jun 26, 2023 · 0 comments

Comments

@BioTurboNick
Copy link
Contributor

BioTurboNick commented Jun 26, 2023

function extrema_range(x)
    extx = extrema(x)
    return extx[2] - extx[1]
end

julia> mapwindow(extrema_range, randn(21), (41,))
3.816084076236648

julia> mapwindow(extrema_range, randn(21), (43,))
ERROR: DimensionMismatch: CartesianIndices((1:0,)) must be in the interior of CartesianIndices((21,))
Stacktrace:
 [1] EdgeIterator
   @ C:\Users\nicho\.julia\packages\TiledIteration\MBTB8\src\TiledIteration.jl:28 [inlined]
 [2] EdgeIterator
   @ C:\Users\nicho\.julia\packages\TiledIteration\MBTB8\src\TiledIteration.jl:32 [inlined]
 [3] mapwindow_kernel!(f::typeof(extrema_range), out::Vector{Float64}, img::Vector{Float64}, window::Tuple{UnitRange{Int64}}, border::Pad{0}, imginds::Tuple{Base.OneTo{Int64}})
   @ ImageFiltering.MapWindow C:\Users\nicho\.julia\packages\ImageFiltering\TdGNZ\src\mapwindow.jl:297
 [4] _mapwindow
   @ C:\Users\nicho\.julia\packages\ImageFiltering\TdGNZ\src\mapwindow.jl:104 [inlined]
 [5] mapwindow(f::typeof(extrema_range), img::Vector{Float64}, window::Tuple{Int64}; border::String, indices::Tuple{Base.OneTo{Int64}}, callmode::Symbol)
   @ ImageFiltering.MapWindow C:\Users\nicho\.julia\packages\ImageFiltering\TdGNZ\src\mapwindow.jl:80
 [6] mapwindow(f::typeof(extrema_range), img::Vector{Float64}, window::Tuple{Int64})
   @ ImageFiltering.MapWindow C:\Users\nicho\.julia\packages\ImageFiltering\TdGNZ\src\mapwindow.jl:75
 [7] top-level scope
   @ REPL[91]:1

julia> mapwindow(extrema, randn(21), (43,)) # built-in works
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant