ImageView.jl
ImageView.jl copied to clipboard
Slow with large images
imshow
takes more than two minutes to show a 12000x5000 image, and ~40 seconds to show a 5120x2880 image
Here's the data type for the first image (both were loaded using TiffImages
5000×12000 TiffImages.DenseTaggedImage{ColorTypes.RGB{FixedPointNumbers.N0f8}, 2, UInt32, Matrix{ColorTypes.RGB{FixedPointNumbers.N0f8}}}
julia> versioninfo()
Julia Version 1.11.0-DEV.586
Commit e9d633f70a* (2023-10-01 18:36 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 32 × AMD Ryzen 9 3950X 16-Core Processor
WORD_SIZE: 64
LLVM: libLLVM-15.0.7 (ORCJIT, znver2)
Threads: 47 on 32 virtual cores
Environment:
LD_PRELOAD = /lib/x86_64-linux-gnu/libc_malloc_debug.so.0
JULIA_NUM_THREADS = 32
JULIA_EDITOR = vim
Just discovered that ctrl-c
will get the image on screen fast, so whatever it's doing for two minutes is apparently not essential
ulia> imshow(TiffImages.load("image.tif"))
Dict{String, Any} with 4 entries:^CError showing value of type Dict{String, Any}:
ERROR: InterruptException:
Stacktrace:
[1] writeshortest(buf::Vector{…}, pos::Int64, x::Float64, plus::Bool, space::Bool, hash::Bool, precision::Int64, expchar::UInt8, padexp::Bool, decchar::UInt8, typed::Bool, compact::Bool)
@ Base.Ryu ./ryu/shortest.jl:227
[2] show(io::IOContext{IOBuffer}, x::Float64, forceuntyped::Bool, fromprint::Bool)
@ Base.Ryu ./ryu/Ryu.jl:116
[3] show(io::IO, x::T, forceuntyped::Bool, fromprint::Bool) where T<:Union{Float16, Float32, Float64}
@ Base.Ryu ./ryu/Ryu.jl:113 [inlined]
[4] show(io::IOContext{IOBuffer}, x::FixedPointNumbers.N0f8)
@ FixedPointNumbers ~/.julia/packages/FixedPointNumbers/HAGk2/src/FixedPointNumbers.jl:274
[5] _show_components(io::IOContext{IOBuffer}, c::ColorTypes.RGB{FixedPointNumbers.N0f8})
@ ColorTypes ~/.julia/packages/ColorTypes/1dGw6/src/show.jl:21
[6] show(io::IOContext{IOBuffer}, c::ColorTypes.RGB{FixedPointNumbers.N0f8})
@ ColorTypes ~/.julia/packages/ColorTypes/1dGw6/src/show.jl:13
[7] _show_nonempty(io::IOContext{IOBuffer}, X::AbstractMatrix, prefix::String, drop_brackets::Bool, axs::Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}})
@ Base ./arrayshow.jl:445
[8] _show_nonempty(io::IOContext{IOBuffer}, X::MappedArrays.ReadonlyMappedArray{ColorTypes.RGB{…}, 2, SubArray{…}, ImageView.var"#74#75"{…}}, prefix::String)
@ Base ./arrayshow.jl:413
[9] show
@ ./arrayshow.jl:491 [inlined]
We are aware of the issue @chrstphrbrns or something similar, this comes from GTK and is supposed to be fixed in the new release.
What is the issue, @ashwani-rathee ?
This doesn't look like the GTK issue. From the stacktrace it looks like it's taking forever to show()
something in the output. Does calling imshow
with a semicolon at the end speed it up?
This doesn't look like the GTK issue. From the stacktrace it looks like it's taking forever to
show()
something in the output. Does callingimshow
with a semicolon at the end speed it up?
Yes