## how to display 3d coordinates of a segment

The basics of how to develop, test, and use models.
JohnAnderson
Posts: 8
Joined: Sun Jun 12, 2005 10:41 am
Location: University of North Florida

### how to display 3d coordinates of a segment

I would like to display the three-dimensional coordinates of a position x in a section of a neuron model defined by a pt3d list. The particular model I'm using right now is the layer 2/3 pyramid from Mainen and Sejnowski's patdemo.zip, but I'd like to know how to do it in general. Can x3d, y3d, and z3d be made to do this?

Any help would be appreciated.

Thanks

John Anderson

ted
Posts: 5727
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

### Re: how to display 3d coordinates of a segment

Code: Select all

``secname for i=0,n3d()-1 print i, x3d(i), y3d(i), z3d(i), diam3d(i)``
will print out the xyzdiam data associated with each 3d point that defines the geometry of section secname. Is that what you wanted, or do you want to know the xyz coordinates of segment centers?

JohnAnderson
Posts: 8
Joined: Sun Jun 12, 2005 10:41 am
Location: University of North Florida

### Re: how to display 3d coordinates of a segment

Thanks for the prompt response. I want to know the xyz coordinates of segment centers.

ja

ted
Posts: 5727
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

### Re: how to display 3d coordinates of a segment

the xyz coordinates of segment centers
The meaning of this concept is somewhat ambiguous. A simple operational definition that might be adequate for some applications starts by treating a section as a series of straight line segments whose endpoints are specified by the 3d points. Calculate the "range" (normalized distance from the 0 end) of each of these points. Then the xyz coordinates that correspond to any r in [0,1] can be found by this algorithm:

Code: Select all

``````if r corresponds to the range of any 3d point, return the coordinates of that point
otherwise find the pair of 3d points whose line segment contains r, then apply linear interpolation to determine the xyz coordinates of r``````
For an example implementation of this algorithm, and its use in simulations of extracellular stimulation and recording, see
http://www.neuron.yale.edu/ftp/ted/neur ... nd_rec.zip
The file interpxyz.hoc contains a procedure that finds the coordinates of internal nodes.

JohnAnderson
Posts: 8
Joined: Sun Jun 12, 2005 10:41 am
Location: University of North Florida

### Re: how to display 3d coordinates of a segment

What are the "nodes" referred to in interpxyz.hoc?

ted
Posts: 5727
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

### Re: how to display 3d coordinates of a segment

Points in space at which the system equations are solved. The macroscopic physical world appears to be continuous in both space and time, and is described by partial differential equations. In order to compute an approximate solution to these equations, they are first discretized in space to produce a set of ordinary differential equations. Each ODE governs the time course of a state variable at a particular location (node) in space. The approximate solution is then computed by numerical integration of the ODEs over a sequence of discrete instants in time.

Each section has its own discretization parameter nseg, which is a whole number that specifies how many internal nodes will be used to represent it (imagine chopping the section into nseg pieces or "segments" of equal length, and placing a node at the midpoint of each segment). For more information about nseg please see
http://www.neuron.yale.edu/neuron/stati ... .html#nseg
or read Chapters 4 and 5 of The NEURON Book, or
Hines, M.L. and Carnevale, N.T. The NEURON simulation environment. Neural Computation 9:1179-1209, 1997

So far we have been discussing only the internal nodes, at which numerical integration is performed. In addition there are nodes at the 0 and 1 ends; membrane potential at those locations is calculated by simple algebra from the potentials at adjacent internal nodes and the corresponding axial resistances.

JohnAnderson
Posts: 8
Joined: Sun Jun 12, 2005 10:41 am
Location: University of North Florida

### Re: how to display 3d coordinates of a segment

Ah. So the coordinates of the nodes would be the coordinates of the midpoints of the segments, which is what I want.

Thanks very much for your help. I will try to implement that algorithm in my model.

ja

ahwillia
Posts: 17
Joined: Wed Apr 23, 2014 2:17 pm

### Re: how to display 3d coordinates of a segment

In case anybody is interested, I figured out how you can do this in Python:

Code: Select all

``````from neuron import h

dend1 = h.Section()
dend2 = h.Section()
dend3 = h.Section()

for s in dend1,dend2,dend3:
print '-------------------------------------------'
print 'Printing coordinates for '+ h.secname(sec=s)
print '-------------------------------------------'
n3d = int(h.n3d(sec=s))
if n3d == 0:
print '  * No coordinates found *  '
continue
for i in range(0,n3d):
print '--- i: ' + str(i) + ' ---'
print 'x:  ' + str(h.x3d(i,sec=s))
print 'y:  ' + str(h.y3d(i,sec=s))
print 'z:  ' + str(h.z3d(i,sec=s))
``````
The output is:

Code: Select all

``````-------------------------------------------
Printing coordinates for PySec_0x21aa120
-------------------------------------------
--- i: 0 ---
x:  0.0
y:  0.0
z:  0.0
--- i: 1 ---
x:  1.0
y:  0.0
z:  0.0
-------------------------------------------
Printing coordinates for PySec_0x21aa390
-------------------------------------------
* No coordinates found *
-------------------------------------------
Printing coordinates for PySec_0x21aa3f0
-------------------------------------------
--- i: 0 ---
x:  0.0
y:  0.0
z:  0.0
--- i: 1 ---
x:  0.0
y:  1.0
z:  0.0
``````