Print

Print


Hi Robin,
What version of FSL are you using?

Kind Regards
Matthew
--------------------------------
Dr Matthew Webster
FMRIB Centre
John Radcliffe Hospital
University of Oxford

On 27 Nov 2019, at 10:02, SUBSCRIBE FSL Robin Kampe <[log in to unmask]<mailto:[log in to unmask]>> wrote:

Hello,

I'm dependent on that my data is in .nii format and that the functions fslreorient2std and robustfov work on these .nii files (to be fed into fslvbm).

We downloaded data from the public dataset OASIS1 and those are in .img and .hdr format.

After googling arround I found a few ways to convert them and first I tried the fsl way.

fslchfiletype

fslchfiletype NIFTI OAS1_0457_MR1_mpr-1_anon.hdr  test.nii
and I get:
/home/robka/fsl/bin/fslchfiletype: line 90:  6325 Segmentation fault      (core dumped) $FSLDIR/bin/fslchfiletype_exe $1 $oldfile $newfile

So I tried nibabel in Python instead

2)
import nibabel as nb
fname = '<file name>.img'
img = nb.load(fname)
nb.save(img, fname.replace('.img', '.nii'))
This generates a .nii file that I can view

But when trying the fslreorient2std function I got:

When not renaming the .nii:
fslreorient2std OAS1_0001_MR1_mpr-1_anon.nii
Image Exception : #61 :: Multiple possible filenames detected for basename: OAS1_0001_MR1_mpr-1_anon
Multiple possible filenames detected for basename: OAS1_0001_MR1_mpr-1_anon
Image Exception : #61 :: Multiple possible filenames detected for basename: OAS1_0001_MR1_mpr-1_anon
Multiple possible filenames detected for basename: OAS1_0001_MR1_mpr-1_anon
/home/robka/fsl/bin/fslreorient2std: line 106: [: too many arguments
/home/robka/fsl/bin/fslreorient2std: line 115: [: =: unary operator expected
Image Exception : #61 :: Multiple possible filenames detected for basename: OAS1_0001_MR1_mpr-1_anon
Multiple possible filenames detected for basename: OAS1_0001_MR1_mpr-1_anon
etc...

And when renaming it to test.nii prior to running the function:
fslreorient2std  test.nii test2.nii
ERROR: Orientation information not stored in test.nii!
Cannot reslice without orientation information (i.e. need valid labels in FSLView)
The NIfTI image must contain a non-zero code for either the sform or the qform
- check your reconstruction/conversion software to try and fix this


It seems not all header info needed is there. The only extra info I can find in the dataset is:
SCAN NUMBER:  mpr-1
TYPE:         MPRAGE
Vox res (mm): 1.0 x 1.0 x 1.25
Rect. Fov:    256/256
Orientation:  Sag
TR (ms):      9.7
TE (ms):      4.0
TI (ms):      20.0
Flip:         10

Is there a way to fix this? AFNI also struggles to convert these to .nii via

   "to3d -prefix afni_temp *.hdr” followed by
   3dAFNItoNIFTI -prefix nifti_file afni_temp.HEAD

where to3d complains that axis orientations are not consistent.

########################################################################

To unsubscribe from the FSL list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/webadmin?SUBED1=FSL&A=1


########################################################################

To unsubscribe from the FSL list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/webadmin?SUBED1=FSL&A=1