brain images: convert between different formats

1 min read

For single file to single file conversion, you usually use mri_convert of freesurfer. For example
mri_convert x.img y.nii

Other options would be LONI Debabeler or MRICro.

Here are some special cases:
multiple 3D ANALYZE to a single 4D Nifti: mri_concat
mri_concat is a program of freesurfer. Assume the original image files are f001.img, f002.img … etc. The output file is f.nii.
[code=”js”]
mri_concat f???.img –o f.nii
[/code]

You can also use FSL’s fslmerge to achieve the same thing (but pay attention to your fsl environment setting for default output format).
multiple DICOM to other format
To convert DICOM files to other format, use mri_convert
[code=”js”]
mri_convert I0001.dcm T1.mgz
[/code]
If you have a bunch of DICOM files (slices) for a single brain, you only need to input the 1st one as the argument of mri_convert.

Another way is to use SPM’s DICOM import. In the end you get ANALYZE files.
GE 7 file to ANALYZE or Nifti: makevols and makenifti
.7 files are functional images produced by GE scanners in Stanford. You use makevols to convert.
[code=”js”]
makevols E*P*.7 I
rename I.V I_ I.V*
[/code]
You will get a bunch of .img/.hdr files.
To make a Nifti file, you run
[code=”js”]
makenifti Efilename outfilename
[/code]

The output is a single nii file (outfilename.nii).

Note: If you rename the .7 files, you might not get makevols to work. For example, if you rename P06144.7 to P06144_mer1.7, makevols doesn’t work (only produces a lot .hdr files but not .img files).

makevols and makenifti are written by Dr. Gary Glover at Stanford University. Here you can download the two programs.

Check out here to see how to convert images with different number of bytes per voxel.


Don't want to miss new papers in your field? Check out Stork we developed:

NIRS知识红包竞猜

想了解近红外fnirs技术的同学,可以考虑参加我们周六中午的知识竞猜活动。因为心仪科技的慷慨赞助,我们今年的红包比往年大几倍,从5元涨到20元,最后还有大题,奖励100元的大红包。欢迎大家踊跃参加,也欢迎邀请朋友来。 时间:北京时间本周六(2020/2/15)中午12点,在“NIRS知识红包竞猜”群。 不了解心仪的同学,可以趁此机会了解一下: 上海心仪电子科技有限公司是一家专业从事心理学、认知神经科学和脑科学产品技术服务商,目前公司代理了德国ANT便携式脑电、美国ISS公司的Imagent近红外、韩国OBELAB便携式近红外、MAG&More公司的PowerMag系列经颅磁,为脑功能成像和调控提供全套解决方案。
Xu Cui
2 sec read

After fNIRS experiment …

Xu Cui
13 sec read

2 Replies to “brain images: convert between different formats”

  1. Hi Professor,

    Is it possible to convert/merge multiple 3D Analyze files into a single 4D NIFTI using R?

    Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *