磁共振影像分析之: 基于FSL的VBM分析(2)

本文详细介绍了在磁共振影像分析中,如何利用FSL进行VBM分析的统计部分,包括fslvbm_3_proc命令的内部过程、fslvbm3a和fslvbm3b的步骤。fslvbm3a主要负责图像配准和模板生成,而fslvbm3b涉及信号强度处理和高斯平滑。此外,还提到了fslmaths和randomise命令的使用,randomise用于非参数统计分析。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

统计分析

生成好study-specific模板, 下来要做统计分析组间差异了. 如果用fsl提供的vbm方案, 这一步对应的就是fslvbm_3_proc这个命令了.

fslvbm_3_proc

这一步和实验设计和研究问题本身很有关系. 这里讲讲fslvbm_3_proc命令的内部过程吧.

这个文件保存在 $FSLDIR/bin中, 可以用vim查看vim $FSLDIR/bin/fslvbm_3_proc. shell脚本的主体如下(省略帮助和说明文字)

#!/bin/sh
export LC_ALL=C

echo [`date`] [`hostname`] [`uname -a`] [`pwd`] [$0 $@] >> .fslvbmlog

mkdir -p stats
cd struc

echo "Now running the preprocessing steps and the pre-analyses"

/bin/rm -f fslvbm3a
for g in `$FSLDIR/bin/imglob *_struc.*` ; do
  echo $g
  echo "${FSLDIR}/bin/fsl_reg ${g}_GM template_GM ${g}_GM_to_template_GM -fnirt \"--config=GM_2_MNI152GM_2mm.cnf --jout=${g}_JAC_nl\"; \
        $FSLDIR/bin/fslmaths ${g}_GM_to_template_GM -mul ${g}_JAC_nl ${g}_GM_to_template_GM_mod -odt float" >> fslvbm3a
done
chmod a+x fslvbm3a
fslvbm3a_id=`${FSLDIR}/bin/fsl_sub -T 40 -N fslvbm3a -t ./fslvbm3a`
echo Doing registrations: ID=$fslvbm3a_id

cd ../stats

cat <<stage_preproc2 > fslvbm3b
#!/bin/sh

\$FSLDIR/bin/imcp ../struc/template_GM template_GM

\$FSLDIR/bin/fslmerge -t GM_merg     \`\${FSLDIR}/bin/imglob ../struc/*_GM_to_template_GM.*\`
\$FSLDIR/bin/fslmerge -t GM_mod_merg \`\${FSLDIR}/bin/imglob ../struc/*_GM_to_template_GM_mod.*\`

\$FSLDIR/bin/fslmaths GM_merg -Tmean -thr 0.01 -bin GM_mask -odt char

/bin/cp ../design.* .

for i in GM_mod_merg ; do
  for j in 2 3 4 ; do
    \$FSLDIR/bin/fslmaths \$i -s \$j \${i}_s\${j} 
    \$FSLDIR/bin/randomise -i \${i}_s\${j} -o \${i}_s\${j} -m GM_mask -d design.mat -t design.con -V
  done
done

stage_preproc2

chmod a+x fslvbm3b

fslvbm3b_id=`${FSLDIR}/bin/fsl_sub -T 15 -N fslvbm3b -j $fslvbm3a_id ./fslvbm3b`

echo Doing subject concatenation and initial randomise: ID=$fslvbm3b_id

echo "Once this has finished, run randomise with 5000 permutations on the 'best' smoothed 4D GM_mod_merg. We recommend using the -T (TFCE) option. For example:"
echo "randomise -i GM_mod_merg_s3 -o GM_mod_merg_s3 -m GM_mask -d design.mat -t design.con -n 5000 -T -V"

这个shell脚本中, 采用cat命令配合EOF符号生成了另两个脚本: fslvbm3a 和fslvbm3b . 值得一提的是, 这里采用fsl_sub命令调用并行计算进行计算加速. 但是这个命令是基于Sun grid cluster的, 所以对于普通的台式机, 或者工作站, 建议将这一步去掉, 直接运行fslvbm3a或者fslvbm3b.

我们再从头看看这个脚本. 首先来说说生成脚本fslvbm3a的部分.

fslvbm3a

这一步是对统计分析前的准备工作.

使用fsl_reg将所有灰质图像和study-specific的模板配准, 生成${g}_GM_to_template_GM, 之后乘以Jac_nl, 生成${g}_GM_to_template_GM_mod ${g}是指被试样本的名称.

fslvbm3b

1) 进入states 文件夹, 拷贝template_GM到该文件夹.

2) 用fslmerge将(../struc中的所有_GM_to_template_GM)图像沿着”时间”轴拼接concatenate到一起, 生成GM_merge
同时, 将(../struc中所有_GM_to_template_GM_mod)图像沿着”时间”轴concatenate到一起, 生成GM_mod_merg.

当然, 这里的”时间”轴, 只是一个序号而已. 并不没有时间属性. 以下是fslmerge命令的用法:

Usage: fslmerge <-x/y/z/t/a/tr> <output> <file1 file2 .......> [tr value in seconds]
     -t : concatenate images in time
     -x : concatenate images in the x direction
     -y : concatenate images in the y direction
     -z : concatenate images in the z direction
     -a : auto-choose: single slices -> volume, volumes -> 4D (time series)
     -tr : concatenate images in time and set the output image tr to the final option value

3) 对GM_merg 所有图像中信号强度是否0.01做binary(非0即1)的voxel沿着”时间”轴做平均, 设置输出的结果为字符char.
fslmaths GM_merg -Tmean -thr 0.01 -bin GM_mask -odt char

4) 将design.*文件全部拷贝到./stat中. 之后对GM_mod_merg中的每个图片,
对每个图片做高斯平滑, 分别选择平滑核宽度为2mm 3mm 和4mm. 然后用randomise命令做非参数统计. 将刚才进行过高斯平滑的图像作为输入, 输出文件名称为${g}_s${j} ${g}为被试文件名称, ${j}是高斯核宽度. GM_mask 是前一步生成的mask文件, -d后面是设计文件design.mat, -t后面紧跟着的是t检验设置文件,design.con 最后的-V是指在t检验时使用方差平滑.

fslmaths \$i 
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值