JuliaImages / ImageShow.jl

Inline graphical display of images in Julia graphical environments
MIT License
25 stars 9 forks source link

0 length image is not showable (closes #12) #13

Closed johnnychen94 closed 5 years ago

johnnychen94 commented 5 years ago

P.S. is _length1 still usable for Julia 1.x?

RalphAS commented 5 years ago

This doesn't seem to have any effect in IJulia (which is ok), and I'm not set up to test under Juno/Atom. If it helps there, I approve.

WRT _length1, the only complication I know of is that the AbstractArray method for length uses size. Do you know if all array types of interest have size or a specialized length?

johnnychen94 commented 5 years ago

Yes, IJulia isn't affected by #12. Good to know that.

I've tested it in vscode, I assume atom/Juno respect the same MIME here.

The following is the result of vscode:

julia> using ImageCore

julia> using ImageShow

julia> x = Array{Gray,2}(undef,0,0)
0×0 Array{Gray{Any},2} with eltype Gray

Since length(x::Array) is defined in array.jl of Base as the number of elements, I was wondering if all AbstractArray is defined as the same behavior. TBH, I'm not very sure of it.

yha commented 5 years ago

Since length(x::Array) is defined in array.jl of Base as the number of elements, I was wondering if all AbstractArray is defined as the same behavior. TBH, I'm not very sure of it.

VectorOfArrays from RecursiveArrayTools.jl has length(x) == size(x)[end], but using _length1 rather then length would make no difference in this case as length(eachindex(x)) is the same.