Missclassification of voxels (=0) around sub-cortical gray matter structures after labelsgmfix

Hello everyone,

When employing labelsgmfix with T1 and FreeSurfer (aparc+aseg.mgz) segmentation, there are voxels around sub-cortical gm structures that are set to 0. (including amygdala and hippocampus as we ran -sgm_amyg_hipp, but the problem persists even when running without).

T1
bild

aparc+aseg

aparc+aseg_gmfix

The underlying issue seems to be that gmfix enhanced structures are smaller than in the original freesurfer segmentation, and as a result the excluded voxels are set to 0.

Looking through the code on the github we are not sure exactly in which step this is occurring, and have tried debugging with -nocleanup. For instance, the “sgm_overlap_mask.mif” does not show any overlap in these voxels.

A workaround would be to create a mask of the original structure and use mrcalc to increase only the 0-voxels to the desired value.

However, some structures should not be exclusively surrounded by the same type of matter and so this becomes more complicated if we have some 0-voxels who could be CSF or white matter or etc.

Wondering if this is a known issue or if you have any ideas for solutions!

Cheers,
Rio

Hi Rio,
Welcome to the forum!

Do you mind sharing the command used to generate unusual output? And have you tried using a different t1 input (for example, norm.mgz)?

Cheers,
Arkiev

Hi Adsouza,

The command is

labelsgmfix aparc+aseg.mgz T1.mgz FreeSurferColorLUT.txt output -sgm_amyg_hipp

When running with norm.mgz these structures dissappear completely (see image below).

Cheers,
Rio

And running with nu.mgz produces the same initial results with 0-voxels…

Hi Rio,

Thanks for sharing this information. Were there any error/warning messages?

Do you mind re-running the command with the option -nocleanup, and after doing this, what files are in the temporary directory (note that the temporary directory can be specified using the option -scratch)

Cheers,
Arkiev

Hi,

I ran it with aparc+aseg.mgz once again, below is the contents of the scratch directory.

Cheers,
Rio

Hi Rio,

labelsgmfix will strip the original parcellation image of the SGM structure, and then insert the new delineation of that structure. This typically works fine, for example with the Desikan atlas, because white-matter is set to 0 in the parcellation image.

Conversely, the input aparc+aseg.mgz contains a segmentation of the left and right cerebral white matter (indexed as 2 and 41). And consequently, because there is no “filling” completed with this command, we see gaps between the inserted SGM segmentations and the existing white matter segmentations. Depending on the nature of the study, this might not be a problem.

This however doesn’t explain why the structures were completely missing when norm.mgz was used as the input to T1 :thinking:

Cheers,
Arkiev