Open arkiev opened 7 months ago
Before making any change to such raw data, I would need to be confident that doing so isn't going to break some other workflow.
Current contents of share/mrtrix3/FreeSurferSGM.txt
:
1 Left-Thalamus-Proper
2 Left-Caudate
3 Left-Putamen
4 Left-Pallidum
5 Left-Accumbens-area
6 Right-Thalamus-Proper
7 Right-Caudate
8 Right-Putamen
9 Right-Pallidum
10 Right-Accumbens-area
11 Left-Hippocampus
12 Left-Amygdala
13 Right-Hippocampus
14 Right-Amygdala
Current contents of share/mrtrix3/labelconvert/fs_default.txt
:
36 L.TH Left-Thalamus 0 118 14 255
36 L.TH Left-Thalamus-Proper 0 118 14 255
37 L.CA Left-Caudate 122 186 220 255
38 L.PU Left-Putamen 236 13 176 255
39 L.PA Left-Pallidum 12 48 255 255
40 L.HI Left-Hippocampus 220 216 20 255
41 L.AM Left-Amygdala 103 255 255 255
42 L.AC Left-Accumbens-area 255 165 0 255
43 R.TH Right-Thalamus 0 118 14 255
43 R.TH Right-Thalamus-Proper 0 118 14 255
44 R.CA Right-Caudate 122 186 220 255
45 R.PU Right-Putamen 236 13 176 255
46 R.PA Right-Pallidum 13 48 255 255
47 R.HI Right-Hippocampus 220 216 20 255
48 R.AM Right-Amygdala 103 255 255 255
49 R.AC Right-Accumbens-area 255 165 0 255
Current contents of share/mrtrix3/labelconvert/hcpmmp1_ordered.txt
(added in #1289):
361 L_Cerebellum 230 148 34 255
362 L_Thalamus 0 118 14 255
363 L_Caudate 122 186 220 255
364 L_Putamen 236 13 176 255
365 L_Pallidum 12 48 255 255
366 L_Hippocampus 220 216 20 255
367 L_Amygdala 103 255 255 255
368 L_Accumbens 255 165 0 255
369 L_VentralDC 165 42 42 255
370 R_Cerebellum 230 148 34 255
371 R_Thalamus 0 118 14 255
372 R_Caudate 122 186 220 255
373 R_Putamen 236 13 176 255
374 R_Pallidum 13 48 255 255
375 R_Hippocampus 220 216 20 255
376 R_Amygdala 103 255 255 255
377 R_Accumbens 255 165 0 255
378 R_VentralDC 165 42 42 255
The header of this file also states:
This tableprovides parcel names and colours as they are provded from e.g. the following command:
mri_aparc2aseg --old-ribbon --annotation glasser --s hmsc001-01 --o glasser.mgz
Also these strings are identical to those in share/mrtrix3/labelconvert/hcpmmp1_original.txt
.
If my recollection is right, there is no suitable lookup table provided to accompany the output of the command used for generating the parcellation image. As such, MRtrix3 embeds both a table suitable for interpreting its output, and a target reordering, to be used as input and output LUTs for labelconvert
respectively.
So I see two potential solutions:
Those parcels are renamed in both share/mrtrix3/labelconvert/hcpmmp1_original.txt
and share/mrtrix3/labelconvert/hcpmmp1_ordered.txt
(renaming in only the former would break the labelconvert
step).
Potential disadvantages of this approach:
Modify the labelsgmfix
code, and/or the contents of share/
, to make that script applicable to data where the HCPMMP1 parcellation has been applied.
What might actually work straight out of the box here based on a cursory inspection would be to instead modify share/mrtrix3/labelsgmfix/FreeSurferSGM.txt
to contain both conventions; ie.:
1 Left-Thalamus-Proper
1 L_Thalamus
2 Left-Caudate
2 R_Thalamus
3 Left-Putamen
3 L_Putamen
4 Left-Pallidum
4 L_Pallidum
5 Left-Accumbens-area
5 L_Accumbens
6 Right-Thalamus-Proper
6 R_Thalamus
7 Right-Caudate
7 R_Caudate
8 Right-Putamen
8 R_Putamen
9 Right-Pallidum
9 R_Pallidum
10 Right-Accumbens-area
10 R_Accumbens
11 Left-Hippocampus
11 L_Hippocampus
12 Left-Amygdala
12 L_Amygdala
13 Right-Hippocampus
13 R_Hippocampus
14 Right-Amygdala
14 R_Amygdala
MRtrix3 permits LUTs to have multiple labels for one index in certain contexts; this is one such way in which this can be exploited.
My preference is for the second approach, provided it works for both HCPMMP1 and other data.
Given you've already got one posthoc hack in place, can you see if this alterative posthoc hack works?
Thanks for looking into this, and for the suggestions.
Here's what I have done: return /opt/mrtrix3/latest/share/mrtrix3/labelconvert/hcpmmp1_ordered.txt
to the default file, updated /opt/mrtrix3/latest/share/mrtrix3/labelsgmfix/FreeSurferSGM.txt
to contain both conventions, re-ran my code...
This change fixed the problem with hcpmmp1 parcellation, and did not cause errors with destrieux, desikan, Yeo7 or Yeo17...so perhaps let's continue using FreeSurferSGM.txt that contains both conventions going forward?
I'm happy with that. Even better would be to add some test data to prove that the fix yields a sensible result and doesn't break any existing test... but I won't put you through that. I'm just neck deep in CI of late.
The current hcpmmp1_ordered.txt LUT lists abbreviated structures that don't match with the contents of FreeSurferSGM.txt, and as such,
labelsgmfix
returns an error. This relates to the file located at/opt/mrtrix3/latest/share/mrtrix3/labelconvert/hcpmmp1_ordered.txt
As a workaround, I locally update the labels of the following structures to:
These changes need to be made after every build...Any chance of updating this at the source?