MRI数据格式转换——基于Nipype/FreeSurfer

1. 将数据转换为Nifti格式

a. 用MRICro的MRIConvert进行数据格式的转换

b. 用FreeSurfer’的 mri_convert函数,鉴于大多数的scanner格式默认为DICOM,这里我们介绍怎样将DICOM格式转换为Nifiti格式。

    首先需要确认文件夹的结构,假设dicom文件存放在一个名为raw_data的文件夹内,其结构类型如下:

raw_dicom
|-- sub001
|   |-- t1w_3d_MPRAGE
|   |   |-- 00001.dcm
|   |   |-- ...
|   |   |-- 00176.dcm
|   |-- fmri_run1_long
|   |   |-- 00001.dcm
|   |   |-- ...
|   |   |-- 00240.dcm
|   |-- fmri_run2_long
|       |-- ...
|-- sub0..
|-- sub010

批量进行格式转换的代码如下:

TUTORIAL_DIR=~/nipype_tutorial     # location of experiment folder
RAW_DIR=$TUTORIAL_DIR/raw_dicom    # location of raw data folder
T1_FOLDER=t1w_3d_MPRAGE            # dicom folder containing anatomical scan
FUNC_FOLDER1=fmri_run1_long        # dicom folder containing 1st     functional scan
FUNC_FOLDER2=fmri_run2_long        # dicom folder containing 2nd functional scan
DATA_DIR=$TUTORIAL_DIR/data        # location of output folder

for id in $(seq -w 1 10)
do
    mkdir -p $DATA_DIR/sub0$id
    mri_convert $RAW_DIR/sub0$id/$T1_FOLDER/00001.dcm    $DATA_DIR/sub0$id/struct.nii.gz
    mri_convert $RAW_DIR/sub0$id/$FUNC_FOLDER1/00001.dcm $DATA_DIR/sub0$id/run001.nii.gz
    mri_convert $RAW_DIR/sub0$id/$FUNC_FOLDER2/00001.dcm $DATA_DIR/sub0$id/run002.nii.gz
done

原文地址:miykael.github.io/nipype-beginner-s-guide/prepareData.html#make-the-dataset-ready-for-nipype


  • 2
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值