JuliaIO / JLD.jl

Saving and loading julia variables while preserving native types
MIT License
277 stars 55 forks source link

Can't load colorview Images #259

Open aquatiko opened 5 years ago

aquatiko commented 5 years ago

Error seems to appear when loading a saved file in a colorview format.

Steps to reproduce:

using JLD, Images
tmp = colorview(RGB, rand(10,10), rand(10,10), rand(10,10))
save("test.jld", "arr", tmp)

tmp2 = load("test.jld", "arr")        # gives error

StackTrace:

error parsing type string MappedArrays.MultiMappedArray{ColorTypes.RGB{Core.Float64},2,Core.Tuple{Core.Array{Core.Float64,2},Core.Array{Core.Float64,2},Core.Array{Core.Float64,2}},Core.Type{ColorTypes.RGB{Core.Float64}},ImageCore.#extractchannels}
ERROR: syntax: incomplete: premature end of input
Stacktrace:
 [1] eval at ./boot.jl:328 [inlined]
 [2] eval at /home/rohit/.julia/packages/JLD/1BoSz/src/JLD.jl:3 [inlined]
 [3] _julia_type(::String) at /home/rohit/.julia/packages/JLD/1BoSz/src/JLD.jl:983
 [4] julia_type(::String) at /home/rohit/.julia/packages/JLD/1BoSz/src/JLD.jl:30
 [5] jldatatype(::JLD.JldFile, ::HDF5.HDF5Datatype) at /home/rohit/.julia/packages/JLD/1BoSz/src/jld_types.jl:701
 [6] read(::JLD.JldDataset) at /home/rohit/.julia/packages/JLD/1BoSz/src/JLD.jl:370
 [7] read(::JLD.JldFile, ::String) at /home/rohit/.julia/packages/JLD/1BoSz/src/JLD.jl:346
 [8] #42 at /home/rohit/.julia/packages/JLD/1BoSz/src/JLD.jl:1240 [inlined]
 [9] #jldopen#14(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::getfield(JLD, Symbol("##42#43")){String}, ::String, ::Vararg{String,N} where N) at /home/rohit/.julia/packages/JLD/1BoSz/src/JLD.jl:246
 [10] jldopen at /home/rohit/.julia/packages/JLD/1BoSz/src/JLD.jl:244 [inlined]
 [11] load at /home/rohit/.julia/packages/JLD/1BoSz/src/JLD.jl:1239 [inlined]
 [12] #load#13(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::String, ::String) at /home/rohit/.julia/packages/FileIO/JAtC1/src/loadsave.jl:118
 [13] load(::String, ::String) at /home/rohit/.julia/packages/FileIO/JAtC1/src/loadsave.jl:118
 [14] top-level scope at none:0

My guess is it's due to the memory mapping of array. Do we have any workaround for this?