-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwriteGeometry.hoc
138 lines (125 loc) · 3.41 KB
/
writeGeometry.hoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
// write geometry
strdef geom_file, CA1geometry
objref runfile
PN = proximal_indices.size()
MN = middle_indices.size()
DN = distal_indices.size()
objref header
header = new Vector()
objref soma_3d, prox_3d, midd_3d, dist_3d, morpho
soma_3d = new Vector()
prox_3d = new Vector()
midd_3d = new Vector()
dist_3d = new Vector()
morpho = new Vector()
i = 0
k = -1
forsec somatic{
k = -1
for j=0, n3d()-1{
// Marker for python to know how to connect sections
soma_3d.append(k)
// assign new index for python 3d info (soma index = 0)
soma_3d.append(i)
// include NEURON's section number (soma == 0 )
soma_3d.append(999)
// write spatial information for each segment in the section
soma_3d.append(x3d(j))
soma_3d.append(y3d(j))
soma_3d.append(z3d(j))
soma_3d.append(diam3d(j))
// increase counter for connection info
k = k + 1
soma_3d.append(k)
}
i = i + 1
}
i = 1
forsec proximal{
l = -1
for j=0, n3d()-1{
// Marker for python to know how to connect sections
prox_3d.append(l)
// assign new index for python 3d info (proximal indices 1 - 18)
prox_3d.append(i)
// include NEURON's section numbers for dend[x] in sectionList proximal
prox_3d.append(proximal_indices.x(i-1))
// write spatial information for each segment in the section
prox_3d.append(x3d(j))
prox_3d.append(y3d(j))
prox_3d.append(z3d(j))
prox_3d.append(diam3d(j))
l = l + 1
prox_3d.append(l)
}
i = i + 1
}
i = PN + 1
forsec middle{
m = -1
for j=0, n3d()-1{
// Marker for python to know how to connect sections
midd_3d.append(m)
// assign new index for python 3d info (middle indices = 19 - 122)
midd_3d.append(i)
// include NEURON's section numbers for dend[x] in sectionList middle
midd_3d.append(middle_indices.x(i-(PN+1)))
// write spatial information for each segment in the section
midd_3d.append(x3d(j))
midd_3d.append(y3d(j))
midd_3d.append(z3d(j))
midd_3d.append(diam3d(j))
// increase counter for connection info
m = m + 1
midd_3d.append(m)
}
i = i + 1
}
i = PN+MN + 1
forsec distal{
n = -1
for j=0, n3d()-1{
// Marker for python to know how to connect sections
dist_3d.append(n)
// assign new index for python 3d info (distal indices = 123 - 180)
dist_3d.append(i)
// include NEURON's section numbers for dend[x] in sectionList distal
dist_3d.append(distal_indices.x(i-(PN+MN+1)))
// write spatial information for each segment in the section
dist_3d.append(x3d(j))
dist_3d.append(y3d(j))
dist_3d.append(z3d(j))
dist_3d.append(diam3d(j))
// increase counter for connection info
n = n + 1
dist_3d.append(n)
}
i = i + 1
}
morpho.resize(0)
for i = 0, soma_3d.size()-1{
morpho.append(soma_3d.x(i))
}
for i = 0, prox_3d.size()-1{
morpho.append(prox_3d.x(i))
}
for i = 0, midd_3d.size()-1{
morpho.append(midd_3d.x(i))
}
for i = 0, dist_3d.size()-1{
morpho.append(dist_3d.x(i))
}
header.resize(0)
header.append(1) // number of items in sectionlist 'somatic'
header.append(PN)// number of items in sectionlist 'proximal'
header.append(MN)// number of items in sectionlist 'middle'
header.append(DN)// number of items in sectionlist 'distal'
header.append(morpho.size())
runfile = new File() // ask on forum about this
sprint(geom_file,"./CA1geometry.dat") // ask on forum about this
runfile.wopen(geom_file) // ask on forum about this
runfile.seek(0)
header.vwrite(runfile)
morpho.vwrite(runfile)
print "geometry written to file ", geom_file
runfile.close()