-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Files written by niwrite are corrupted #57
Comments
What kind of image was "mask.nii.gz"? Just ones and zeros, or boolean values? |
Ones and zeros. But the files were corrupted whatever the datatype was. |
But were the ones and zeros |
I have the same "file corrupted" error for |
This error seems to come up with both |
Apparently the last PR broke Int16, even though it was specifically aimed at supporting it. What would be really helpful is if we had self contained tests to ensure this sort of thing doesn't happen for specific bit types. If someone could make a PR addressing at least part of this I can make sure to review it so this actually starts getting fixed |
I was checking in to see if there has been any progress on the NIfTI writing problem. I wrote a simple script to merge two segmentation labels in NIfTI images generated by ITK-Snap, only to discover, alas, this writing problem. Julia version: 1.8.5 using NIfTI
t1 = niread("test.nii.gz")
println("Successfully read in test image")
niwrite("test2.nii.gz", t1)
println("Successfully wrote out test image")
t2 = niread("test2.nii.gz")
println("Successfully read in image writen by NIfTI.jl") Successfully read in test image
Successfully wrote out test image
ERROR: LoadError: EOFError: read end of file
Stacktrace:
[1] unsafe_read(stream::TranscodingStreams.TranscodingStream{CodecZlib.GzipDecompressor, IOStream}, output::Ptr{UInt8}, nbytes::UInt64)
@ TranscodingStreams ~/.julia/packages/TranscodingStreams/5yQuA/src/stream.jl:378
[2] unsafe_read
@ ./io.jl:759 [inlined]
[3] read!
@ ./io.jl:777 [inlined]
[4] read_volume(io::TranscodingStreams.TranscodingStream{CodecZlib.GzipDecompressor, IOStream}, #unused#::Type{Float32}, dim::Tuple{Int64, Int64, Int64}, map::Bool)
@ NIfTI ~/.julia/packages/NIfTI/BJohD/src/volume.jl:18
[5] niread(file::String; mmap::Bool, mode::String)
@ NIfTI ~/.julia/packages/NIfTI/BJohD/src/NIfTI.jl:0
[6] niread(file::String)
@ NIfTI ~/.julia/packages/NIfTI/BJohD/src/NIfTI.jl:266
[7] top-level scope
@ ~/Code/pushing_against_ignorance_naive/Imaging/test.jl:7
in expression starting at test.jl:7 |
I'm working on it this week. |
Hi
When I was using
niwrite
to save*nii.gz
ir*.nii
files, they seemed to be corrupted consistently.The version infos are shown below:
The command used to work fine, but since last week I always received this error when accessing the files newly written by
niread
, even if I just read a NIfTI file and saved it immediately (though in REPL it complained about nothing):The error I encountered when accessing it suing FSL is
Details: Expected 24781212 bytes, got 6195303 bytes from test.nii.gz - could the file be damaged?
Any help would be much appreciated.
The text was updated successfully, but these errors were encountered: