I am trying to run ACT using the freesurfer algorithm but keep getting the following issue with 5TTGen. The freesurfer Lut file should be all integer values? I am confused about why this is occurring/how to troubleshoot. For reference, I am working with Human Connectome Data.
set subj= ( 100307 )
cd /data/bswift-1/dcallow/CONNECTOME/dwi
cd /data/bswift-1/dcallow/CONNECTOME/dwi/100307/T1w/
/data/bswift-0/software/MRtrix3Tissue/bin/5ttgen freesurfer -force T1w_acpc_dc_restore_1.25.nii.gz 5TT.mif
5ttgen:
5ttgen: *Note that this script makes use of commands / algorithms that have relevant articles for citation. Please consult the help page (-help option) for more information.*
5ttgen:
5ttgen: *Generated scratch directory: /a/ha-nfs-2-ib/export/data/bswift-1/dcallow/CONNECTOME/dwi/100307/T1w/5ttgen-tmp-DJ1JYF/*
*Command:* mrconvert /a/ha-nfs-2-ib/export/data/bswift-1/dcallow/CONNECTOME/dwi/100307/T1w/T1w_acpc_dc_restore_1.25.nii.gz /a/ha-nfs-2-ib/export/data/bswift-1/dcallow/CONNECTOME/dwi/100307/T1w/5ttgen-tmp-DJ1JYF/input.mif
5ttgen: *Changing to scratch directory (/a/ha-nfs-2-ib/export/data/bswift-1/dcallow/CONNECTOME/dwi/100307/T1w/5ttgen-tmp-DJ1JYF/)*
*Command:* labelconvert input.mif /data/bswift-0/software/freesurfer-dev/FreeSurferColorLUT.txt /a/ha-nfs-1-ib/export/data/bswift-0/software/MRtrix3Tissue/share/mrtrix3/_5ttgen/FreeSurfer2ACT.txt indices.mif
5ttgen: **[ERROR] labelconvert input.mif /data/bswift-0/software/freesurfer-dev/FreeSurferColorLUT.txt /a/ha-nfs-1-ib/export/data/bswift-0/software/MRtrix3Tissue/share/mrtrix3/_5ttgen/FreeSurfer2ACT.txt indices.mif** *(freesurfer.py:49)*
5ttgen: **[ERROR] Information from failed command:**
5ttgen:
labelconvert: Image "input.mif" stored with floating-point type; need to check for non-integer or negative values
]
labelconvert: [ERROR] Floating-point number detected in image "input.mif"; label images should contain integers only
5ttgen:
5ttgen: **[ERROR] For debugging, inspect contents of scratch directory: /a/ha-nfs-2-ib/export/data/bswift-1/dcallow/CONNECTOME/dwi/100307/T1w/5ttgen-tmp-DJ1JYF/**
5ttgen: *Scratch directory retained; location: /a/ha-nfs-2-ib/export/data/bswift-1/dcallow/CONNECTOME/dwi/100307/T1w/5ttgen-tmp-DJ1JYF/*
5tt2vis -force 5TT.mif vis.mif
5tt2vis: [WARNING] existing output files will be overwritten
5tt2vis: **[ERROR] failed to open key/value file "5TT.mif": No such file or directory**
5tt2vis: **[ERROR] error opening image "5TT.mif"**
labelconvert -force /data/bswift-1/dcallow/CONNECTOME/anat/freesurfer/100307/mri/aparc+aseg.mgz /data/bswift-1/dcallow/CONNECTOME/FreeSurferColorLUT.txt /data/bswift-1/dcallow/CONNECTOME/fs_default.txt nodes.mif
labelconvert: [WARNING] existing output files will be overwritten
labelconvert: Image "/data/bswift-1/dcallow/CONNECTOME/anat/freesurfer/100307/mri/aparc+aseg.mgz" stored with signed integer type; need to check for negative values
labelconvert: [100%] uncompressing image "/data/bswift-1/dcallow/CONNECTOME/anat/freesurfer/100307/mri/aparc+aseg.mgz"
labelconvert: [100%] Verifying parcellation image
labelconvert: [100%] uncompressing image "/data/bswift-1/dcallow/CONNECTOME/anat/freesurfer/100307/mri/aparc+aseg.mgz"
labelsgmfix -force nodes.mif T1w_acpc_dc_restore_1.25.nii.gz /data/bswift-1/dcallow/CONNECTOME/fs_default.txt nodes_fixSFM.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: [WARNING] Voxel size of input T1 image larger than expected for T1-weighted images ([1.25, 1.25, 1.25]); image will be resampled to 1mm isotropic in order to maximise chance of FSL FIRST script succeeding
labelsgmfix: *Generated scratch directory: /a/ha-nfs-2-ib/export/data/bswift-1/dcallow/CONNECTOME/dwi/100307/T1w/labelsgmfix-tmp-0YWHMW/*
*Command:* mrconvert /a/ha-nfs-2-ib/export/data/bswift-1/dcallow/CONNECTOME/dwi/100307/T1w/nodes.mif /a/ha-nfs-2-ib/export/data/bswift-1/dcallow/CONNECTOME/dwi/100307/T1w/labelsgmfix-tmp-0YWHMW/parc.mif
*Command:* mrgrid /a/ha-nfs-2-ib/export/data/bswift-1/dcallow/CONNECTOME/dwi/100307/T1w/T1w_acpc_dc_restore_1.25.nii.gz regrid - -voxel 1.0 -interp sinc | mrcalc - 0.0 -max - | mrconvert - /a/ha-nfs-2-ib/export/data/bswift-1/dcallow/CONNECTOME/dwi/100307/T1w/labelsgmfix-tmp-0YWHMW/T1.nii -strides -1,+2,+3
labelsgmfix: *Changing to scratch directory (/a/ha-nfs-2-ib/export/data/bswift-1/dcallow/CONNECTOME/dwi/100307/T1w/labelsgmfix-tmp-0YWHMW/)*
*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
$ /data/bswift-0/software/MRtrix3Tissue/bin/5ttgen freesurfer -force T1w_acpc_dc_restore_1.25.nii.gz 5TT.mif`
5ttgen: **[ERROR] Information from failed command:**
labelconvert: Image "input.mif" stored with floating-point type; need to check for non-integer or negative values
labelconvert: [ERROR] Floating-point number detected in image "input.mif"; label images should contain integers only
This specific error is being produced because 5ttgen freesurfer does not receive as input a T1-weighted image; its input is instead a FreeSurfer segmentation image.
It might be easy to get confused by the error message in this specific instance because while it is labelconvert that is raising the error, it’s actually not your own labelconvert call, but an instance of labelconvert being executed within 5ttgen freesurfer.
The origin of the error is that the input image to this command cannot be reasonably interpreted as a label image. E.g. If a voxel in your “parcellation image” contains the value 48.7, should one consider that voxel to be a member of parcel 49? Observation of such a value is actually more likely to be indicative of some upstream mistake in data processing (e.g. providing a T1-weighted image as input instead of a parcellation image); which is why the command produces an error rather than attempting to proceed.
Dear Rob,
I got this very same error and, as far as I can check, the freesurfer aparc+aseg parcellation I’m using does contain interger numbers (using mrview and clicking along the parcels).
5ttgen: [ERROR] labelconvert input.mif /home/diegolozano-soldevilla/freesurfer/FreeSurferColorLUT.txt /data/mrtrix3/share/mrtrix3/_5ttgen/FreeSurfer2ACT.txt indices.mif (freesurfer.py:64)
5ttgen: [ERROR] Information from failed command:
5ttgen:
labelconvert: Image "input.mif" stored with floating-point type; need to check for non-integer or negative values
labelconvert: Verifying parcellation image... [============================]
labelconvert: [ERROR] Floating-point number detected in image "input.mif"; label images should contain integers only
In order to debug the error, do you know a mrtrix tools (or any other) that can extract all indices or metadata from freesurfer aparc+aseg parcellations in order to find those non-interger or negative values?
Dear Rob,
Thank you very much for your prompt reply and sorry for the delay in my response. I tried your suggestions and I could not figure out where the problem comes from. Indeed I just realized that the *.nii to *.mif file conversion creates non-interger values outside of GM. As seen in the image below, the volumetric custom schaefer parcellation yields an exact 0 while the input.mif does not (mrview interpolation is deactivated):
At this point I guess that the question should be more along the lines of how to interface the cortical schaefer parcellation into the 5ttgen (freesurfer?) convention?. I guess I would need an equivalent of the FreeSurfer2ACT.txt file to link the Schaefer LUT file to get the indices.mif file? Any tips are more than welcome!
In anticipation, I apologize for the detour of the original question and thanks beforehand for your attention and time.
Dear Rob,
I fixed the non-interger problem! It was my bad since the schaefer200-17_unified_parcellation_volume.nii datatype was single precision: creating one with uint32 (or int32) solved the problem. As a result, the input.mif contains only interger number.
This allowed me to design the custom Schaefer200 plus 16 subcortical (Desikan) parcels mrtrix3/share/mrtrix3/_5ttgen/schaefer2162ACT.txt that looks like this:
As you can see, I combined the desikan wm.mif, csf.mif and path.mif because I currently don’t know how to fix this properly. Could you please suggest me any hints regarding this?
In anticipation, thank you very much for your attention and time!
Diego