the indentation seems fairly off. does this actually work? also could you please write a test for this? you can create quick temporary files with nibabel.