I was able to avoid the problem mentioned here using the -f flag and using individually the different labels.
Nevertheless, after following this other post about creating the hemicord, once I arrive to the sct_extract_metrics, i found myself with the same problem, but now I can’t (or I don’t know how to) use the -f flag if I want to obtain the results using the labels 56 and 57.
extop@:/aran/CNS_111/Hemicord_Julien$ sct_extract_metric -i n4_CNS_111.nii -l 56
--
Spinal Cord Toolbox (dev)
Traceback (most recent call last):
File "/home/extop/sct_dev/scripts/sct_extract_metric.py", line 425, in <module>
perlevel=perlevel, verbose=verbose, combine_labels=combine_labels)
File "/home/extop/sct_dev/scripts/sct_extract_metric.py", line 289, in main
map_cluster in map_clusters].index(True))
ValueError: True is not in list
Hopefully the solution is “use method -wa” or another one.
If you confirm that you can create the hemicord and use sct_extract_metric with the -l 56, I will try some other things on my end.
Thanks!
PD: is there a written document where we can refresh how to write properly (the ~~~ for code, the ** for bold, etc)?
The error is caused by what is explained here: Problem with sct_extract_metric - #4 by jcohenadad. So unless you fix your custom label_info.txt with the correct mathematical assumption, you can use any other method such as -wa.
PD: is there a written document where we can refresh how to write properly (the ~~~ for code, the ** for bold, etc)?
good idea, thanks for the feedback. I’ve added a link to a Markdown documentation:
I have manually changed both info_label.txt, adding the following lines after the label 55.
56, left hemi-cord, 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34
57, right hemi-cord, 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35
extop@:/aran/CNS_111/Hemicord_Julien$ sct_extract_metric -i n4_CNS_111.nii -l 56 -method wa
--
Spinal Cord Toolbox (dev)
Traceback (most recent call last):
File "/home/extop/sct_dev/scripts/sct_extract_metric.py", line 425, in <module>
perlevel=perlevel, verbose=verbose, combine_labels=combine_labels)
File "/home/extop/sct_dev/scripts/sct_extract_metric.py", line 289, in main
map_cluster in map_clusters].index(True))
ValueError: True is not in list
On the other hand, using the -f
extop@:/aran/CNS_111/Hemicord_Julien$ sct_extract_metric -i n4_CNS_111.nii -f /aran/CNS_111/Hemicord_Julien/PAM50_atlas_left.nii.gz -method wa
--
Spinal Cord Toolbox (dev)
Load metric image...
Estimation for label: PAM50_atlas_left
Done! To view results, type:
xdg-open extract_metric.csv
Maybe I am hitting my head with a wall, I have no clue