5ttgen: [ERROR] FSL FIRST has failed; only 6 of 10 structures were segmented successfully

When i run 5ttgen command with -premasked it FSL First has failed error encountered with this command.
However, when I run without -premasked , it is executed without error, however, when I run the labelsgmfix command later, then same error encountered.

A.

5ttgen fsl T1_raw.mif 5tt_nocoreg.mif -premasked

B

5ttgen fsl T1_raw.mif 5tt_nocoreg.mif
labelconvert …/T1/013_S_6970_aparc+aseg.mgz $FREESURFER_HOME/FreeSurferColorLUT.txt /opt/mrtrix3/share/mrtrix3/labelconvert/fs_default.txt nodes.mif
labelsgmfix nodes.mif …/T1/013_S_6970_001.nii /opt/mrtrix3/share/mrtrix3/labelconvert/fs_default.txt nodes_sgmfix.mif -premasked

A.

5ttgen fsl T1_raw.mif 5tt_nocoreg.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 scratch directory: /home/nas/shahzad/ADF/ADNI/MRTrix_Preprocessing/13031/013_S_6970/DTI/5ttgen-tmp-MSOX8R/
Command: mrconvert /home/nas/shahzad/ADF/ADNI/MRTrix_Preprocessing/13031/013_S_6970/DTI/T1_raw.mif /home/nas/shahzad/ADF/ADNI/MRTrix_Preprocessing/13031/013_S_6970/DTI/5ttgen-tmp-MSOX8R/input.mif
5ttgen: Changing to scratch directory (/home/nas/shahzad/ADF/ADNI/MRTrix_Preprocessing/13031/013_S_6970/DTI/5ttgen-tmp-MSOX8R/)
Command: mrconvert input.mif T1.nii -strides -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 6 of 10 structures were segmented successfully (check /home/nas/shahzad/ADF/ADNI/MRTrix_Preprocessing/13031/013_S_6970/DTI/5ttgen-tmp-MSOX8R/first.logs)
5ttgen: Scratch directory retained; location: /home/nas/shahzad/ADF/ADNI/MRTrix_Preprocessing/13031/013_S_6970/DTI/5ttgen-tmp-MSOX8R/

B.

5ttgen fsl T1_raw.mif 5tt_nocoreg.mif

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 scratch directory: /home/nas/shahzad/ADF/ADNI/MRTrix_Preprocessing/13031/013_S_6970/DTI/5ttgen-tmp-MA951R/
Command: mrconvert /home/nas/shahzad/ADF/ADNI/MRTrix_Preprocessing/13031/013_S_6970/DTI/T1_raw.mif /home/nas/shahzad/ADF/ADNI/MRTrix_Preprocessing/13031/013_S_6970/DTI/5ttgen-tmp-MA951R/input.mif
5ttgen: Changing to scratch directory (/home/nas/shahzad/ADF/ADNI/MRTrix_Preprocessing/13031/013_S_6970/DTI/5ttgen-tmp-MA951R/)
Command: mrconvert input.mif T1.nii -strides -1,+2,+3
Command: maskfilter /opt/fsl/data/standard/MNI152_T1_1mm_brain_mask_dil.nii.gz dilate mni_mask.nii -npass 4
Command: standard_space_roi T1.nii T1_preBET.nii.gz -maskMASK mni_mask.nii -roiFOV
Command: bet T1_preBET.nii.gz T1_BET.nii.gz -f 0.15 -R
Command: fast T1_BET.nii.gz
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
5ttgen: [100%] Generating partial volume images for SGM structures
Command: mrmath [mesh2voxel_*.mif (10 items)] sum - | mrcalc - 1.0 -min all_sgms.mif
Command: mrthreshold T1_BET_pve_2.nii.gz - -abs 0.001 | maskfilter - connect - -connectivity | mrcalc 1 - 1 -gt -sub remove_unconnected_wm_mask.mif -datatype bit
Command: mrcalc T1_BET_pve_0.nii.gz remove_unconnected_wm_mask.mif -mult csf.mif
Command: mrcalc 1.0 csf.mif -sub all_sgms.mif -min sgm.mif
Command: mrcalc 1.0 csf.mif sgm.mif -add -sub T1_BET_pve_1.nii.gz T1_BET_pve_2.nii.gz -add -div multiplier.mif
Command: mrcalc multiplier.mif -finite multiplier.mif 0.0 -if multiplier_noNAN.mif
Command: mrcalc T1_BET_pve_1.nii.gz multiplier_noNAN.mif -mult remove_unconnected_wm_mask.mif -mult cgm.mif
Command: mrcalc T1_BET_pve_2.nii.gz multiplier_noNAN.mif -mult remove_unconnected_wm_mask.mif -mult wm.mif
Command: mrcalc 0 wm.mif -min path.mif
Command: mrcat cgm.mif sgm.mif wm.mif csf.mif path.mif - -axis 3 | mrconvert - combined_precrop.mif -strides +2,+3,+4,+1
Command: mrmath combined_precrop.mif sum - -axis 3 | mrthreshold - - -abs 0.5 | mrgrid combined_precrop.mif crop result.mif -mask -
Command: mrconvert result.mif /home/nas/shahzad/ADF/ADNI/MRTrix_Preprocessing/13031/013_S_6970/DTI/5tt_nocoreg.mif
Command: 5ttcheck result.mif
5ttgen: Changing back to original directory (/home/nas/shahzad/ADF/ADNI/MRTrix_Preprocessing/13031/013_S_6970/DTI)
5ttgen: Deleting scratch directory (/home/nas/shahzad/ADF/ADNI/MRTrix_Preprocessing/13031/013_S_6970/DTI/5ttgen-tmp-MA951R/)

labelconvert …/T1/013_S_6970_aparc+aseg.mgz $FREESURFER_HOME/FreeSurferColorLUT.txt /opt/mrtrix3/share/mrtrix3/labelconvert/fs_default.txt nodes.mif

labelconvert: Image “…/T1/013_S_6970_aparc+aseg.mgz” stored with signed integer type; need to check for negative values
labelconvert: [100%] uncompressing image “…/T1/013_S_6970_aparc+aseg.mgz”
labelconvert: [100%] Verifying parcellation image
labelconvert: [100%] uncompressing image “…/T1/013_S_6970_aparc+aseg.mgz”

labelsgmfix nodes.mif …/T1/013_S_6970_001.nii /opt/mrtrix3/share/mrtrix3/labelconvert/fs_default.txt nodes_sgmfix.mif -premasked

labelsgmfix:
labelsgmfix: 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.
labelsgmfix:
labelsgmfix: Generated scratch directory: /home/nas/shahzad/ADF/ADNI/MRTrix_Preprocessing/13031/013_S_6970/DTI/labelsgmfix-tmp-EL1190/
Command: mrconvert /home/nas/shahzad/ADF/ADNI/MRTrix_Preprocessing/13031/013_S_6970/DTI/nodes.mif /home/nas/shahzad/ADF/ADNI/MRTrix_Preprocessing/13031/013_S_6970/DTI/labelsgmfix-tmp-EL1190/parc.mif
Command: mrconvert /home/nas/shahzad/ADF/ADNI/MRTrix_Preprocessing/13031/013_S_6970/T1/013_S_6970_001.nii /home/nas/shahzad/ADF/ADNI/MRTrix_Preprocessing/13031/013_S_6970/DTI/labelsgmfix-tmp-EL1190/T1.nii -strides -1,+2,+3
labelsgmfix: Changing to scratch directory (/home/nas/shahzad/ADF/ADNI/MRTrix_Preprocessing/13031/013_S_6970/DTI/labelsgmfix-tmp-EL1190/)
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 -b -o first

labelsgmfix: [ERROR] FSL FIRST has failed; only 6 of 10 structures were segmented successfully (check /home/nas/shahzad/ADF/ADNI/MRTrix_Preprocessing/13031/013_S_6970/DTI/labelsgmfix-tmp-EL1190/first.logs)
labelsgmfix: Scratch directory retained; location: /home/nas/shahzad/ADF/ADNI/MRTrix_Preprocessing/13031/013_S_6970/DTI/labelsgmfix-tmp-EL1190/

Hi Shahzad,
This looks familiar…updating the FreeSurferSGM.txt file might solve the problem - see the following link on how to do this.

Hope this helps!

Arkiev

1 Like

Hi Dear @adsouza,
Thank you for your response.
I have a large number of subjects and many subjects processed successfully. However, this error occured for few subjects that I have.