[labelconvert] bilateral thalamus gone

Hi Rob,

In my group analysis (N=~200), I found that labelconvert “skipped” specifically the bilateral thalamus. No error messages until I ran tck2connectome:

tck2connectome: [WARNING] existing output files will be overwritten
tck2connectome: [WARNING] The following nodes are missing from the parcellation image:
tck2connectome: [WARNING] 76, 83
tck2connectome: [WARNING] (This may indicate poor parcellation image preparation, use of incorrect or incomplete LUT file(s) in labelconvert, or very poor registration)

Please find this figure showing the original freesurfer aparc+aseg (greyscale) overlaid with the “converted” aparc+aseg (yellow-red), which does not include the thalamus.

I used FreeSurferColotLUT.txt containing:

49 Right-Thalamus-Proper

and mrtrix’s fs_default.txt containing:

43 R.TH Right-Thalamus-Proper

Why would this error occur only to the thalamus across all subjects??

Best,
Jiook

Why would this error occur only to the thalamus across all subjects?

:man_shrugging:

Never seen this before…

Only thing I can suggest is checking the raw image intensity within the thalami of the input image to labelconvert i.e. the raw FreeSurfer output: maybe they have been labelled by FreeSurfer as e.g. “Right-Thalamus” (48) instead of “Right-Thalamus-Proper” (49)?

This issue can crop up with custom lookup tables due to minor spelling errors: The name of the node must be precisely identical between the two lookup tables in order for labelconvert to construct the input-output index mapping. But given you’re using software-provided lookup table files as both input and output, I wouldn’t expect this to have occurred in your case.

Rob

Hi @Jiook_Cha,

According to this line, I guess you actually used fs_a2009s.txt for the lut_out argument when running labelconvert? In this case, the input parcellation image needs to be aparc.a2009s+aseg.mgz as provided by FreeSurfer, not the aparc+aseg as you described.

But having said that you also mentioned:

So, I would suggest that you check your labelconvert step to ensure the consistency of your inputs.

Regarding:

No, that has not been changed with the latest FreeSurfer (v6.0).

Cheers.
Jimmy

Thanks for the suggestions, but I actually matched the input files and LUT files.

Strangely, when I ran labelconvert on my local computer, I was able to see the bilateral thalamus again (without changing any). The issue only occurs on the supercomputer.

While I’m curious to know why that might be the case, without the ability to reproduce the problem I can’t really help over and above suggestions for what to test:

  • Is the FreeSurferColorLUT.txt file identical between the two systems?

  • Is fs_default.txt identical between the two systems?

  • Is the input image identical between the two systems?

  • Is the compiled version of MRtrix3 identical between the two systems?

  • Another I’ll throw in for the sake of it: Is the locale identical between the two systems?

Rather than just checking that they’re the same, actually copy each potential source of variation from one system to the other, run the same command, and repeat until you achieve the same outcome on both systems.

While it’s possible for the outcomes of floating-point computations to vary slightly between processors, the labelconvert command is entirely integer-based; so unfortunately the cause is more likely to be a discrepancy between your usages on the two systems than a difference between the two systems themselves :worried:

Hi Rob,

I’m also encountering the same issue. After checking the contents of FreeSurferColorLUT.txt and fs_default.txt, I noticed discrepancies in the naming conventions for thalamic regions. I believe modifying fs_default.txt might resolve this problem.

Additionally, I’ve run into another issue: when processing different subjects using the same command, the fiber tractography fails for some subjects, and no valid fiber bundles can be selected. Sometimes re-executing the command fixes it, but other times it doesn’t work.

In FreeSurferColorLUT.txt:
9 Left-Thalamus-unused 0 118 14 0
10 Left-Thalamus 0 118 14 0
48 Right-Thalamus-unused 0 118 14 0
49 Right-Thalamus 0 118 14 0
8001 Thalamus-Anterior 74 130 181 0
8002 Thalamus-Ventral-anterior 242 241 240 0
8003 Thalamus-Lateral-dorsal 206 65 78 0
8004 Thalamus-Lateral-posterior 120 21 133 0
8005 Thalamus-Ventral-lateral 195 61 246 0
8006 Thalamus-Ventral-posterior-medial 3 147 6 0
8007 Thalamus-Ventral-posterior-lateral 220 251 163 0
8008 Thalamus-intralaminar 232 146 33 0
8009 Thalamus-centromedian 4 114 14 0
8010 Thalamus-mediodorsal 121 184 220 0
8011 Thalamus-medial 235 11 175 0
8012 Thalamus-pulvinar 12 46 250 0
8013 Thalamus-lateral-geniculate 203 182 143 0
8014 Thalamus-medial-geniculate 42 204 167 0
Tractography-based Segmentation of the Human Thalamus; Cerebral Cortex

And in fs_default.txt:
76 Left-Thalamus-Proper 0 118 14 255
77 Left-Caudate 122 186 220 255
78 Left-Putamen 236 13 176 255
79 Left-Pallidum 12 48 255 255
80 Left-Hippocampus 220 216 20 255
81 Left-Amygdala 103 255 255 255
82 Left-Accumbens-area 255 165 0 255

83 Right-Thalamus-Proper 0 118 14 255
84 Right-Caudate 122 186 220 255
85 Right-Putamen 236 13 176 255
86 Right-Pallidum 13 48 255 255
87 Right-Hippocampus 220 216 20 255
88 Right-Amygdala 103 255 255 255
89 Right-Accumbens-area 255 165 0 255

I compared the data of failed and successful subjects during the processing and found that the error seems to occur in the generation of the transformation matrix:

flirt -dof 6 -cost normmi -ref “$T1w”.nii.gz -in b0.nii -omat T_fsl.txt
transformconvert T_fsl.txt b0.nii “$T1w”.nii.gz flirt_import T_DWItoT1.txt

All subjects’ data were collected in the same manner, with no differences whatsoever. The text file shows that the registration transformation matrix (T_DWItoT1.txt) of the failed subjects may be incorrect, causing the align.mif to be severely distorted or rotated upside down in space.

T_DWItoT1.txt of failed subjects:
0.0421641352273587 0.958538769191152 -0.281825442567315 -33.9870323321221
-0.999102888937667 0.0415694722733054 -0.00809137117458897 7.33454194403716
0.00395945227677019 0.281913755733053 0.959431568452144 199.843631658064
0 0 0 1

T_DWItoT1.txt of successful subjects:
0.999998759047338 0.00143857549017103 0.000584124524436271 0.121877574512344
-0.00144455474726325 0.999945280622288 0.0103628337985956 -0.228377658637532
-0.000569184741492841 -0.0103636854523763 0.999946150616915 -0.334588904044225
0 0 0 1