使用fsl进行MRI脑图像分析

医学影像 专栏收录该内容
1 篇文章 3 订阅

使用fsl进行MRI脑图像分析

MED620122 生物医学工程进展

1 安装教程

软件与系统版本

  • FLIRT version 6.0
  • Ubuntu 16.04
  • FSLeyes version 0.31.0+build0(这里有个坑是,fsl本身也自带fsleyes,但是版本较低,有些功能使用会有问题,需要单独下载fsleyes然后替换

首先,去官网下载fslinstaller.py 选择 “Download FSL”
然后参考官网的安装教程,进行安装
https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FslInstallation/Linux

sudo python2 fslinstaller.py

下载速度比较慢,耐心等待安装完成后,由于本人是用shell运行的,要配置环境变量,参考如下网页配置环境变量:
https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FslInstallation/ShellSetup

把如下的命令加到~/.bash_profile文件的后面,再重新打开shell即可

FSLDIR=/usr/local/fsl
. ${FSLDIR}/etc/fslconf/fsl.sh
PATH=${FSLDIR}/bin:${PATH}
export FSLDIR PATH

然后如果配置成功,输入flirt -version可以返回软件的版本,例如:FLIRT version 6.0

如果想测试安装是否成功,可以下载FSL评估和示例数据套件(FEEDS),课程学习网址:https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FEEDS

按照教程,下载解压完成后,输入/usr/bin/time ./RUN all 即可进行评估

https://users.fmrib.ox.ac.uk/~paulmc/fsleyes/userdoc/latest/

此处有个大坑是,fsleyes默认在fsl里面有安装,但是其版本是老版本,我尝试的时候,3Dview的功能就不能使用,此时需要到fsleyes的网站上单独安装

  • fsleyes的网站:https://users.fmrib.ox.ac.uk/~paulmc/fsleyes/userdoc/latest/install.html#
  • fsleyes安装教程(替换fsl内置版本):https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FSLeyes
  • fsleyes UserGuide:https://users.fmrib.ox.ac.uk/~paulmc/fsleyes/userdoc/latest/

2 fsl Course

首先,进入fsl Course的官网下载示例数据,学习图像分割,http://fsl.fmrib.ox.ac.uk/fslcourse/

示例学习主要是参考:http://fsl.fmrib.ox.ac.uk/fslcourse/lectures/practicals/seg_struc/index.html

主要是用到了以下两个部分的数据

wget -c http://fsl.fmrib.ox.ac.uk/fslcourse/downloads/structural.tar.gz
wget -c http://fsl.fmrib.ox.ac.uk/fslcourse/downloads/registration.tar.gz

2.1 bet去除颅骨

首先,进入~/fsl/seg_struc/fast目录,解压示例图像,然后再使用bet进行分割

gunzip structural.nii.gz
bet structural.nii structural_brain 
gunzip structural_brain.nii.gz
fsleyes structural.nii structural_brain.nii &

fsleyes用于可视化检测“去除颅骨的效果”

fsleyes可视化去除颅骨

2.2 fslroi选取感兴趣区域

也可以使用fslroi选取感兴趣的区域,再加载进fsleye

fslroi structural_brain structural_brain_roi 0 175 0 185 100 5

fsleyes可视化roi

2.3 FAST分割+偏置场校正

示例中还有输入Fast GUI命令,进行偏置场校正及分割,设置同官网,进行校正。
输出3类,输出选项全都勾上,然后iteration共10次

Use the GUI (Fast [or Fast_gui on a Mac]) and turn on the Estimated bias fieldbutton (which saves a copy of the bias field) and **Restored input button **(which corrects the original image with the calculated bias field). For both images also open the Advanced Options tab and change the Number of iterations for bias field removal to 10 to account for the strong bias fields in both cases.

此时并没有配准到MNI152的空间!

关于为何选择输出3类
Now choose the Number of classes to be segmented. Normally you will want 3 (Grey Matter, White Matter and CSF). However, if there is very poor grey/white contrast you may want to reduce this to 2; alternatively, if there are strong lesions showing up as a fourth class, you may want to increase this. Also, if you are segmenting T2-weighted images, you may need to select 4 classes so that dark non-brain matter is processed correctly (this is not a problem with T1-weighted as CSF and dark non-brain matter look similar).

PS:下图中选项中是选择6类,注意改成3类

Fast GUI偏置场校正

2.4 Partial Volume Segmentation 图像分割结果##

fsleyes structural_brain_roi_restore \
  structural_brain_roi_pve_0 -cm green -dr 0.5 1 \
  structural_brain_roi_pve_1 -cm blue-lightblue -dr 0.5 1 \
  structural_brain_roi_pve_2 -cm red-yellow -dr 0.5 1 &

下图就是图像分割结果,不同颜色分别代表GM, WM, CSF;灰质,白质,脑脊液。

  • 脑脊液(绿色pve0)
  • 灰质(蓝色pve1)
  • 白质(红黄pve2)

Partial Volume Segmentation

各种组织分割的结果如下:

  • *pve_*文件表示每类的概率,没有进行二值化
  • *seg_*文件表示每类分割结果,进行过二值化
  • bias文件为偏置场。

2.5 fslstats 统计##

第一个数字表示整个图像上GM(pve1是灰质)的平均体素,就是个百分比,第二个是整张图体素数目,第三个数字是图像的总体积(单位:立方毫米),忽略了所有的零体素(就是脑袋外的体素不算在内),将第一和第三个数字相乘可以得到GM的总体积。

fslstats

2.6 FIRST 皮层下结构分割及统计分析##

首先,进入~/fsl/seg_struc/first目录

run_first_all -i con0047_brain -b -s L_Hipp,L_Amyg \
  -o con0047 -a con0047_brain_to_std_sub.mat

-a指定了仿射配准的矩阵,这个步骤也可以自动完成
-s指定要分割的部分,此处是L_Hipp,L_Amyg

将图像con0047_brain_to_std_sub.nii.gz与“1mm标准空间模板图像”一起加载到FSLeyes中。查看皮层下结构的对齐方式,两者都是MNI152 space,所以非常接近。

与模板的比较

后面对于分割不满意,还可以Boundary corrected segmentation output,将边界重新进行调整。

Vertex Analysis

照样是跟着教程来,换了一个文件夹,在fsl/seg_struc/first/shapeAnalysis下面运行的。

  1. 首先,使用concat_bvars把顶点信息文件bvars整合成一个,注意此时整合的顺序和后序design matrix的要保持一致
  2. 接着,打开Glm,按照教程上的进行配置:
  3. Create a design matrix (Don’t worry if you don’t fully understand this part, we will cover this in more detail later in the course).The subject order should match the order in which the .bvars were combined in the concat_bvars call. The design matrix is most easily created using FSL’s Glm tool (a single column file). To do this, start the Glm GUI (Glm_gui on mac). First, choose the Higher-level/non-timeseries design option from the top pull down menu in the small window. Next, set the # inputs option to be 8 (the number of subjects we have in this example).
  4. In the bigger window (of the Glm GUI) set the values of the EV (the numbers in the second column) to be -1 for the first five entries (our five controls) and +1 for the next three entries (our three patients). This will allow us probe the difference between groups. Leave the ‘group’ column as all ones. Once you’ve done this, go to the Contrasts and F-tests tab. Rename the t-contrast (C1) to ‘group difference’, but leave the value set for EV1 as 1. We also need to add an F-test. Change the number in the F-tests box to 1, and then highlight the button on the right hand side (under F1) to select an F-test that operates on the single t-contrast.This F-test will be the main contrast of interest for our vertex analysis as it allows us to test for differences in either direction.
  5. When this is all set up correctly, save everything using the Save button in the smaller Glm window. Choose the current directory and use the name design_con1_dis2 (as we will assume this is the name used below, although for your own studies you can use any name of your choice). Now exit the Glm GUI.
  6. 然后,使用randomise进行统计检验
  7. 最后,用fsleyes可视化。

全部命令如下:

concat_bvars all.bvars *L_Hipp*.bvars
# 我的理解是,该步骤把不同subject的bvars整合出来的文件,使用--useReconMNI参数,重构到MNI空间。Reconstructs the meshes in MNI space(native space of the model).
first_utils --usebvars --vertexAnalysis -i all.bvars -o diff_con1_dis2_L_Hipp_mni -d design_con1_dis2.mat --useReconMNI
# 在重构好的空间里,进行统计检验
randomise -i diff_con1_dis2_L_Hipp_mni.nii.gz \
  -m diff_con1_dis2_L_Hipp_mni_mask.nii.gz \
  -o con1_dis2_L_Hipp_rand -d design_con1_dis2.mat \
  -t design_con1_dis2.con -f design_con1_dis2.fts \
  --fonly -D -F 3
# 可视化有差异的地方(都在MNI152空间)
fsleyes -std1mm con1_dis2_L_Hipp_rand_clustere_corrp_fstat1 -cm red-yellow -dr 0.95 1 &

最后可视化,橘黄色部分应该就是存在差异的地方:

可视化统计结果

当然,UserGuide里面也有相似的内容,也跑了一下,比较坑的是,UserGuide内容较老,里面有张图是用FSLView可视化的,现在该工具已经弃用,另一张图按照示例代码(见下方),对应着改了下文件,也没有做出来有不同颜色和箭头(UserGuide说箭头要另做)的样子。做出来的图如下:

UserGuide链接:
https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FIRST/UserGuide

# 此处的不同之处在于,是在原来图像的空间进行重构
# --useReconNative : Reconstructs the meshes in the native space of the image. For vertex-wise stats need to also use --useRigidAlign.
# --useRigidAlign : Uses a 6 Degrees Of Freedom transformation to remove pose from the meshes (see --useScale if you wish to remove size as well). All meshes are aligned to the mean shape from the shape Model. Can be used with either ReconNative or ReconMNI.
first_utils --vertexAnalysis --surfaceout --usebvars -i con_to_dis_L_Hipp.bvars -d con1_dis2.mat -o shape_analysis/con1_dis2_L_Hipp --useReconNative --useRigidAlign -v >& shape_analysis/con1_dis2_L_Hipp_output.txt

# 生成一个有pvals的文件,与之前的vtk文件内容一致
surface_fdr con1_dis2_L_Hipp1.vtk

统计结果

3 Homework data analysis

3.1 bet去除颅骨

使用类似如下命令去除颅骨,然后放入fsleyes进行可视化

bet CC0007_philips_15_62_M.nii CC0007_philips_15_62_M_brain
# fsl可视化
fsleyes *_brain.nii.gz &

作业数据bet去除颅骨

3.2 FAST分割+偏置场校正

使用如下命令进行FAST分割和偏置场校正,具体说明见上面,也是使用Fast GUI设置的

此时的偏置场校正并没有配准到MNI152的空间!

/usr/local/fsl/bin/fast -t 1 -n 3 -H 0.1 -I 10 -l 20.0 -g -B -b -o /home/wang/BME_Homework/CC0003_philips_15_63_F_brain /home/wang/BME_Homework/CC0003_philips_15_63_F_brain
/usr/local/fsl/bin/fast -t 1 -n 3 -H 0.1 -I 10 -l 20.0 -g -B -b -o /home/wang/BME_Homework/CC0004_philips_15_67_M_brain /home/wang/BME_Homework/CC0004_philips_15_67_M_brain
/usr/local/fsl/bin/fast -t 1 -n 3 -H 0.1 -I 10 -l 20.0 -g -B -b -o /home/wang/BME_Homework/CC0005_philips_15_62_M_brain /home/wang/BME_Homework/CC0005_philips_15_62_M_brain
/usr/local/fsl/bin/fast -t 1 -n 3 -H 0.1 -I 10 -l 20.0 -g -B -b -o /home/wang/BME_Homework/CC0006_philips_15_63_F_brain /home/wang/BME_Homework/CC0006_philips_15_63_F_brain
/usr/local/fsl/bin/fast -t 1 -n 3 -H 0.1 -I 10 -l 20.0 -g -B -b -o /home/wang/BME_Homework/CC0007_philips_15_62_M_brain /home/wang/BME_Homework/CC0007_philips_15_62_M_brain
/usr/local/fsl/bin/fast -t 1 -n 3 -H 0.1 -I 10 -l 20.0 -g -B -b -o /home/wang/BME_Homework/CC0008_philips_15_60_F_brain /home/wang/BME_Homework/CC0008_philips_15_60_F_brain

3.3 Partial Volume Segmentation 图像分割结果##

fsleyes CC0003_philips_15_63_F_brain \
  CC0003_philips_15_63_F_brain_pve_0 -cm green -dr 0.5 1 \
  CC0003_philips_15_63_F_brain_pve_1 -cm blue-lightblue -dr 0.5 1 \
  CC0003_philips_15_63_F_brain_pve_2 -cm red-yellow -dr 0.5 1 &
fsleyes CC0005_philips_15_62_M_brain \
  CC0005_philips_15_62_M_brain_pve_0 -cm green -dr 0.5 1 \
  CC0005_philips_15_62_M_brain_pve_1 -cm blue-lightblue -dr 0.5 1 \
  CC0005_philips_15_62_M_brain_pve_2 -cm red-yellow -dr 0.5 1 &

作业数据图像分割结果

  • 脑脊液(绿色pve0)
  • 灰质(蓝色pve1)
  • 白质(红黄pve2)

3.3 fslstats 统计##

使用xargs命令批量拿出来脑脊液,灰质和白质的体积。(-I {} 大括号指定替换的符号)

ls *_pve_*|xargs -I {} $FSLDIR/bin/fslstats {} -M -V
  • 脑脊液(pve0)
  • 灰质(pve1)
  • 白质(pve2)

统计汇总如下:

与使用matlab toolkit中CAT做出来的体积略有不同,差别最大的是CC0007,CAT做出来CC0007的灰质比白质略小,这里CC0007的灰质比白质略大

病人编号组织类别整张图体素数目图像的总体积(立方毫米)百分比对应结构的体素数目对应结构的体积(立方厘米)
CC0003脑脊液498338393750.46880.699085348380.6207275.2650464
CC0003灰质978755773341.1250.718218702959.4586555.4275161
CC0003白质7310295776060.789414577084.527455.9702629
CC0004脑脊液664398524961.81250.714634474801.4003375.1555599
CC0004灰质1209274955485.56250.720517871302.4747688.443591
CC0004白质994846786059.250.815883811677.939641.3323791
CC0005脑脊液600755474675.21880.70273422168.5612333.5685165
CC0005灰质12010459489830.730482877341.7537693.2149998
CC0005白质932851737074.56250.79763744069.9431587.9127833
CC0006脑脊液490649387674.81250.689181338145.9685267.178115
CC0006灰质1082499855311.250.740182801246.2748633.0859916
CC0006白质845774668268.50.807705683135.8887539.7638088
CC0007脑脊液638762504700.1250.720264460077.2732363.5173308
CC0007灰质1183335934979.31250.729251862948.2321681.8345986
CC0007白质1025489810261.81250.831084852267.5001673.3956282
CC0008脑脊液467768369597.40630.685212320520.2468253.2525779
CC0008灰质1026966811436.31250.741014760996.1835601.2856677
CC0008白质797140629843.93750.805895642411.1403507.58808

3.4 FIRST 皮层下结构分割及统计分析##

  • 此处设置分割左右尾状核
  • 此处没有设定仿射变换矩阵(Course教程中有指定变换矩阵mat文件,是因为他配准过了,要节省时间)

结果文件中_to_std_sub.nii.gz才是配准到了MNI152空间

run_first_all -i CC0003_philips_15_63_F_brain -b -s L_Caud,R_Caud -o CC0003
run_first_all -i CC0004_philips_15_67_M_brain -b -s L_Caud,R_Caud -o CC0004
run_first_all -i CC0005_philips_15_62_M_brain -b -s L_Caud,R_Caud -o CC0005
run_first_all -i CC0006_philips_15_63_F_brain -b -s L_Caud,R_Caud -o CC0006
run_first_all -i CC0007_philips_15_62_M_brain -b -s L_Caud,R_Caud -o CC0007
run_first_all -i CC0008_philips_15_60_F_brain -b -s L_Caud,R_Caud -o CC0008
  • -b specifies that the input image is brain extracted - important when calculating the registration.
  • -s allows a restricted set of structures (one or more) to be selected. For more than one structure the list must be comma separated with no spaces. The list of possible structures is: L_Accu L_Amyg L_Caud L_Hipp L_Pall L_Puta L_Thal R_Accu R_Amyg R_Caud R_Hipp R_Pall R_Puta R_Thal BrStem. 这个参数不指定的话,会把所有结构都分割出来,然后firstseg和origsegs文件里面就是有很多的结构,并且用不同的数值进行了标记

这一步骤,生成了all_fast_firstseg.nii.gz和all_fast_origsegs.nii.gz两个文件,其中firstseg是校正过后的文件,origseg是校正前的文件。
一般都是使用firstseg是校正过后的文件,校正前的文件分了组织的“边界”和“内部”像素,“边界”的像素=“内部”像素的值+100。

  • The corrected image (*_firstseg) is normally the one that you would use to define an ROI or mask for a particular subcortical structure.
  • For more details on the uncorrected image (*_origsegs) – see the optional practical at the end.

此处,由于我只指定了尾状核,所以使用如下命令,可视化不同样本的尾状核,下图是三个方向看的结构

Make sure that you look at the axial, coronal and sagittal slices.

first_roi_slicesdir *nii *all_fast_firstseg.nii.gz

后续还可以自己再进行边界校正**“Boundary Correction”**,具体使用方法为:first_boundary_corr -s segmented_image -i intensity_image -b method -o output_name,此处我没有进行校正。

参考文档:https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FIRST/UserGuide

作业数据图像分割结果

3.5 Vertex Analysis

这一部分的目的是:localised change in shape and/or size

For vertex analysis, we will be using the .bvars files as they contain the information about the sub-voxel mesh coordinates.

Combine all the mode parameters (.bvars file) into a single file. Each structure (model) that is fit with FIRST will generate a separate .bvars file. For a given structure (e.g. Caud尾状核) combine all the relevant .bvars files using the concat_bvars script.

Note that the order here is very important, as it must correspond to the order specified in the design matrix to be used later for statistical testing. For this example, combine the .bvars files (all of the left Caud 和 right Caud 分别左右尾状核) using the command:

concat_bvars命令把bvars文件合并,此处的顺序会影响后面design的设计,所以事先指定好,然后输入Glm创建design分组信息矩阵,具体如何创建分组信息矩阵,可以参考UserGuide:https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FEAT/UserGuide

concat_bvars all.L_Caud.bvars CC0003-L_Caud_first.bvars CC0006-L_Caud_first.bvars CC0008-L_Caud_first.bvars CC0004-L_Caud_first.bvars CC0005-L_Caud_first.bvars CC0007-L_Caud_first.bvars
concat_bvars all.R_Caud.bvars CC0003-R_Caud_first.bvars CC0006-R_Caud_first.bvars CC0008-R_Caud_first.bvars CC0004-R_Caud_first.bvars CC0005-R_Caud_first.bvars CC0007-R_Caud_first.bvars

接着,使用first_utils,选定矩阵,进行Vertex Analysis,然后使用randomise命令进行多重比较(with multiple comparison correction),找到有显著差异的部分,可视化可以直接用fsleyes中的3Dview功能进行,也可以使用first3Dview

具体可以参考Course:
http://fsl.fmrib.ox.ac.uk/fslcourse/lectures/practicals/seg_struc/index.html#first

# 我的理解是,该步骤把不同subject的bvars整合出来的文件,使用--useReconMNI参数,重构到MNI空间。Reconstructs the meshes in MNI space(native space of the model).
first_utils --usebvars --vertexAnalysis -i all.L_Caud.bvars -o design_F1_M2_L_Caud_mni -d design_F1_M2.mat --useReconMNI
# 在重构好的空间里,进行统计检验
randomise -i design_F1_M2_L_Caud_mni.nii.gz -m design_F1_M2_L_Caud_mni_mask.nii.gz -o F1_M2_L_Caud_rand -d design_F1_M2.mat -t design_F1_M2.con -f design_F1_M2.fts \
  --fonly -D -F 3
# 可视化有差异的地方(都在MNI152空间)
fsleyes -std1mm F1_M2_L_Caud_rand_clustere_corrp_fstat1 -cm red-yellow -dr 0.95 1 &

# 同样的,对于右尾状核也进行一样的操作,也没有看出来有差异
first_utils --usebvars --vertexAnalysis -i all.L_Caud.bvars -o design_F1_M2_L_Caud_mni -d design_F1_M2.mat --useReconMNI
randomise -i design_F1_M2_L_Caud_mni.nii.gz -m design_F1_M2_L_Caud_mni_mask.nii.gz -o F1_M2_L_Caud_rand -d design_F1_M2.mat -t design_F1_M2.con -f design_F1_M2.fts \
  --fonly -D -F 3
fsleyes -std1mm F1_M2_L_Caud_rand_clustere_corrp_fstat1 -cm red-yellow -dr 0.95 1 &

无橘黄色差异的地方

重点

-dr LO HI, --displayRange LO HI 此处设置的范围是[0.95,1],图上无橘黄色,表示顶点分析无显著性的差异

如果将显示的范围调宽,则可以看出少部分不显著的差异地方,以下两图为同一位置:

差异部位

原图位置

使用旧版方法检验(UserGuide不推荐),尝试了“使用useRigidAlign”和“不使用useRigidAlign”,surface_fdr也都没有检验出差异,即fdrmaskFthreshFvalspthreshpvals都为空,
此处“数字医学研究中心”的学生也只是试了UserGuide里的方法,没有尝试fsl course里的东西,同样也只是得出空文件,大概就是没法检验出有统计性的结果。

具体代码如下:

first_utils --vertexAnalysis --surfaceout --usebvars -i all.L_Caud.bvars -d design_F1_M2.mat -o shape_analysis/F1_M2_L_Caud_rigid --useReconNative --useRigidAlign -v >& shape_analysis/F1_M2_L_Caud_rigid_output.txt
surface_fdr F1_M2_L_Caud_rigid1.vtk

first_utils --vertexAnalysis --surfaceout --usebvars -i all.L_Caud.bvars -d design_F1_M2.mat -o shape_analysis/F1_M2_L_Caud_norigid --useReconNative -v >& shape_analysis/F1_M2_L_Caud_norigid_output.txt
surface_fdr F1_M2_L_Caud_norigid1.vtk

旧版方法检验,vtk文件可视化

3.6 Volumetric Analysis

对尾状核进行体积分析,同样使用xargs命令批量得到尾状核的体积。(-I {} 大括号指定替换的符号)

# Left-Caudate
ls *_fast_firstseg.nii.gz |xargs -I {} $FSLDIR/bin/fslstats {} -l 10.5 -u 11.5 -V
# Right-Caudate
ls *_fast_firstseg.nii.gz |xargs -I {} $FSLDIR/bin/fslstats {} -l 49.5 -u 50.5 -V

整理如下:
与使用matlab toolkit中CAT做出来的体积略有不同

病人编号组织类别像素数目体积(立方毫米)体积(立方厘米)
CC0003左尾状核34632736.2109452.736210945
CC0003右尾状核34942760.7048922.760704892
CC0004左尾状核45863623.5433753.623543375
CC0004右尾状核43743456.0354823.456035482
CC0005左尾状核44613524.7748283.524774828
CC0005右尾状核46293657.5168523.657516852
CC0006左尾状核40293183.4199783.183419978
CC0006右尾状核39803144.7037763.144703776
CC0007左尾状核46123644.0442243.644044224
CC0007右尾状核46023636.1430013.636143001
CC0008左尾状核42143329.6064933.329606493
CC0008右尾状核46993712.819393.71281939

4 总结

4.1 信息汇总

使用R语言和ggplot统计各组织的体积(单位:立方厘米),统计代码如下:

library(ggplot2)
setwd("C:/Users/83918/Desktop/BME_Homework")
Data <- read.table("C:/Users/83918/Desktop/BME_Homework/Volume.txt", head=T)
Data$TissueType <- factor(Data$TissueType, levels = c("CSF","GM","WM","Left_Caudate","Right_Caudate"))

Data[which(Data$PatientID=="CC0003"),"gender"] <- "Female"
Data[which(Data$PatientID=="CC0004"),"gender"] <- "Male"
Data[which(Data$PatientID=="CC0005"),"gender"] <- "Male"
Data[which(Data$PatientID=="CC0006"),"gender"] <- "Female"
Data[which(Data$PatientID=="CC0007"),"gender"] <- "Male"
Data[which(Data$PatientID=="CC0008"),"gender"] <- "Female"

ggplot(data=Data, aes(x=gender,y=Volume))+
  geom_boxplot(aes(fill=TissueType))+
  facet_wrap(~ TissueType,nrow = 1, ncol = 5, scales="free")
ggsave("volume.pdf",width = 8,height = 5)

汇总的表格如下:

PatientIDTissueTypeVolume
CC0003CSF275.2650464
CC0003GM555.4275161
CC0003WM455.9702629
CC0004CSF375.1555599
CC0004GM688.443591
CC0004WM641.3323791
CC0005CSF333.5685165
CC0005GM693.2149998
CC0005WM587.9127833
CC0006CSF267.178115
CC0006GM633.0859916
CC0006WM539.7638088
CC0007CSF363.5173308
CC0007GM681.8345986
CC0007WM673.3956282
CC0008CSF253.2525779
CC0008GM601.2856677
CC0008WM507.58808
CC0003Left_Caudate2.736210945
CC0003Right_Caudate2.760704892
CC0004Left_Caudate3.623543375
CC0004Right_Caudate3.456035482
CC0005Left_Caudate3.524774828
CC0005Right_Caudate3.657516852
CC0006Left_Caudate3.183419978
CC0006Right_Caudate3.144703776
CC0007Left_Caudate3.644044224
CC0007Right_Caudate3.636143001
CC0008Left_Caudate3.329606493
CC0008Right_Caudate3.71281939

绘制出的统计图如下:

各组织体积比较

4.1 结论

作业数据中,三个男性的的白质,灰质,脑脊液,左右尾状核的体积都比三个女性要大得多,但是其尾状核的形状没有显著差异。

5 相关参考资料

  • fsl UserGuide: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki
  • fsl课程ppt及练习数据: http://fsl.fmrib.ox.ac.uk/fslcourse/
  • 注意看fsl课程practice相应html网页的时候,对照着网站上的ppt

官网说明的Labels如下:

  • 10 Left-Thalamus-Proper 40
  • 11 Left-Caudate 30
  • 12 Left-Putamen 40
  • 13 Left-Pallidum 40
  • 16 Brain-Stem /4th Ventricle 40
  • 17 Left-Hippocampus 30
  • 18 Left-Amygdala 50
  • 26 Left-Accumbens-area 50
  • 49 Right-Thalamus-Proper 40
  • 50 Right-Caudate 30
  • 51 Right-Putamen 40
  • 52 Right-Pallidum 40
  • 53 Right-Hippocampus 30
  • 54 Right-Amygdala 50
  • 58 Right-Accumbens-area 50
©️2021 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值