FreeSurfer入门(2) Practice Working with Data

本文档详细记录了如何在FreeSurfer中识别和准备T1加权医学图像,涉及dcmunpack命令的应用,以及如何通过dcm文件找出合适的T1图像输入到recon-all分割流程。适合初学者理解FreeSurfer数据处理流程。
摘要由CSDN通过智能技术生成


前言

因一些原因需要学习FreeSurfer,然而教程比较少有些难懂,看了一段时间觉得可能要钻钻牛角尖才可以完成学习,所以开始记笔记(基本上是逐字逐句的读tutorial),如果有错误欢迎指正
教程地址: https://surfer.nmr.mgh.harvard.edu/fswiki/Tutorials

教程所使用数据: https://surfer.nmr.mgh.harvard.edu/fswiki/Tutorials

自行安装FreeSurfer

将网站上的tutorial data下载下来后解压,设置环境变量并进入工作目录(两个export可以直接写进bashrc中,我只写了第一个,因为之后freesurfer还要用,总是要改的东西写进bashrc感觉很麻烦)

export TUTORIAL_DATA=<path_to_your_tutorial_data>
export SUBJECTS_DIR=$TUTORIAL_DATA/buckner_data/tutorial_subjs
cd $SUBJECTS_DIR

FreeSurfer的输出中, lh应该是left hemisphere, rh 应该是right hemisphere, 表示左右脑

Finding the correct input for the FreeSurfer pipeline

首先了解一下dicom(Digital Imaging and Communications in Medicine): 医学数字成像和通信,是医学图像和相关信息的国际标准(ISO 12052)。它定义了质量能满足临床需要的可用于数据交换的医学图像格式。文件扩展名为dcm或dcm30(dcm3.0,用30来表示就不会出错)

Presumably, you have copied the dicoms for this subject off the scanner to somewhere else. Running the dcmunpack command on the directory in which the dicoms are located creates a text file showing the name of the scan (as you named it on the scanner) and the dicom series each scan corresponds with. From there, you can identify the T1-weighted image you want to use as input to FreeSurfer.

机翻:假设您已将扫描仪上的该主题的 dicom 复制到其他地方。 在 dicom 所在的目录上运行 dcmunpack 命令会创建一个文本文件,其中显示扫描的名称(正如您在扫描仪上命名的那样)以及每个扫描对应的 dicom 系列。 您可以从那里识别要用作 FreeSurfer 输入的 T1 加权图像。

T1加权图像可以很好的区分大脑的灰质(神经元胞体聚集地)和白质(神经纤维聚集地),常用于大脑解剖结构成像。所以我们通常使用T1作为分析的对象.但是有的时候我们获取的是dicom文件,并不能确定哪些是T1图像,如果我们是操作扫描设备的人当然可以区分,但如果我们只有一个文件夹,里面是一堆dicom文件,那么我们可以用freesurfer尝试一些简单的解读,找到T1图像后再用freesurfer进行分割
指令为dcmunpack
字面意思是:dcm文件格式unpack(解压)
用dcmunpack -help查看这一指令的详细用法
在tutorial里专门给了一个文件夹供练习:

cd $TUTORIAL_DATA/practice_with_data/dicoms

然后就是识别T1加权图像了:

dcmunpack -src . -scanonly scan.log

其中-src是"source",这里用.表示全部,当有明确目标时可以用具体路径表示
-scanonly 是表示只扫描,扫描的列表记录在scan.log中
这个运行时间有点长
然后就可以检查scan.log了

more scan.log

tutorial中给了一个scan.log的大致格式(注意,tutorial给的示例文件里没有这么多内容,示例文件里为了方便快捷运行只给了两项)

1 Localizer ok 256 256 3 1 mri00003.dcm
2 AAHScout ok 160 160 128 1 mri00004.dcm
3 AAHScout ok 162 162 5 1 mri00133.dcm
4 AAHScout ok 162 162 3 1 mri00139.dcm
5 AAHScout ok 162 162 3 1 mri00141.dcm
6 Localizer_aligned ok 256 256 9 1 mri00151.dcm
7 T1w_setter ok 32 32 32 1 mri00152.dcm
8 T1w_MPR_vNav_4e err 192 192 23 1 mri00305.dcm
9 T1w_MPR_vNav_4e ok 256 256 176 4 mri00345.dcm
10 T1w_MPR_vNav_4e ok 256 256 176 4 mri00344.dcm
11 T1w_MPR_vNav_4e ok 256 256 176 4 mri00343.dcm
12 T1w_MPR_vNav_4e ok 256 256 176 1 mri00391.dcm
13 T1w_MPR_vNav_4e ok 256 256 176 1 mri00392.dcm
14 gre_field_mapping_2mm ok 64 64 72 1 mri02842.dcm
15 SpinEchoFieldMap_AP ok 936 936 1 3 mri02879.dcm
16 SpinEchoFieldMap_PA ok 936 936 1 3 mri02882.dcm
17 rfMRI_REST_AP ok 936 936 1 1 mri02885.dcm
18 rfMRI_REST_AP ok 936 936 1 600 mri02886.dcm
19 rfMRI_REST_AP ok 0 0 1 1 mri03485.dcm
20 t1_mp2rage_sag_p3_iso_TI_0700-2500 ok 256 240 176 1 mri03489.dcm
21 t1_mp2rage_sag_p3_iso_TI_0700-2500 ok 256 240 176 1 mri03487.dcm
22 t1_mp2rage_sag_p3_iso_TI_0700-2500 ok 256 240 176 1 mri03498.dcm
23 t1_mp2rage_sag_p3_iso_TI_0700-2500 ok 256 240 176 1 mri03495.dcm
24 t1_mp2rage_sag_p3_iso_TI_0700-2500 ok 256 240 176 1 mri03519.dcm
25 t1_mp2rage_sag_p3_iso_TI_0700-2500 ok 256 240 176 1 mri03520.dcm
26 t1_mp2rage_sag_p3_iso_TI_1300-2700 ok 256 240 176 1 mri04572.dcm
27 t1_mp2rage_sag_p3_iso_TI_1300-2700 ok 256 240 176 1 mri04567.dcm
28 t1_mp2rage_sag_p3_iso_TI_1300-2700 ok 256 240 176 1 mri04586.dcm
29 t1_mp2rage_sag_p3_iso_TI_1300-2700 ok 256 240 176 1 mri04588.dcm
30 t1_mp2rage_sag_p3_iso_TI_1300-2700 ok 256 240 176 1 mri04544.dcm
31 t1_mp2rage_sag_p3_iso_TI_1300-2700 ok 256 240 176 1 mri04543.dcm
32 t2_tse_ax-2mm ok 512 512 27 1 mri05614.dcm
33 T2w_setter ok 32 32 32 1 mri05626.dcm
34 T2w_SPC_vNav err 192 192 17 1 mri05663.dcm
35 T2w_SPC_vNav ok 256 256 176 1 mri05758.dcm
36 T2w_SPC_vNav ok 256 256 176 1 mri05757.dcm
37 gre3D_1iso_PAT2x2_12e ok 256 256 176 12 mri06089.dcm
38 gre3D_1iso_PAT2x2_12e ok 256 256 176 12 mri06083.dcm
39 gre3D_1iso_PAT2x2_12e ok 256 256 176 12 mri06081.dcm
40 gre3D_1iso_PAT2x2_12e ok 256 256 176 1 mri06099.dcm
41 dMRI_dir98_AP_Blue_Umbrella ok 1400 1400 1 1 mri12593.dcm
42 dMRI_dir98_AP_Blue_Umbrella ok 1400 1400 1 99 mri12594.dcm
43 dMRI_dir98_AP_Blue_Umbrella ok 0 0 1 1 mri12693.dcm
44 t1_mp2rage_sag_p3_iso_TI_1900-3210 ok 256 240 176 1 mri12713.dcm
45 t1_mp2rage_sag_p3_iso_TI_1900-3210 ok 256 240 176 1 mri12712.dcm
46 t1_mp2rage_sag_p3_iso_TI_1900-3210 ok 256 240 176 1 mri12717.dcm
47 t1_mp2rage_sag_p3_iso_TI_1900-3210 ok 256 240 176 1 mri12716.dcm
48 t1_mp2rage_sag_p3_iso_TI_1900-3210 ok 256 240 176 1 mri12731.dcm
49 t1_mp2rage_sag_p3_iso_TI_1900-3210 ok 256 240 176 1 mri12737.dcm
50 BIAS_BC ok 128 128 88 1 mri13750.dcm
51 BIAS_32ch ok 128 128 88 1 mri13902.dcm
52 BIAS_32ch ok 128 128 88 1 mri13840.dcm
53 T1w_MPR_ABCD_800um ok 320 300 208 1 mri14015.dcm
54 tfl_DBS ok 320 260 160 1 mri14379.dcm
55 t2_tse_ax-2mm ok 512 512 27 1 mri14395.dcm
56 T2w_SPC_HCP_700um ok 320 320 256 1 mri14409.dcm
57 T2w_SPC_HCP_700um ok 320 320 256 1 mri14468.dcm
58 t2_tse_ax-2mm ok 512 512 27 1 mri14934.dcm

我们可以在其中看T1加权图像对应的是哪个dcm
识别方法是找维度为256 x 256 x 176, 名字带MPRAGE, MEMPRAGE, 或 SPGR的文件

似乎名字带T1并不满足要求,要找T1加权的图像(T1 weight)找到的文件需要T1w开头
也就是t1_mp2rage_sag_p3_iso_TI_1900-3210不满足要求,
T1w_MPR_vNav_4e满足要求(T1w_MPR_ABCD_800um可能也不行因为大小不是256 x 256 x 176)
“vNav”表示导航器用于运动校正,“4e”表示收集了 4 个回波

Although T1w_MPR_vNav_4e is listed 6 times, this does not mean 6 of these scans were collected. Notice “err” for error after the first instance of T1w_MPR_vNav_4e as well as the incorrect dimensions. Notice that for some of the scans, there are 4 images in the series (indicated by the 4 following the numbers 256 256 176) and for some there is only 1 image in the series. The difference here is that dicom series with 4 images will provide the 4 echoes uncombined (as separate image files) while the other has combined the echoes by taking the RMS (root mean square) or “average” of the echoes.

机翻:尽管T1w_MPR_vNav_4e 被列出了 6 次,但这并不意味着收集了其中的 6 次扫描。 注意 T1w_MPR_vNav_4e 的第一个实例之后的错误“err”以及不正确的尺寸。 请注意,对于某些扫描,系列中有 4 张图像(由数字 256 256 176 后面的 4 表示),而对于某些扫描,系列中只有 1 张图像。 这里的区别在于具有 4 个图像的 dicom 系列将提供 4 个未组合的回波(作为单独的图像文件),而另一个通过取 RMS(均方根)或回波的“平均值”来组合回波。
当我们找到了T1图像后该怎么办?
因为我们获得一堆dcm文件后,最终目标是想要分析T1图像的,所以找到了T1是哪个之后,我们应该用recon-all来扫描它
先设置subject_dir,选择目标文件(如果在走教程,按照教程设置export SUBJECTS_DIR=$TUTORIAL_DATA/practice_with_data)
然后使用recon-all指令

recon-all \
  -all \
  -i  \<one slice in the anatomical dicom series> \
  -s  \<subject id that you make up> \

如果在走教程,可以直接用这一条指令

recon-all -all -i I50 -s  Subj001

recon-all是freesurfer的分割指令,直接将数据进行分割然后生成一系列包括标签,surface等在内的数据(存在多个文件夹中)
后续可以用freeview来查看这些分割好的数据
-s接的是新建的subject名称
-i接的是需要被分割的dicom
不过并不总是分割的dicom,有的时候是其他的文件,可以查看recon-all --help

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值