首先使用较多的脑部分析工具包括spm,FSL以及使用较多的Freesurfer.
Freesurfer是被使用最多的,可以很好的处理T1影像,做VBM,SBM等分析。就是有一个缺点就是费时。一个病例的处理时间可能长达8小时左右。2020年提出的Fastsurfer将深度学习的方法,改进了皮层重建的方法使这一任务所需时间大大减少。
Fastsurfer:《FastSurfer - A fast and accurate deep learning based neuroimaging pipeline》
相关介绍:FastSurfer深度学习脑部成像工具:1分钟脑部分割,1小时皮质重建!
在开始之前确保你已经安装好freesurfer并下载好Fastsurfer的代码并配置好环境。
1.single_seg#仅做单个全脑分割
终端打开cd path/to/fastsurfer/FastsurferCNN
export FREESURFER_HOME=/usr/local/freesurfer
source $FREESURFER_HOME/SetUpFreeSurfer.sh
export FASTSURFER_HOME=/home/vision/xtt/FastSurfer
python3 eval.py --i_dir /home/vision/xtt/FastSurfer \ ##输入T1路径
--o_dir /home/vision/xtt/FastSurfer \ ##输出分割结果路径
--t subject2 \ ##T1前一级文件名
--log temp_Competitive.log \
--network_sagittal_path ../checkpoints/Sagittal_Weights_FastSurferCNN/ckpts/Epoch_30_training_state.pkl \
--network_coronal_path ../checkpoints/Coronal_Weights_FastSurferCNN/ckpts/Epoch_30_training_state.pkl \
--network_axial_path ../checkpoints/Axial_Weights_FastSurferCNN/ckpts/Epoch_30_training_state.pkl
全脑分割结果
2.multiple seg
终端打开cd path/to/fastsurfer/FastsurferCNN
python3 eval.py --i_dir /home/vision/xxx/xxx/GroupA/fixdata \
--o_dir /home/vision/xxx/xxx/GroupA/fixdata \
--in_name T1.nii.gz \
--log temp_Competitive.log \
--network_sagittal_path ../checkpoints/Sagittal_Weights_FastSurferCNN/ckpts/Epoch_30_training_state.pkl \
--network_coronal_path ../checkpoints/Coronal_Weights_FastSurferCNN/ckpts/Epoch_30_training_state.pkl \
--network_axial_path ../checkpoints/Axial_Weights_FastSurferCNN/ckpts/Epoch_30_training_state.pkl
3.皮质分区与皮层重建
将分割结果重建一个文件夹MRI放进去
#single surfer###############
export FREESURFER_HOME=/usr/local/freesurfer
source $FREESURFER_HOME/SetUpFreeSurfer.sh
export FASTSURFER_HOME=/home/vision/xtt/FastSurfer
datadir=/home/vision/xtt/seg
segdir=/home/vision/xtt/seg
targetdir=/home/vision/xtt/seg
./recon-surf.sh --sid subject13 \
--sd $targetdir \
--t1 $datadir/subject13/T1.nii.gz \
--parallel \
--py python3.6
##多个
python3 eval.py --i_dir /home/vision/xtt/ALS/GroupA/fixdata \
--o_dir /home/vision/xtt/ALS/GroupA/fixdata \
--in_name T1.nii.gz \
--log temp_Competitive.log \
--network_sagittal_path ../checkpoints/Sagittal_Weights_FastSurferCNN/ckpts/Epoch_30_training_state.pkl \
--network_coronal_path ../checkpoints/Coronal_Weights_FastSurferCNN/ckpts/Epoch_30_training_state.pkl \
--network_axial_path ../checkpoints/Axial_Weights_FastSurferCNN/ckpts/Epoch_30_training_state.pkl
结果查看:
皮层重建结果
freeview -v \
mri/T1.mgz \
mri/wm.mgz \
mri/brainmask.mgz \
mri/aseg.mgz:colormap=lut:opacity=0.2 \
-f \
surf/lh.white:edgecolor=blue \
surf/lh.pial:edgecolor=red \
surf/rh.white:edgecolor=blue \
surf/rh.pial:edgecolor=red
#surfer view- 3D###########
freeview -f bert/surf/lh.pial:annot=aparc.annot:name=pial_aparc:visible=0 \
bert/surf/lh.pial:annot=aparc.a2009s.annot:name=pial_aparc_des:visible=0 \
bert/surf/lh.inflated:overlay=lh.thickness:overlay_threshold=0.1,3::name=inflated_thickness:visible=0 \
bert/surf/lh.inflated:visible=0 \
bert/surf/lh.white:visible=0 \
bert/surf/lh.pial \
--viewport 3d
全脑分割统计表,可以后续做SBM VBM