Read FODs.mif files in Python

Hi yall,

I’m wondering if it’s possible to read FOD mif file data into Python?
I want to work with the full distribution not just the peaks.


Unfortunately there is no code to do this as yet. But if you can read NIfTI in python, there’s nothing stopping you from converting these images to *.nii using mrconvert, and loading them into python that way…?

Thanks for the tip! I converted the FOD.mif file into nii.gz. When I load it in python I get a 145x174x145x45 (HCP data). What does the 4th dimension correspond to?

Each volume corresponds to a different spherical harmonic coefficient. This is explained in the description of the relevant commands, e.g. dwi2fod. Have a look in there, see if that answers your question.

Thanks for your reply. I also need to work with .MIF in python. I’m brand new to MRtrix and cannot find how to convert. I installed the software and typed the commend

mrconvert sample3.MIF output3.nii

in bash. I got the following message

mrconvert: scanning DICOM set “./sample3.MIF” - ok
mrconvert: no DICOM images found in “./sample3.MIF”
mrconvert: error opening image “sample3.MIF”

Could you please help with this? Thanks very much.

shouldn’t the MIF be in lower case?

1 Like