ccraddock / cluster_roi

Python script to perform the spatially constrained parcellation of functional MRI data as described in Craddock et al., Human Brain Mapp., 33 (9) 2012
http://ccraddock.github.io/cluster_roi/
39 stars 26 forks source link

KeyError #5

Open egarza opened 8 years ago

egarza commented 8 years ago

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 commented 8 years ago

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

FL33TW00D commented 4 years ago

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

egarza commented 4 years ago

Anytime

yun1498 commented 1 year ago

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