Skip to content
Snippets Groups Projects
Commit d7e73d7e authored by Sharon Yates's avatar Sharon Yates
Browse files

Create cvs for allen 2015, 2017, 2022 and WHS v2, v3, v4

Write and run function for correctly formatted label file
parent d9f8a7f1
No related branches found
No related tags found
No related merge requests found
idx,r,g,b,a,VIS,MSH,label
1,255,52,39,1.0,1.0,0.0,descending corticofugal pathways
2,255,186,0,1.0,1.0,0.0,substantia nigra
3,0,0,255,1.0,1.0,0.0,subthalamic nucleus
4,255,255,0,1.0,1.0,0.0,molecular layer of the cerebellum
5,0,255,255,1.0,1.0,0.0,granule cell level of the cerebellum
6,255,0,255,1.0,1.0,0.0,alveus of the hippocampus
7,52,255,13,1.0,1.0,0.0,inferior cerebellar peduncle
10,29,104,235,1.0,1.0,0.0,"cingulate cortex, area 2"
30,129,79,255,1.0,1.0,0.0,striatum
31,255,145,186,1.0,1.0,0.0,globus pallidus
32,26,231,255,1.0,1.0,0.0,entopeduncular nucleus
33,2,44,255,1.0,1.0,0.0,ventricular system
34,212,255,0,1.0,1.0,0.0,medial lemniscus
35,0,176,63,1.0,1.0,0.0,facial nerve
36,124,252,0,1.0,1.0,0.0,"anterior commissure, anterior part"
37,255,186,0,1.0,1.0,0.0,"anterior commissure, posterior part"
38,174,0,232,1.0,1.0,0.0,ventral hippocampal commissure
39,0,100,0,1.0,1.0,0.0,thalamus
40,255,8,0,1.0,1.0,0.0,septal region
41,48,218,0,1.0,1.0,0.0,optic nerve
42,38,126,255,1.0,1.0,0.0,optic tract and optic chiasm
43,218,170,62,1.0,1.0,0.0,pineal gland
44,0,165,21,1.0,1.0,0.0,inner ear
45,134,255,90,0.68,1.0,0.0,spinal cord
46,33,230,255,1.0,1.0,0.0,commissure of the superior colliculus
47,153,83,255,1.0,1.0,0.0,brainstem
48,226,120,161,1.0,1.0,0.0,hypothalamic region
49,238,47,44,1.0,1.0,0.0,inferior colliculus
50,86,0,221,1.0,1.0,0.0,superficial gray layer of the superior colliculus
51,7,255,89,1.0,1.0,0.0,periaqueductal gray
52,21,192,255,1.0,1.0,0.0,fornix
53,238,186,0,1.0,1.0,0.0,mammillothalamic tract
54,173,255,47,1.0,1.0,0.0,commissural stria terminalis
55,225,151,15,1.0,1.0,0.0,deeper layers of the superior colliculus
56,235,87,255,1.0,1.0,0.0,periventricular gray
57,250,244,247,1.0,1.0,0.0,genu of the facial nerve
58,0,215,11,1.0,1.0,0.0,pontine nuclei
59,0,255,29,1.0,1.0,0.0,fimbria of the hippocampus
60,244,67,69,1.0,1.0,0.0,fasciculus retroflexus
61,255,252,0,1.0,1.0,0.0,stria medullaris of the thalamus
62,238,117,51,1.0,1.0,0.0,stria terminalis
63,255,0,218,1.0,1.0,0.0,posterior commissure
64,15,109,230,1.0,1.0,0.0,glomerular layer of the accessory olfactory bulb
65,255,227,0,1.0,1.0,0.0,glomerular layer of the olfactory bulb
66,255,135,0,1.0,1.0,0.0,olfactory bulb
67,255,110,0,1.0,1.0,0.0,corpus callosum and associated subcortical white matter
68,188,32,173,1.0,1.0,0.0,brachium of the superior colliculus
69,147,255,39,1.0,1.0,0.0,commissure of the inferior colliculus
70,39,244,253,1.0,1.0,0.0,central canal
71,63,192,255,1.0,1.0,0.0,interpeduncular nucleus
72,179,28,53,1.0,1.0,0.0,ascending fibers of the facial nerve
73,255,79,206,1.0,1.0,0.0,anterior commissure
74,0,246,14,1.0,1.0,0.0,inferior olive
75,91,241,255,1.0,1.0,0.0,spinal trigeminal nuclus
76,250,128,114,1.0,1.0,0.0,spinal trigeminal tract
77,206,211,7,1.0,1.0,0.0,frontal associiation cortex
78,134,204,76,1.0,1.0,0.0,middle cerebellar peduncle
79,128,170,255,1.0,1.0,0.0,transverse fibers of the pons
80,69,235,202,1.0,1.0,0.0,habenular commissure
81,222,7,237,1.0,1.0,0.0,nucleus of the stria medullaris
82,225,240,13,1.0,1.0,0.0,basal forebrain region
83,250,170,64,1.0,1.0,0.0,supraoptic decussation
84,65,150,255,1.0,1.0,0.0,medial lemniscus decussation
85,114,9,212,1.0,1.0,0.0,pyramidal decussation
92,3,193,45,1.0,1.0,0.0,neocortex
93,0,8,182,1.0,1.0,0.0,bed nucleus of the stria terminalis
94,255,87,30,1.0,1.0,0.0,pretectal region
95,165,131,107,1.0,1.0,1.0,cornu ammonis 3
96,91,45,10,1.0,1.0,1.0,dentate gyrus
97,255,255,0,1.0,1.0,1.0,cornu ammonis 2
98,217,104,13,1.0,1.0,1.0,cornu ammonis 1
99,255,82,82,1.0,1.0,1.0,fasciola cinereum
100,255,192,0,1.0,1.0,1.0,subiculum
108,40,112,130,1.0,1.0,1.0,postrhinal cortex
109,80,123,175,1.0,1.0,1.0,presubiculum
110,23,54,96,1.0,1.0,1.0,parasubiculum
112,205,51,255,1.0,1.0,1.0,perirhinal area 35
113,112,48,160,1.0,1.0,1.0,perirhinal area 36
114,12,92,8,1.0,1.0,1.0,entorhinal cortex
115,221,166,36,1.0,1.0,1.0,lateral entorhinal cortex
0,0,0,0,1.0,1.0,1.0,Clear Label
idx,r,g,b,a,VIS,MSH,label
1,255,52,39,1.0,1.0,0.0,descending corticofugal pathways
2,255,186,0,1.0,1.0,0.0,substantia nigra
3,0,0,255,1.0,1.0,0.0,subthalamic nucleus
4,255,255,0,1.0,1.0,0.0,molecular layer of the cerebellum
5,0,255,255,1.0,1.0,0.0,granule cell level of the cerebellum
6,255,0,255,1.0,1.0,0.0,alveus of the hippocampus
7,52,255,13,1.0,1.0,0.0,inferior cerebellar peduncle
10,29,104,235,1.0,1.0,0.0,"cingulate cortex, area 2"
30,129,79,255,1.0,1.0,0.0,striatum
31,255,145,186,1.0,1.0,0.0,globus pallidus
32,26,231,255,1.0,1.0,0.0,entopeduncular nucleus
33,2,44,255,1.0,1.0,0.0,ventricular system
34,212,255,0,1.0,1.0,0.0,medial lemniscus
35,255,25,240,1.0,1.0,0.0,facial nerve
36,124,252,0,1.0,1.0,0.0,"anterior commissure, anterior part"
37,255,186,0,1.0,1.0,0.0,"anterior commissure, posterior part"
38,174,0,232,1.0,1.0,0.0,ventral hippocampal commissure
39,0,100,0,1.0,1.0,0.0,thalamus
40,255,8,0,1.0,1.0,0.0,septal region
41,48,218,0,1.0,1.0,0.0,optic nerve
42,38,126,255,1.0,1.0,0.0,optic tract and optic chiasm
43,218,170,62,1.0,1.0,0.0,pineal gland
44,255,255,255,1.0,1.0,0.0,"inner ear, erroneous"
45,134,255,90,1.0,1.0,0.0,spinal cord
46,33,230,255,1.0,1.0,0.0,commissure of the superior colliculus
47,153,83,255,1.0,1.0,0.0,brainstem
48,226,120,161,1.0,1.0,0.0,hypothalamic region
50,86,0,221,1.0,1.0,0.0,superficial gray layer of the superior colliculus
51,7,255,89,1.0,1.0,0.0,periaqueductal gray
52,21,192,255,1.0,1.0,0.0,fornix
53,238,186,0,1.0,1.0,0.0,mammillothalamic tract
54,173,255,47,1.0,1.0,0.0,commissural stria terminalis
55,225,151,15,1.0,1.0,0.0,deeper layers of the superior colliculus
56,235,87,255,1.0,1.0,0.0,periventricular gray
57,250,244,247,1.0,1.0,0.0,genu of the facial nerve
58,0,215,11,1.0,1.0,0.0,pontine nuclei
59,0,255,29,1.0,1.0,0.0,fimbria of the hippocampus
60,244,67,69,1.0,1.0,0.0,fasciculus retroflexus
61,0,255,0,1.0,1.0,0.0,stria medullaris of the thalamus
62,238,117,51,1.0,1.0,0.0,stria terminalis
63,255,0,218,1.0,1.0,0.0,posterior commissure
64,15,109,230,1.0,1.0,0.0,glomerular layer of the accessory olfactory bulb
65,255,227,0,1.0,1.0,0.0,glomerular layer of the olfactory bulb
66,255,135,0,1.0,1.0,0.0,olfactory bulb
67,255,110,0,1.0,1.0,0.0,corpus callosum and associated subcortical white matter
68,188,32,173,1.0,1.0,0.0,brachium of the superior colliculus
69,255,42,39,1.0,1.0,1.0,"inferior colliculus, commissure"
70,39,244,253,1.0,1.0,0.0,central canal
71,63,192,255,1.0,1.0,0.0,interpeduncular nucleus
72,179,28,53,1.0,1.0,0.0,ascending fibers of the facial nerve
73,255,79,206,1.0,1.0,0.0,anterior commissure
74,0,246,14,1.0,1.0,0.0,inferior olive
75,91,241,255,1.0,1.0,0.0,spinal trigeminal nucleus
76,250,128,114,1.0,1.0,0.0,spinal trigeminal tract
77,206,211,7,1.0,1.0,0.0,frontal association cortex
78,134,204,76,1.0,1.0,0.0,middle cerebellar peduncle
79,128,170,255,1.0,1.0,0.0,transverse fibers of the pons
80,69,235,202,1.0,1.0,0.0,habenular commissure
81,222,7,237,1.0,1.0,0.0,nucleus of the stria medullaris
82,225,240,13,1.0,1.0,0.0,basal forebrain region
83,250,170,64,1.0,1.0,0.0,supraoptic decussation
84,65,150,255,1.0,1.0,0.0,medial lemniscus decussation
85,114,9,212,1.0,1.0,0.0,pyramidal decussation
92,3,193,45,1.0,1.0,0.0,neocortex
93,0,8,182,1.0,1.0,0.0,bed nucleus of the stria terminalis
94,255,87,30,1.0,1.0,0.0,pretectal region
95,165,131,107,1.0,1.0,0.0,cornu ammonis 3
96,91,45,10,1.0,1.0,0.0,dentate gyrus
97,255,255,0,1.0,1.0,0.0,cornu ammonis 2
98,217,104,13,1.0,1.0,0.0,cornu ammonis 1
99,255,0,0,1.0,1.0,0.0,fasciola cinereum
100,255,192,0,1.0,1.0,0.0,subiculum
108,40,112,130,1.0,1.0,0.0,postrhinal cortex
109,80,123,175,1.0,1.0,0.0,presubiculum
110,23,54,96,1.0,1.0,0.0,parasubiculum
112,205,51,255,1.0,1.0,0.0,perirhinal area 35
113,112,48,160,1.0,1.0,0.0,perirhinal area 36
114,122,187,51,1.0,1.0,0.0,entorhinal cortex
115,90,111,47,1.0,1.0,0.0,lateral entorhinal cortex
119,0,144,55,1.0,1.0,1.0,vestibular apparatus
120,0,255,29,1.0,1.0,1.0,cochlea
121,253,148,0,1.0,1.0,1.0,cochlear nerve
122,253,50,0,1.0,1.0,1.0,vestibular nerve
123,0,12,255,1.0,1.0,1.0,"ventral cochlear nucleus, granule cell layer"
125,52,29,144,1.0,1.0,0.0,4th ventricle
126,92,156,211,1.0,1.0,1.0,"dorsal cochlear nucleus, molecular layer"
127,0,80,156,1.0,1.0,1.0,"dorsal cochlear nucleus, fusiform and granule layer"
128,197,238,255,1.0,1.0,1.0,"dorsal cochlear nucleus, deep core"
129,255,217,0,1.0,1.0,1.0,acoustic striae
130,213,255,0,1.0,1.0,1.0,trapezoid body
131,0,255,81,1.0,1.0,1.0,nucleus of the trapezoid body
132,0,238,255,1.0,1.0,1.0,superior paraolivary nucleus
133,219,239,61,1.0,1.0,1.0,medial superior olive
134,35,76,190,1.0,1.0,1.0,lateral superior olive
135,1,153,21,1.0,1.0,1.0,superior periolivary region
136,0,174,255,1.0,1.0,1.0,ventral periolivary nuclei
137,255,0,115,1.0,1.0,1.0,"lateral lemniscus, ventral nucleus"
138,171,16,91,1.0,1.0,1.0,"lateral lemniscus, intermediate nucleus"
139,108,18,91,1.0,1.0,1.0,"lateral lemniscus, dorsal nucleus"
140,255,29,0,1.0,1.0,1.0,"lateral lemniscus, commissure"
141,255,166,0,1.0,1.0,1.0,lateral lemniscus
142,206,255,142,1.0,1.0,1.0,"inferior colliculus, dorsal cortex"
143,0,238,255,1.0,1.0,1.0,"inferior colliculus, central nucleus"
145,48,136,203,1.0,1.0,1.0,"inferior colliculus, external cortex"
146,176,58,72,1.0,1.0,1.0,"inferior colliculus, brachium"
147,10,244,217,1.0,1.0,1.0,"medial geniculate body, medial division"
148,239,163,0,1.0,1.0,1.0,"medial geniculate body, dorsal division"
149,131,58,31,1.0,1.0,1.0,"medial geniculate body, ventral division"
150,255,47,242,1.0,1.0,1.0,"medial geniculate body, marginal zone"
151,255,215,0,1.0,1.0,1.0,primary auditory cortex
152,240,255,255,1.0,1.0,1.0,"secondary auditory cortex, dorsal area"
153,216,191,216,1.0,1.0,1.0,"secondary auditory cortex, ventral area"
157,244,156,255,1.0,1.0,1.0,auditory radiation
158,34,152,255,1.0,1.0,1.0,"ventral cochlear nucleus, anterior part"
159,0,230,207,1.0,1.0,1.0,"ventral cochlear nucleus, posterior part"
160,0,255,106,1.0,1.0,1.0,"ventral cochlear nucleus, cap area"
162,185,255,233,1.0,1.0,1.0,spiral ganglion
163,99,205,0,1.0,1.0,1.0,nucleus sagulum
164,110,0,255,1.0,1.0,1.0,"reticular thalamic nucleus, auditory segment"
0,0,0,0,1.0,1.0,1.0,Clear Label
allenID,r,g,b,1a,1b,1c,name
idx,r,g,b,a,VIS,MSH,label
1,255,52,39,1.0,1.0,0.0,corticofugal tract and corona radiata
3,0,0,255,1.0,1.0,0.0,Subthalamic nucleus
4,255,255,1,1.0,1.0,0.0,Molecular cell layer of the cerebellum
......
allenID,r,g,b,1a,1b,1c,name
idx,r,g,b,a,VIS,MSH,label
997,255,255,255,1.0,1.0,1.0,root
8,191,218,227,1.0,1.0,1.0,Basic cell groups and regions
567,176,240,255,1.0,1.0,1.0,Cerebrum
......
allenID,r,g,b,1a,1b,1c,name
idx,r,g,b,a,VIS,MSH,label
997,255,255,255,1.0,1.0,1.0,root
8,191,218,227,1.0,1.0,1.0,Basic cell groups and regions
567,176,240,255,1.0,1.0,1.0,Cerebrum
......
This diff is collapsed.
This diff is collapsed.
......@@ -2,16 +2,16 @@ import pandas as pd
"""reformat itksnap_label_description_2022.txt"""
def reformat_allen_label(inputpath, outputpath):
df = pd.read_csv(inputpath, sep=" ", header=None, names=["id", "r", "g", "b", "1a", "1b", "1c", "name"])
df = pd.read_csv(inputpath, sep=" ", header=None, names=["id", "r", "g", "b", "a", "VIS", "MSH", "label"])
# this is to reformat the name to allenID
df[["name", "allenID"]] = df["name"].str.split(' - ', expand=True)
df[["label", "idx"]] = df["label"].str.split(' - ', expand=True)
# this is to add on "root" as this was missing from the Allen file
df = df.append({"allenID": 0, "name": "background", "r": 255, "g": 255, "b": 255, "1a": 1.0, "1b":1.0, "1c":1.0}, ignore_index=True)
df = df.append({"idx": 0, "label": "background", "r": 255, "g": 255, "b": 255, "a": 1.0, "VIS":1.0, "MSH":1.0}, ignore_index=True)
df.to_csv(outputpath, index=False)
reformat_allen_label("../junk/itksnap_label_description_2022.txt","../junk/allen2022_colours.csv")
reformat_allen_label("../junk/itksnap_label_description_2022.txt","../annotation_volumes/allen2022_colours_updated.csv")
"""reformat AllenMouseBrain_atlas_CCF_2017.label"""
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment