Labelconvert exited with errors

Hi experts,
labelconvert exited with following errors:
¨
[archith@sallycomp Mrtrixpip]$ labelconvert -debug aparc+aseg.mgz FreeSurferColorLUT.txt fs_default.txt nodes.mif
labelconvert: [DEBUG] No config file found at "/etc/mrtrix.conf"
labelconvert: [DEBUG] No config file found at ".mrtrix.conf"
labelconvert: [INFO] opening image “aparc+aseg.mgz”…
Segmentation fault (core dumped)
¨
I couldnt find .mrtrix.conf or mrtrix.conf anywhere on my system.Kindly help.

Just to already answer a bit of this: it’s definitely got nothing to do with the presence of .mrtrix.conf. The debug output just tells you that no configuration file is present (which you’d typically create yourself if you need it to customise some particulars about MRtrix and mrview specifically). The problem here is the segmentation fault…

Hi @archithrajan1,

The first thing to check would be your installed MRtrix3 version:
labelconvert -v
It’s possible that this is a manifestation of a bug that has already been fixed.

The second thing to 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. 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.

The third possibility is that this has to do with the importing of metadata from the MGH / MGZ image file format. The online documentation for this format does not include some particulars of the way metadata are stored, which means that with the current MRtrix3 code it’s conceivable for memory errors to occur. This is something that is currently being fixed: see here and here.
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.

Hope that gets you somewhere
Rob

Thank You,Sir for valuable suggestions…converting to niftii worked :slight_smile:

"mrstats aparc+aseg.mgz"
had also given Segmentation core dumped error