Open
Description
Hello all,
So I am trying to convert .mnc
images to .nii
with nibabel, here is my code :
import nibabel as nib
(...)
# loading the original image
nibImg = nib.load(srcFilePath)
nibAffine = np.array(nibImg.affine)
nibData = np.array(nibImg.dataobj)
# inverting the data axes and rotating the affine to match nii space
nibAffine[0:3, 0:3] = nibAffine[0:3, 0:3] @ rotZ(np.pi/2) @ rotY(np.pi) @ rotX(np.pi/2)
nibData = nibData.T
nibData = np.swapaxes(nibData, 0, 1)
# creating the nifti image
niftiImg = nib.Nifti1Image(nibData, nibAffine, nibImg.header)
The problem is that the header nib.minc2.Minc2Image.header
does nto have proper TR information :
In [270]: nibImg.header.get_zooms()
Out[270]: (4.000000000000021, 4.000000000000001, 4.0, 4.0)
When it should be (using mincheader):
acquisition:repetition_time = 2. ;
I started investigated and apparently it has something to do with
nibabel/nibabel/spatialimages.py
Line 511 in 8b1a1b2
Thank you for your work,