Open pywugate opened 4 months ago
Did you do the following?
img = map(clamp01nan, img)
FileIO.save("img.tif", img)
Basically we're expecting all your floating point values to be between 0 and 1.
I did, the transformed image img3 = map(clamp01nan, img2)
can be saved.
But all the values were transformed to 1.0
julia> size(img), typeof(img)
((512, 512, 100), Array{UInt16, 3})
julia> unique(img)
96-element Vector{Int64}:
1791
1983
⋮
7039
6975
julia> img2 = Float16.(img); typeof(img2)
Array{Float16, 3}
julia> unique(img2)
96-element Vector{Float16}:
1.791e3
1.983e3
⋮
7.04e3
6.976e3
julia> img3 = map(clamp01, img2); unique(img3)
1-element Vector{Float16}:
1.0
julia> img3 = map(clamp01nan, img2); unique(img3)
1-element Vector{Float16}:
1.0
julia> img3 = clamp01nan.(img2); unique(img3)
1-element Vector{Float16}:
1.0
julia> versioninfo()
Julia Version 1.10.2
Commit bd47eca2c8 (2024-03-01 10:14 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 16 × AMD Ryzen 7 4800HS with Radeon Graphics
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, znver2)
Threads: 6 default, 0 interactive, 3 GC (on 16 virtual cores)
Environment:
JULIA_EDITOR = code
JULIA_NUM_THREADS = 6
julia> Pkg.status()
[5ae59095] Colors v0.12.10
[8f5d6c58] EzXML v1.2.0
[5789e2e9] FileIO v1.16.3
[e9467ef8] GLMakie v0.9.10
[f67ccb44] HDF5 v0.17.2
⌃ [6218d12a] ImageMagick v1.2.1
[86fae568] ImageView v0.12.1
[916415d5] Images v0.26.1
[9c8b4983] LightXML v0.9.1
[dbb5928d] MappedArrays v0.4.2
[c020b1a1] NaturalSort v1.0.0
[731e570b] TiffImages v0.10.0
[1986cc42] Unitful v1.19.0
[d6f4376e] Markdown
[[deps.ImageCore]]
⋮
version = "0.9.4"
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 3Dimg = data[:, :, :, 1]
,size(img) = (512, 512, 100)
. It is ok if I directly save this Array{UInt16, 3} as tiffFileIO.save("img.tif", img)
But if I convert it into floating point
img = Float16.(img)
,typeof(img) = Array{Float16, 3}
and try to saveFileIO.save("img.tif", img)
.Here the problem and error come,
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.