5ttgen fsl ERROR: only 0 of 10 structures were segmented successfully

error

#1

Hi all,

I am trying to follow the ISMRM tutorial to create a tissue-segmented image using the Human Connectome data. However, the first step 5ttgen fsl stuck at run_first_all command and gave me an error message below:

yukai@yukai-Oryx-Pro:~/HCP/20180121_MRtrix3/test_5ttgen$ 5ttgen fsl T1w_acpc_dc_restore_brain.nii.gz 5TT.mif -premasked
5ttgen: 
5ttgen: Note that this script makes use of commands / algorithms that have relevant articles for citation; INCLUDING FROM EXTERNAL SOFTWARE PACKAGES. Please consult the help page (-help option) for more information.
5ttgen: 
5ttgen: Generated temporary directory: /home/yukai/HCP/20180121_MRtrix3/test_5ttgen/5ttgen-tmp-FE7LGB/
Command:  mrconvert /home/yukai/HCP/20180121_MRtrix3/test_5ttgen/T1w_acpc_dc_restore_brain.nii.gz /home/yukai/HCP/20180121_MRtrix3/test_5ttgen/5ttgen-tmp-FE7LGB/input.mif
5ttgen: Changing to temporary directory (/home/yukai/HCP/20180121_MRtrix3/test_5ttgen/5ttgen-tmp-FE7LGB/)
Command:  mrconvert input.mif T1.nii -stride -1,+2,+3
Command:  fast T1.nii
**Command:  run_first_all -m none -s L_Accu,R_Accu,L_Caud,R_Caud,L_Pall,R_Pall,L_Puta,R_Puta,L_Thal,R_Thal -i T1.nii -o first -b
**5ttgen: [ERROR] FSL FIRST has failed; only 0 of 10 structures were segmented successfully (check /home/yukai/HCP/20180121_MRtrix3/test_5ttgen/5ttgen-tmp-FE7LGB/first.logs)
5ttgen: Changing back to original directory (/home/yukai/HCP/20180121_MRtrix3/test_5ttgen)
5ttgen: Contents of temporary directory kept, location: /home/yukai/HCP/20180121_MRtrix3/test_5ttgen/5ttgen-tmp-FE7LGB/

As a result, no 5TT.mif file was generated. I checked the *first.logs and found the following files:

yukai@yukai-Oryx-Pro:~/HCP/20180121_MRtrix3/test_5ttgen/5ttgen-tmp-FE7LGB/first.logs$ ls
clean_up.e23523.1  first.e22529.5      first.o22529.1   first.o22529.7
clean_up.o23523.1  first.e22529.6      first.o22529.10  first.o22529.8
first.e22529.1     first.e22529.7      first.o22529.2   first.o22529.9
first.e22529.10    first.e22529.8      first.o22529.3   first_post.e23505.1
first.e22529.2     first.e22529.9      first.o22529.4   first_post.o23505.1
first.e22529.3     first_flirt.e22386  first.o22529.5
first.e22529.4     first_flirt.o22386  first.o22529.6

I’ve checked that the segmentation failure was not an issue of running out of RAM. I read through the posts of this topic on the forum but haven’t found a solution yet. I am wondering if anybody has a solution.

BTW, my operating system is Ubuntu 16.04 LTS. The FSL version is 5.0.9, and the Freesurfer version is freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.0-2beb96c.

Thanks,

Yukai Zou


#2

Hi Yukai,

You will need to check the contents of the files within that directory to determine what went wrong with the run_first_all script (they’re all text files, containing the standard output and standard error contents from each registration / segmentation / processing job).

Rob


#3

Hello Robert,

The standard output of the log.txt file is:

mrconvert /home/yukai/HCP/20180121_MRtrix3/test_5ttgen/T1w_acpc_dc_restore_brain.nii.gz /home/yukai/HCP/20180121_MRtrix3/test_5ttgen/5ttgen-tmp-FE7LGB/input.mif
mrconvert input.mif T1.nii -stride -1,+2,+3
fast T1.nii
run_first_all -m none -s L_Accu,R_Accu,L_Caud,R_Caud,L_Pall,R_Pall,L_Puta,R_Puta,L_Thal,R_Thal -i T1.nii -o first -b

There is no standard error contents in it. I continued checking the contents of the other files (first.com, first.com2, first.com3) and did not found standard error contents either.

first.com:

/usr/share/fsl/5.0/bin/run_first -i T1 -t T1_to_std_sub.mat -n 50 -o first-L_Accu_first -m /usr/share/fsl/5.0/data/first/models_336_bin/L_Accu_bin.bmv; /usr/share/fsl/5.0/bin/first_boundary_corr -s first-L_Accu_first -o first-L_Accu_corr -i T1 -b none
/usr/share/fsl/5.0/bin/run_first -i T1 -t T1_to_std_sub.mat -n 50 -o first-R_Accu_first -m /usr/share/fsl/5.0/data/first/models_336_bin/R_Accu_bin.bmv; /usr/share/fsl/5.0/bin/first_boundary_corr -s first-R_Accu_first -o first-R_Accu_corr -i T1 -b none
/usr/share/fsl/5.0/bin/run_first -i T1 -t T1_to_std_sub.mat -n 30 -o first-L_Caud_first -m /usr/share/fsl/5.0/data/first/models_336_bin/intref_thal/L_Caud.bmv -intref /usr/share/fsl/5.0/data/first/models_336_bin/05mm/L_Thal_05mm.bmv; /usr/share/fsl/5.0/bin/first_boundary_corr -s first-L_Caud_first -o first-L_Caud_corr -i T1 -b none
/usr/share/fsl/5.0/bin/run_first -i T1 -t T1_to_std_sub.mat -n 30 -o first-R_Caud_first -m /usr/share/fsl/5.0/data/first/models_336_bin/intref_thal/R_Caud.bmv -intref /usr/share/fsl/5.0/data/first/models_336_bin/05mm/R_Thal_05mm.bmv; /usr/share/fsl/5.0/bin/first_boundary_corr -s first-R_Caud_first -o first-R_Caud_corr -i T1 -b none
/usr/share/fsl/5.0/bin/run_first -i T1 -t T1_to_std_sub.mat -n 40 -o first-L_Pall_first -m /usr/share/fsl/5.0/data/first/models_336_bin/05mm/L_Pall_05mm.bmv; /usr/share/fsl/5.0/bin/first_boundary_corr -s first-L_Pall_first -o first-L_Pall_corr -i T1 -b none
/usr/share/fsl/5.0/bin/run_first -i T1 -t T1_to_std_sub.mat -n 40 -o first-R_Pall_first -m /usr/share/fsl/5.0/data/first/models_336_bin/05mm/R_Pall_05mm.bmv; /usr/share/fsl/5.0/bin/first_boundary_corr -s first-R_Pall_first -o first-R_Pall_corr -i T1 -b none
/usr/share/fsl/5.0/bin/run_first -i T1 -t T1_to_std_sub.mat -n 40 -o first-L_Puta_first -m /usr/share/fsl/5.0/data/first/models_336_bin/05mm/L_Puta_05mm.bmv; /usr/share/fsl/5.0/bin/first_boundary_corr -s first-L_Puta_first -o first-L_Puta_corr -i T1 -b none
/usr/share/fsl/5.0/bin/run_first -i T1 -t T1_to_std_sub.mat -n 40 -o first-R_Puta_first -m /usr/share/fsl/5.0/data/first/models_336_bin/05mm/R_Puta_05mm.bmv; /usr/share/fsl/5.0/bin/first_boundary_corr -s first-R_Puta_first -o first-R_Puta_corr -i T1 -b none
/usr/share/fsl/5.0/bin/run_first -i T1 -t T1_to_std_sub.mat -n 40 -o first-L_Thal_first -m /usr/share/fsl/5.0/data/first/models_336_bin/05mm/L_Thal_05mm.bmv; /usr/share/fsl/5.0/bin/first_boundary_corr -s first-L_Thal_first -o first-L_Thal_corr -i T1 -b none
/usr/share/fsl/5.0/bin/run_first -i T1 -t T1_to_std_sub.mat -n 40 -o first-R_Thal_first -m /usr/share/fsl/5.0/data/first/models_336_bin/05mm/R_Thal_05mm.bmv; /usr/share/fsl/5.0/bin/first_boundary_corr -s first-R_Thal_first -o first-R_Thal_corr -i T1 -b none

first.com2:

/usr/share/fsl/5.0/bin/fslmerge -t first_all_none_firstseg  first-L_Accu_corr first-R_Accu_corr first-L_Caud_corr first-R_Caud_corr first-L_Pall_corr first-R_Pall_corr first-L_Puta_corr first-R_Puta_corr first-L_Thal_corr first-R_Thal_corr ; /usr/share/fsl/5.0/bin/fslmerge -t first_all_none_origsegs  first-L_Accu_first first-R_Accu_first first-L_Caud_first first-R_Caud_first first-L_Pall_first first-R_Pall_first first-L_Puta_first first-R_Puta_first first-L_Thal_first first-R_Thal_first ; /usr/share/fsl/5.0/bin/first_mult_bcorr -i T1 -u first_all_none_origsegs -c first_all_none_firstseg -o first_all_none_firstseg

first.com3:

/usr/share/fsl/5.0/bin/imrm first-*_first* first-*_corr*

Thank you for your assistance.

Yukai


#4

Hi Yukai,

The “first.com*” files contain the FSL commands that are executed via the SGE jobs. These don’t provide any information regarding the outcomes of those commands.

The standard error and standard output contents of each job are written to files “first*.logs/first.e*.*” and “first.logs/first*.o*.*” respectively. If each FSL job encounters some sort of error (most likely the “first_flirt.*” job, since a failure at the FIRST step will result in failure of all subsequent jobs that depend on it), this is where that information will appear. Therefore these are the files for which the contents are important.

File “log.txt” is only a log of the commands that 5ttgen fsl executes. If an error occurs within one of those jobs, log.txt will not contain any information on this.

You can also try printing the contents of the script temporary directory, i.e.:

$ ls ~/HCP/20180121_MRtrix3/test_5ttgen/5ttgen-tmp-FE7LGB/

; however this will almost certainly only demonstrate the absence of the segmentation files that FIRST is supposed to produce, which is precisely what is reflected in the error message that is being provided to you.

Hopefully the contents of files “first.logs/first*.e*.*” and “first.logs/first*.o*.*” give us more information.

Rob


#5

Thank you for your clarification, Rob.

I did found errors in “first_flirt.*”. The outputs are:
$ more first_flirt.*

::::::::::::::
first_flirt.e22386
::::::::::::::
Image Exception : #22 :: ERROR: Could not open image /usr/share/fsl/5.0/data/sta
ndard/MNI152lin_T1_1mm_subbr_mask
terminate called after throwing an instance of 'RBD_COMMON::BaseException'
Aborted (core dumped)
Could not open matrix file T1_to_std_sub_tmp_stage2.mat
Cannot read concat-matrix
Could not open matrix file T1_to_std_sub.mat
terminate called after throwing an instance of 'NEWMAT::IncompatibleDimensionsEx
ception'
Aborted (core dumped)
::::::::::::::
first_flirt.o22386
::::::::::::::
initial registration 0
Stage 2: use subcortical mask

I then checked the outputs from first.logs/first*.o*.*:
$ more first.logs/first*.o*.*

::::::::::::::
first.o22529.1
::::::::::::::
linear transformation matrix file not found
Error: cannot find image first-L_Accu_first
::::::::::::::
first.o22529.10
::::::::::::::
linear transformation matrix file not found
Error: cannot find image first-R_Thal_first
::::::::::::::
first.o22529.2
::::::::::::::
linear transformation matrix file not found
Error: cannot find image first-R_Accu_first
::::::::::::::
first.o22529.3
::::::::::::::
linear transformation matrix file not found
Error: cannot find image first-L_Caud_first
::::::::::::::
first.o22529.4
::::::::::::::
linear transformation matrix file not found
Error: cannot find image first-R_Caud_first
::::::::::::::
first.o22529.5
::::::::::::::
linear transformation matrix file not found
Error: cannot find image first-L_Pall_first
::::::::::::::
first.o22529.6
::::::::::::::
linear transformation matrix file not found
Error: cannot find image first-R_Pall_first
::::::::::::::
first.o22529.7
::::::::::::::
linear transformation matrix file not found
Error: cannot find image first-L_Puta_first
::::::::::::::
first.o22529.8
::::::::::::::
linear transformation matrix file not found
Error: cannot find image first-R_Puta_first
::::::::::::::
first.o22529.9
::::::::::::::
linear transformation matrix file not found
Error: cannot find image first-L_Thal_first

I found no content in first.logs/first*.e*.*.

Finally, I checked the contents of the script temporary directory:
$ ls ~/HCP/20180121_MRtrix3/test_5ttgen/5ttgen-tmp-FE7LGB/

command.txt  first.com2  input.mif            T1.nii           T1_pve_2.nii.gz
cwd.txt      first.com3  log.txt              T1_pve_0.nii.gz  T1_pveseg.nii.gz
first.com    first.logs  T1_mixeltype.nii.gz  T1_pve_1.nii.gz  T1_seg.nii.gz

Thank you for your assistance.

Yukai


#6

OK, straight out of the gate, this catches my eye:

Image Exception : #22 :: ERROR: Could not open image /usr/share/fsl/5.0/data/sta ndard/MNI152lin_T1_1mm_subbr_mask

It’s unable to find a mask image that instructs flirt to prioritise the registration of sub-cortical structures to MNI space rather than using the entire brain. This suggests that you have not installed the requisite data that FIRST requires to operate. Whatever mechanism you have used to install FSL, you need to acquire the FIRST data using the same mechanism (it’s not installed as a core part of FSL because it adds another 1GB to the download).

E.g. You can see the relevant package on NeuroDebian here.


#7

Thanks for pointing that out, Rob!

Turned out that my FSL standard directory did not have that particular mask (and was missing a bunch of files, which is odd since I installed both fsl-complete and fsl-first-data via NeuroDebian). The problem was successfully resolved after updating the standard directory.

Yukai