nibabel
nibabel copied to clipboard
MRTrix MIH/MIF format
Worth looking into: https://mrtrix.readthedocs.io/en/latest/getting_started/image_data.html#mrtrix-image-formats
Convertible to a NIfTI-2, but doesn't seem to be entirely volumetric, so might be worth thinking about a non data/affine/header API.
cc @mattcieslak
I am intending to assign an intern to this project in the near future; if anyone has attempted to make progress on this enhancement but has not indicated such here, please let me know.
Perfect timing @Lestropie! we are about to start on this too. Do you know if this code still works?
The MatLab read/write functions should be working on master
.
What I've not yet looked into is the extent to which the NiBabel API is or is not compatible with the concept of arbitrary strides (documentation; manuscript), as this would influence whether or not the data can be mapped directly.
Is this something that you've already allocated resources to ("are" v.s. "were")? Because if so, that would have consequences for my planning of the relevant internship. Otherwise, my intern would be in contact on here for any aspects of NiBable for which I don't have the relevant expertise.
On a quick scan, I don't think the strides will be a problem - the trick will be to use the strides in creating a suitable array proxy object - see https://github.com/nipy/nibabel/blob/master/nibabel/arrayproxy.py for the basic definition, and https://github.com/nipy/nibabel/blob/master/nibabel/brikhead.py#L210 for a customized version for another format.
@mattcieslak Can I get clarification on whether you "are about to start" as in intending to start, or actually starting the work? If the latter, I need to alter the project contents for my intern. (Assigning the issue to a user would be a good indicator either way)
I was planning in the next few weeks to translate that matlab code to python for a project that reads fixel data from mif files. I wasn't planning on handling all the different strides scenarios though. If you have an employee who would work on this full time that might be the best route for nibabel
It would feel quite incomplete to me having something that would only read fixel data: one of the pros of the fixel directory format is that the raw data are stored in a format no different to that of other neuroimaging data (other than the number of non-unity dimensions). You also wouldn't want to have just a fixel data file reader written on the presumption of trivial strides, since technically even for a nominally 1D "image" you could still have a negative stride on that one non-unity axis. So solving the more general case would seem more suitable to me.
I'll get them to start on an implementation, we'll see how far they get (working part-time) and keep in touch with their progress. Hopefully your own imminent need is met in short time. We may need to reach out during the process though given I myself am familiar with the format and the confound of arbitrary strides but not the internals of NiBabel.
FYI @kitman98 is currently attempting this; we'll keep in touch as we progress.
In case you're not aware, @dchristiaens ' python module might be useful: https://github.com/dchristiaens/mrtrix3-pyio