An example. Lets say I have a morphology with a soma.
Code: Select all
# index type X Y Z radius parent
1 1 0.000000 0.000000 0.000000 5.442800 -1
2 2 0.292800 -4.265800 -5.562200 0.325200 1
3 2 0.654500 -5.303200 -5.692400 0.359400 2
...
Code: Select all
h_section = soma
for ipt in range(h_section.n3d()):
x = h_section.x3d(ipt)
y = h_section.y3d(ipt)
z = h_section.z3d(ipt)
points.append([x, y, z])
# points
# [[-5.442800045013428, 0.0, 0.0], [0.0, 0.0, 0.0], [5.442800045013428, 0.0, 0.0]]
So, the updated morphology now starts as:
Code: Select all
# index type X Y Z radius parent
1 1 -5.442800 0.000000 0.000000 5.442800 -1
2 1 0.000000 0.000000 0.000000 5.442800 1
3 1 5.442800 0.000000 0.000000 5.442800 2
4 2 0.292800 -4.265800 -5.562200 0.325200 1
5 2 0.654500 -5.303200 -5.692400 0.359400 4
...
Code: Select all
[[-10.885600090026855, 0.0, 0.0], [-5.442800045013428, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [5.442800045013428, 0.0, 0.0]]
Cell_472363762[0].soma[0] is composed of first 3 points: [[-10.885600090026855, 0.0, 0.0], [-5.442800045013428, 0.0, 0.0], [0.0, 0.0, 0.0]]
Cell_472363762[0].soma[1] is composed of last 2 points: [0.0, 0.0, 0.0], [5.442800045013428, 0.0, 0.0]
Can you please help me to understand the logic of this transformation? I can understand why single point goes to cylinder but the second transformation from 3 points to 5 points is difficult for me.
I use this method to load a morphology:
Code: Select all
proc load_morphology(/* morphology_dir, morphology_name */) {localobj morph, import, sf, extension
strdef morph_path
sprint(morph_path, "%s/%s", $s1, $s2)
sf = new StringFunctions()
extension = new String()
sscanf(morph_path, "%s", extension.s)
sf.right(extension.s, sf.len(extension.s)-4)
morph = new Import3d_SWC_read()
morph.quiet = 1
morph.input(morph_path)
import = new Import3d_GUI(morph, 0)
import.instantiate(this)
}