Freesurfer tutorial主要内容

FreeSurfer 能完成对高分辨率的 MRI 图像进行分割、配准及三维重建,其处理过程主要包含去头骨、B1 偏差场校正、体数据配准、灰白质分割、面数据配准等。FreeSurfer 可以方便地处理大脑 MRI 图像,并生成高精度的灰、白质分割面和灰质、脑脊液分割面,根据这两个表面可以计算任何位置的皮质厚度及其他面数据特征如皮质 外表面积、曲率、灰质体积等,这些参数可以映射到通过白质膨胀算法得到的大脑皮质表面上直观显示。另外,FreeSurfer 还具有特征的组间差异分析及结果的可视化功能。
基本指令说明:https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferCommands
recon -all 命令详解:https://surfer.nmr.mgh.harvard.edu/fswiki/ReconAllDevTable
https://www.jianshu.com/p/8e63d73ec842

USAGE: recon-all

 Required Arguments:
   -subjid <subjid>
   -<process directive>

 Fully-Automated Directive:
  -all           : performs all stages of cortical reconstruction
  -autorecon-all : same as -all

 Manual-Intervention Workflow Directives:
  -autorecon1    : process stages 1-5 (see below)  # no-use-gpu: about 10 min
  -autorecon2    : process stages 6-23
                   after autorecon2, check white surfaces:
                     a. if wm edit was required, then run -autorecon2-wm
                     b. if control points added, then run -autorecon2-cp
                     c. proceed to run -autorecon3
  -autorecon2-cp : process stages 12-23 (uses -f w/ mri_normalize, -keep w/ mri_seg)
  -autorecon2-wm : process stages 15-23
  -autorecon2-inflate1 : 6-18
  -autorecon2-perhemi : tess, sm1, inf1, q, fix, sm2, inf2, finalsurf, ribbon
  -autorecon3    : process stages 24-34
                     if edits made to correct pial, then run -autorecon-pial
  -hemi ?h       : just do lh or rh (default is to do both)

  Autorecon Processing Stages (see -autorecon# flags above):
    1.  Motion Correction and Conform  # 运动校正和一致
    2.  NU (Non-Uniform intensity normalization)  # 非均匀强度归一化
    3.  Talairach transform computation  #  Talairach变换计算
    4.  Intensity Normalization 1  # 强度归一化
    5.  Skull Strip  # 颅骨去除   

    6.  EM Register (linear volumetric registration)  # EM寄存器(线性体积配准)
    7.  CA Intensity Normalization  # CA强度归一化
    8.  CA Non-linear Volumetric Registration  # CA非线性体积配准
    9.  Remove neck  # 去除颈部
    10. EM Register, with skull  # EM注册,带头骨
    11. CA Label (Aseg: Volumetric Labeling) and Statistics  # CA标签(Aseg:体积标签)和统计

    12. Intensity Normalization 2 (start here for control points) # 强度归一化2(从控制点开始)
    13. White matter segmentation  # 白质细分
    14. Edit WM With ASeg  # 使用ASeg编辑WM
    15. Fill (start here for wm edits)  # 填充(从这里开始编辑wm)
    16. Tessellation (begins per-hemisphere operations)  # 曲面细分(每半球操作开始)
    17. Smooth1
    18. Inflate1
    19. QSphere
    20. Automatic Topology Fixer  # 自动拓扑修复器
    21. White Surfs (start here for brain edits for pial surf)  # 白色Surfs(从这里开始用于脑部冲浪的大脑编辑)
    22. Smooth2
    23. Inflate2

    24. Spherical Mapping  # 球面映射
    25. Spherical Registration  # 球形配准
    26. Spherical Registration, Contralater hemisphere  # 球面配准,Contralater半球
    27. Map average curvature to subject  # 将平均曲率映射到主题
    28. Cortical Parcellation (Labeling)  # 皮质分割(标签)
    29. Cortical Parcellation Statistics  # 皮质分割统计
    30. Pial Surfs  # Pial Surfs
    31. WM/GM Contrast  # WM / GM对比
    32. Cortical Ribbon Mask  # 皮质功能掩膜
    33. Cortical Parcellation mapped to ASeg  # Cortical Parcellation映射到ASeg
    34  Brodmann and exvio EC labels  # Brodmann和exvio EC标签

 Step-wise Directives
  See -help
    ...

在 FreeSurfer 软件中,运行“recon -all”命令后,会在 surf 文件夹下生成 . white、. sphere、. inflated 等网格点文件。每一个文件里面都存储了大脑皮质表面网格点的三维坐标及相邻顶点构成的三角面片信息,需要注意的是 FreeSurfer 采用的是 RAS 坐标系,其意义为 R:right,X 轴正方向;A:anterior,Y 轴正方向;S:superior,Z 轴正方向。

FreeSurfer 也会在 surf 文件夹下生成基于曲面的形态特征数据,不同的特征采用不同的文件后缀名,如皮质厚度( . thickness )、雅可比度量(. jacobian. white)、脑沟( . sulc )、曲率(. curv)、外表面积(. area)、体积(. volume)等面数据文件,其坐标索引号与 Mesh 网格序号一致。

FreeSurfer 在图像处理过程中依据 Destrieux 分区法对脑区进行标签划分。该分区方法将大脑皮质表面划分为 75 个脑区,其分区结构主要为各脑回和脑沟,分区依据为曲率的大小,其脑回区域只包括脑膜表面的部分,而隐藏在下面的部分则被划分为脑沟区域。其分区文件为 label 文件夹下的 h.aparc.a2009s.annot 文件,该文件夹下还有对应的部分 Broadmann 分区文件(. label)。

过程中可以使用以下命令来调用recon-all函数来进行脑区分割。该命令使用的文件类型为 mgz, nii, nii.gz。当当前的文件格式为其它格式时,可使用命令mri_convert * *.nii来进行格式转换。

$> export SUBJECTS_DIR=<path to subject directory> # SUBJECTS_DIR变量为存储数据的目录
$> recon-all -i sample-001.nii.gz -s bert -all (creates a folder called bert in SUBJECTS_DIR)

该操作是十分耗时的,进行一例nii数据的脑区分割需要8小时左右,具体时间视配置有所改变。在完成分割之后,即可通过可视化软件如FreeView来进行结果查看。这里,我们的目标是使用python来获取各个脑区的Mask,首先,看一下各个脑区对应的索引,该数据保存在$FREESURFER_HOME/FreeSurferColorLUT.txt:

https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/AnatomicalROIV6.0#IndividualStatsfiles
以下,我们假设保存的文件路径为bert。则,皮层下体积统计信息保存在bert/stats/aseg.stats中。统计信息包括 Index(在统计信息中的序号),SegId(对应的脑区索引),NVoxels(分割的体素数量),StrutName(在LUT中的名字),Mean/StdDev/Min/Max/Range: ROI的强度统计

FreeSurfer使用了多种皮质层分割方法。使用Desikan/Killiany Atlas可分为35个脑区,数据保存在bert/label/*h.aparc.annot中。使用Destrieux Atlas时,可分割出58个脑区,保存在bert/label/*h.aparc.a2009s.annot文件中。两中方法分割的统计信息保存在bert/stats中如:h.aparc.stats和h.aparc.a2009s.stats。MRI数据分别保存为bert/mri/aparc.DKTatlas+aseg.mgz以及bert/mri/aparc.a2009s+aseg.mgz,除此之外还有一个bert/mri/aparc+aseg.mgz。
统计信息表现为下图,StructName表示结构名,NumVert表示结构中包含的顶点数,SurfArea表示表面积,GrayVol表示灰质体积,ThickAvg/ThickStd表示结构厚度的均值与标准差,MeanCurv表示平均曲率,GausCurv表示平均高斯曲率,FoldInd表示折叠指数,CurvInd表示曲率指数。

软件用例

https://blog.csdn.net/uinglin/article/details/79541063

Example 1: 将sample-001.mgz 转换成nifti格式。.
$> cp $FREESURFER_HOME/subjects/sample-001.mgz .
$> mri_convert sample-001.mgz sample-001.nii.gz

Example 2: .对nifti文件进行重新配置

$> export SUBJECTS_DIR=
$> recon-all -i sample-001.nii.gz -s bert -all (creates a folder called bert in SUBJECTS_DIR)
Example 3: 在预先存在的主题文件夹上执行全面重新配置

$> export SUBJECTS_DIR=
$> recon-all -s bert -all

Introduction to Freesurfer Output

https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/OutputData_freeview
https://blog.csdn.net/qq_28480795/article/details/105094883
本教程旨在介绍Freeview。有关此处未介绍的按钮或菜单选项的信息,您可以在FreeviewGuide wiki上找到。
主要内容

  1. 如何可视化和检查FreeSurfer数据。
  2. 在Freeview中可视化数据的命令。
  3. 可视化数据时要寻找什么,包括表面遵循灰质和白质边界,以及aseg.mgz精确遵循皮质下强度边界。
  4. 可以在3D中查看表面,例如软脑膜、白色和膨胀表面、脑沟和皮质图、厚度图和皮质分区。
  5. 练习4,导出gif文件。
    注意事项
    每次进入终端使用FreeSurfer的时候需要输入命令:
    source ~/.bashrc
    export SUBJECTS_DIR=$TUTORIAL_DATA/buckner_data/tutorial_subjs
    cd SUBJECTS_DIR
    查看图像
freeview -v \
good_output/mri/T1.mgz \
good_output/mri/wm.mgz \
good_output/mri/brainmask.mgz \
good_output/mri/aseg.mgz:colormap=lut:opacity=0.2 \
-f good_output/surf/lh.white:edgecolor=blue \
good_output/surf/lh.pial:edgecolor=red \
good_output/surf/rh.white:edgecolor=blue \
good_output/surf/rh.pial:edgecolor=red

3D

freeview -f  good_output/surf/lh.pial:annot=aparc.annot:name=pial_aparc:visible=0 \
good_output/surf/lh.pial:annot=aparc.a2009s.annot:name=pial_aparc_des:visible=0 \
good_output/surf/lh.inflated:overlay=lh.thickness:overlay_threshold=0.1,3::name=inflated_thickness:visible=0 \
good_output/surf/lh.inflated:visible=0 \
good_output/surf/lh.white:visible=0 \
good_output/surf/lh.pial \
--viewport 3d

Practice Working with Data

https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/Practice
主要内容

  1. 打开一套扫描DICOM
  2. 为T1加权扫描找到正确的输入dicom文件
  3. 将此输入dicom文件传递给FreeSurfer的recon all stream。
    Exercise 1:
    用dicom_challenge中的数据生成surfers,输出在dicom_challenge/practice_subject目录下。
    cd KaTeX parse error: Undefined control sequence: \ at position 31: …icom_challenge \̲ ̲cd dicoms \ dcm…TUTORIAL_DATA/dicom_challenge
    recon-all -all -i I50 -s practice_subject
    说明:export =前后不能有空格
    (不是特别明白-i I50的意思)
    -i stands for input. Here, you would specify one dicom file/slice in the T1-weighted scan series you collected (FreeSurfer will find the rest of the files in the DICOM series/ the rest of the slices automatically). Make sure you specify the full path to the file if it is not in the directory you are currently in. You could also specify nifti files as input. If you have more than one T1-weighted scan for a given subject, use additional -i flags for each one.

Surface Based Group Analysis

https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/GroupAnalysisV6.0
主要内容

  1. 创建设计矩阵或FSGD文件
  2. 创建一个对比文件
  3. 通过运行mris_preproc和mri_surf2surf来收集数据
  4. 使用mri_glmfit运行GLM分析
  5. 使用freeview可视化分析

Clusterwise Correction for Multiple Comparisons (Permutation)多重比较的聚类校正(排列)

https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/MultipleComparisonsV6.0Perm
主要内容

  1. 使用mri_glmfit运行分析以获得未校正的地图
  2. 使用mri_glmfit-sim运行置换模拟
  3. 正确的多重比较

Surface Group Analysis with Qdec (Qdec表面基团分析)

https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/MultipleComparisonsV6.0Perm
https://blog.csdn.net/qq_28480795/article/details/105972389#comments_17694183
主要内容

  1. 使用mri_glmfit运行分析以获得未校正的地图
  2. 使用mri_glmfit-sim运行置换模拟
  3. 正确的多重比较

Surface Group Analysis with Qdec

https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/QdecGroupAnalysisV6.0
https://blog.csdn.net/qq_28480795/article/details/105993670
主要内容,学习如何对基于组曲面的数据执行统计分析,包括:

  1. 群数据的预处理
  2. 构建受试者人口统计的qdec.table.dat文件
  3. 使用Qdec设计和执行您的分析
  4. 与Qdec显示器交互
  5. 创建感兴趣区域(ROI),以便进一步分析和最终检查数据
  1. 从自己的数据集中创建平均对象,则可以使用make_average_subject(https://surfer.nmr.mgh.harvard.edu/fswiki/make_average_subject)。
  2. 问题 “qdec.bin: error while loading shared libraries: libjpeg.so.62: cannot open shared object file: No such file or directory”
    解决方案:sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so.8.0.2 /usr/lib/libjpeg.so.62 没有用
    apt-get install libjpeg62
    3)问题
    Tcl_Init error: Can’t find a usable init.tcl in the following directories:
    /usr/pubsw/packages/tcltktixblt/current/lib/tcl8.4 /home/hsn/freesurfer/lib/tcl8.4 /home/hsn/lib/tcl8.4 /home/hsn/freesurfer/library /home/hsn/library /home/hsn/tcl8.4.6/library /home/tcl8.4.6/library /usr/pubsw/packages/tcltktixblt/current/lib/tcl8.4
    This probably means that Tcl wasn’t installed properly.
    Error initializing Tcl.
    解决:~~sudo apt install tcl~~没有用,可能因为安装的位置不在上面的文件夹中,
    init.tcl文件在/home/hsn/freesurfer/lib/tktools/tcl8.4
    将tcl8.4拷贝至以上位置中的其中之一即可。
    类似的,需要将tktools文件夹内的内容全部拷贝至/home/hsn/freesurfer/lib/

Anatomical ROI analysis 解剖ROI分析

https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/AnatomicalROIV6.0
https://blog.csdn.net/qq_28480795/article/details/106191285

重点:Relationship between segmentation, parcellation and LookUp Table (LUT)
the orig and aparc+aseg segmentation volume (aparc+aseg.mgz)
the cortical surface parcellation (aparc.annot)
the subcortical segmentation (aseg) and the cortical parcellation (aparc)
The statistical output from the subcortical segmentation, called aseg.stats, is a regular text file and will contain the volumes of specific structures.
The statistical output from the cortical parcellation, called lh.aparc.stats and rh.aparc.stats, is a regular text file and will contain the thickness of specific structures.

在FreeSurfer处理流中,通过recon-all脚本生成了一些统计输出文件。 它们保存在每个受试者的stats /子目录中,并为**皮层下分割subcortical segementation(aseg)皮层分区cortical parcellation(aparc)**生成。
皮层下分割的统计输出称为aseg.stats,是常规文本文件,将包含特定结构的体积。
皮层分区的统计输出,称为lh.aparc.stats和rh.aparc.stats,是常规文本文件,将包含特定结构的厚度。
关于以上文件的介绍:
https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/AnatomicalROIV6.0#IndividualStatsfiles

关于皮层分区cortical parcellation

https://surfer.nmr.mgh.harvard.edu/fswiki/CorticalParcellation
https://blog.csdn.net/qq_28480795/article/details/112388509

使用GPU加速

-use-gpu,例:

$ recon-all -i sample-001.nii.gz -s SkullStrip_FreeSurfer -autorecon1 -use-gpu
  • 2
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值