JuliaImages / ImageFiltering.jl

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

mapwindow with border option not implemented? #175

Open juliohm opened 4 years ago

juliohm commented 4 years ago

The following works:

using ImageFiltering

A = zeros(10,10,10)

mapwindow(sum, A, (3,1,1))

but the following doesn't:

mapwindow(sum, A, (3,1,1), border=Pad(:reflect,2,0,0))

ERROR: MethodError: no method matching resolve_border(::Pad{3})
Closest candidates are:
  resolve_border(::AbstractString) at /Users/julio.hoffimann@ibm.com/.julia/packages/ImageFiltering/eH8Od/src/mapwindow.jl:130
  resolve_border(::Union{NA, NoPad, Union{Inner{0}, Fill{T,0}, Pad{0}} where T}) at /Users/julio.hoffimann@ibm.com/.julia/packages/ImageFiltering/eH8Od/src/mapwindow.jl:131

I need to get it working, so I will check the codebase to try contribute a fix. If you have alternative suggestions to get things moving, please let me know. This is for a project with some tight deadlines.

juliohm commented 4 years ago

Is this fixed by the recent merge of #160 ?

johnnychen94 commented 4 years ago

No, it doesn't, #160 only fixes the case when A is an offset array. The border is another issue here; not digging into the details, I'm not sure why it's restricted to Pad{0} here.

johnnychen94 commented 4 years ago

This is just my personal thought.

I personally view this package as a legacy project that needs some update and revival, so until we seriously simplify and decouple the codebase and outsources some of the functionalities (e.g., borderarray), adding new features into it would make it a maintenance nightmare; it already is.

Currently, we have more than too many things to do to push JuliaImages to its 1.0 stage, given that this package works and works not that bad, I myself does not prioritize the enhancement of ImageFiltering in my todo lists.

This is just my personal thought. If there's some brave mind exploring through the thorns, I'm happy to get it in.