JuliaNeuroscience / NIfTI.jl

Julia module for reading/writing NIfTI MRI files
Other
71 stars 35 forks source link

Integration with FileIO #7

Open SimonDanisch opened 7 years ago

SimonDanisch commented 7 years ago

Should we register the NIfTI file format with FileIO? I guess it'd just be something like this:

add_format(format"NIfTI", (), ".nii") #<-- put this into https://github.com/JuliaIO/FileIO.jl/blob/master/src/registry.jl
FileIO.load(file::File{format"NIfTI"}) = NIfTI.niread(filename(file))

with the magick number instead of the () ;)

dpsanders commented 7 years ago

Bump.

Gnimuc commented 7 years ago

+1

SimonDanisch commented 7 years ago

What's holding me back is, that we still don't have a good story for handling zipped files -.- @timholy, have you already thought about handling that? I don't know compression very well. Could we just uncompress the header? Uncompressing the whole file as soon as we found out it's a gzip and then passing the uncompressed file to e.g. NIfTI doesn't seem like the right way to do things...

simonster commented 7 years ago

Libz and GZip both offer buffered reading of compressed files, so if you set the buffer size to be small and don't read more than it, that's all that will ever be read from the file.