-
Notifications
You must be signed in to change notification settings - Fork 142
Open
Description
Hi,
I have original 4D data typeof(data) = Array{UInt16, 3}, size(data) = (512, 512, 5, 100) .
I reshape, permute to (512, 512, 100, 5) and take as 3D img = data[:, :, :, 1], size(img) = (512, 512, 100) .
It is ok if I directly save this Array{UInt16, 3} as tiff FileIO.save("img.tif", img)
But if I convert it into floating point img = Float16.(img) , typeof(img) = Array{Float16, 3} and try to save FileIO.save("img.tif", img).
Here the problem and error come,
Warning: Mapping to the storage type failed; perhaps your data had out-of-range values?
│ Try `map(clamp01nan, img)` to clamp values to a valid range.
........
MethodError: no method matching save(::File{DataFormat{:TIFF}, String}, ::Array{Float16, 3})
Closest candidates are:
save(::Stream{DataFormat{:PNG}}, ::S; permute_horizontal, mapi, kwargs...) where {T, S<:Union{AbstractArray{T, 3}, AbstractMatrix}}
@ ImageIO ~\.julia\packages\ImageIO\uPn5K\src\ImageIO.jl:40
save(::File{DataFormat{:PNG}}, ::S; kwargs...) where {T, S<:Union{AbstractArray{T, 3}, AbstractMatrix}}
@ ImageIO ~\.julia\packages\ImageIO\uPn5K\src\ImageIO.jl:36
===========================================
ArgumentError: N0f8 is an 8-bit type representing 256 values from 0.0 to 1.0; cannot represent 63744.0
===========================================
ArgumentError: Package OpenCV [f878e3a2-a245-4720-8660-60795d644f2a] is required but does not seem to be installed: - Run `Pkg.instantiate()` to install all recorded dependencies.
===========================================
Fatal error:
ERROR: MethodError: no method matching save(::File{DataFormat{:TIFF}, String}, ::Array{Float16, 3})
Closest candidates are:
save(::Stream{DataFormat{:PNG}}, ::S; permute_horizontal, mapi, kwargs...) where {T, S<:Union{AbstractArray{T, 3}, AbstractMatrix}}
@ ImageIO ~\.julia\packages\ImageIO\uPn5K\src\ImageIO.jl:40
save(::File{DataFormat{:PNG}}, ::S; kwargs...) where {T, S<:Union{AbstractArray{T, 3}, AbstractMatrix}}
@ ImageIO ~\.julia\packages\ImageIO\uPn5K\src\ImageIO.jl:36
Stacktrace:
[1] #invokelatest#2
@ .\essentials.jl:892 [inlined]
[2] invokelatest
@ .\essentials.jl:889 [inlined]
[3] action(call::Symbol, libraries::Vector{Union{…}}, file::Formatted, args::Array{Float16, 3}; options::@Kwargs{})
@ FileIO ~\.julia\packages\FileIO\xOKyx\src\loadsave.jl:219
[4] action
@ ~\.julia\packages\FileIO\xOKyx\src\loadsave.jl:196 [inlined]
[5] action
@ ~\.julia\packages\FileIO\xOKyx\src\loadsave.jl:185 [inlined]
[6] save(file::String, args::Array{Float16, 3}; options::@Kwargs{})
@ FileIO ~\.julia\packages\FileIO\xOKyx\src\loadsave.jl:129
[7] save(file::String, args::Array{Float16, 3})
@ FileIO ~\.julia\packages\FileIO\xOKyx\src\loadsave.jl:125
[8] top-level scope
@ ~\Documents\Julia\Lab8b07IMBAS\IMGfromH5.jl:70
Stacktrace:
[1] handle_error(e::MethodError, q::Base.PkgId, bt::Vector{Union{Ptr{Nothing}, Base.InterpreterIP}})
@ FileIO ~\.julia\packages\FileIO\xOKyx\src\error_handling.jl:61
[2] handle_exceptions(exceptions::Vector{Tuple{Any, Union{Base.PkgId, Module}, Vector}}, action::String)
@ FileIO ~\.julia\packages\FileIO\xOKyx\src\error_handling.jl:56
[3] action(call::Symbol, libraries::Vector{Union{…}}, file::Formatted, args::Array{Float16, 3}; options::@Kwargs{})
@ FileIO ~\.julia\packages\FileIO\xOKyx\src\loadsave.jl:228
[4] action
@ ~\.julia\packages\FileIO\xOKyx\src\loadsave.jl:196 [inlined]
[5] action
@ ~\.julia\packages\FileIO\xOKyx\src\loadsave.jl:185 [inlined]
[6] save(file::String, args::Array{Float16, 3}; options::@Kwargs{})
@ FileIO ~\.julia\packages\FileIO\xOKyx\src\loadsave.jl:129
[7] save(file::String, args::Array{Float16, 3})
@ FileIO ~\.julia\packages\FileIO\xOKyx\src\loadsave.jl:125
[8] top-level scope
@ ~\Documents\Julia\Lab8b07IMBAS\IMGfromH5.jl:70
Some type information was truncated. Use `show(err)` to see complete types.
I tried map(clamp01nan, img) , FileIO.save("img.tif", img) again, and got same error.
but there is no problem to save random data img= rand(Float16, 512, 512, 100); .
what can I do?
thanks in advacne.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels