cluster_roi icon indicating copy to clipboard operation
cluster_roi copied to clipboard

KeyError

Open egarza opened this issue 8 years ago • 4 comments

Hi

I keep getting a KeyError with the parcel_naming.py

`` python parcel_naming.py random_all.nii.gz random '10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,210,220,230,240,250,260,270,280,290,300,350,400,450,500,550,600,650,700,750,800,850,900,950'

[10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950]

parcel_naming.py called with random_all.nii.gz, random, 10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,210,220,230,240,250,260,270,280,290,300,350,400,450,500,550,600,650,700,750,800,850,900,950

Read in the parcellation results random_all.nii.gz

(47, 56, 46, 43)

43

Length of parcel values (43) == number of parcel images (43)

Reading in the atlas labels: mni_labels.csv

Read in the atlas /usr/share/fsl/5.0/data/atlases/MNI/MNI-maxprob-thr25-2mm.nii.gz

Downsample the atlas

Reading in the atlas labels: harvardoxford_subcortical_labels.csv

Read in the atlas /usr/share/fsl/5.0/data/atlases/HarvardOxford/HarvardOxford-sub-maxprob-thr25-2mm.nii.gz

Downsample the atlas

Reading in the atlas labels: juelich_labels.csv

Read in the atlas /usr/share/fsl/5.0/data/atlases/Juelich/Juelich-maxprob-thr25-2mm.nii.gz

Downsample the atlas

Reading in the atlas labels: talairach_labels.csv

Read in the atlas /usr/share/fsl/5.0/data/atlases/Talairach/Talairach-labels-2mm.nii.gz

Downsample the atlas

Reading in the atlas labels: harvardoxford_cortical_labels.csv

Read in the atlas /usr/share/fsl/5.0/data/atlases/HarvardOxford/HarvardOxford-cort-maxprob-thr25-2mm.nii.gz

Downsample the atlas

Traceback (most recent call last): File "parcel_naming.py", line 226, in main() File "parcel_naming.py", line 221, in main fid.write("["%s": %2.2f]"%(atlases[atlas][0][h[0]],h[1])) KeyError: 8 ``

Thanks

Eduardo

egarza avatar Mar 09 '16 18:03 egarza

After some debugging, it seems the problem was the Harvard Oxford Subcortical Atlas. Specifically, the labels numbers on "harvardoxford_subcortical_labels.csv" were incorrect. I corrected the CSV file and it worked fine. Here I copied the correct labels.

`` Generated from atlas label .xml files distributed with FSL
http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/

1 Left Cerebral White Matter 2 Left Cerebral Cortex 3 Left Lateral Ventrical 4 Left Thalamus 5 Left Caudate 6 Left Putamen 7 Left Pallidum 8 Brain-Stem 9 Left Hippocampus 10 Left Amygdala 11 Left Accumbens 12 Right Cerebral White Matter 13 Right Cerebral Cortex 14 Right Lateral Ventricle 15 Right Thalamus 16 Right Caudate 17 Right Putamen 18 Right Pallidum 19 Right Hippocampus 20 Right Amygdala 21 Right Accumbens `` Thanks for the script

Eduardo

egarza avatar Mar 09 '16 21:03 egarza

@egarza Thanks for saving me a ton of time debugging that

FL33TW00D avatar May 22 '20 22:05 FL33TW00D

Anytime

egarza avatar May 22 '20 23:05 egarza

Anytime Hello, is there any corresponding Labels file in this CC200 brain -area division template? I can't find a little related information on the Internet

yun1498 avatar Apr 01 '23 11:04 yun1498