1
$\begingroup$

The problem I have is that the MRI scan is stopped manually, before the exam card is completed. Thus data anaylsis programs read the header and expect a certain number of volumes but it has less, and on top of that the final volume is partial so I can't simply modify the header so that it looks for less. Programs such as fslroi that allow trimming volumes do not handle partial volumes. How can I remove the partial data so that the file is correctly read?

$\endgroup$
1
$\begingroup$

I found the solution using the python package nibabel. The code is rather simple. If filename is your nii, or rec file use:

import nibabel as nib
img = nib.load(filename,permit_truncated=True)
print("Saving image with shape:",img.shape)
nib.save(img,"truncated_{0}".format(filename))
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.