Skip to content

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

@BioTurboNick

Description

@BioTurboNick
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions