Labelconvert: Image "subject_aparc+aseg.mgz" stored with signed integer type; need to check for negative values

labelconvert aparc+aseg.mgz FreeSurferColorLUT.txt fs_default.txt nodes.mif

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

I have followed suggestion by @rsmith :

  1. check would be the input image itself. In particular, run:
    mrstats aparc+aseg.mgz
    and check to see if the minimum value in the image is a negative number.

This gives:

mrstats aparc+aseg.mgz

mrstats: [100%] uncompressing image “aparc+aseg.mgz”
volume mean median std min max count
[ 0 ] 45.6933 0 270.405 0 2035 16777216

  1. The most up-to-date code should deal with this, but if this is a problem you could try:
    mrcalc aparc+aseg.mgz 0 -gt aparc+aseg.mgz -mult - | labelconvert - FreeSurferColorLUT.txt fs_default.txt nodes.mif
    That will set any negative values in the image to zero before it is passed to labelconvert .

mrcalc aparc+aseg.mgz 0 -gt aparc+aseg.mgz -mult - | labelconvert - FreeSurferColorLUT.txt fs_default.txt nodes.mif

mrcalc: [100%] uncompressing image “aparc+aseg.mgz”
mrcalc: [100%] computing: ((aparc+aseg.mgz > 0) * aparc+aseg.mgz)
labelconvert: Image “/tmp/mrtrix-tmp-BMukP1.mif” stored with floating-point type; need to check for non-integer or negative values
labelconvert: [100%] Verifying parcellation image

  1. One way to get around this would be to use FreeSurfer’s mri_convert tool to convert aparc+aseg.mgz to NIfTI, and then use the NIfTI as the input to labelconvert .
    $ mri_convert aparc+aseg.mgz aparc+aseg.nii

labelconvert aparc+aseg.nii FreeSurferColorLUT.txt fs_default.txt nodes.mif

labelconvert: Image “aparc+aseg.nii” stored with signed integer type; need to check for negative values
labelconvert: [100%] Verifying parcellation image

This issue is still same.