Spherical cell using pt3dadd

Managing anatomically complex model cells with the CellBuilder. Importing morphometric data with NEURON's Import3D tool or Robert Cannon's CVAPP. Where to find detailed morphometric data.
Post Reply
karthik1024

Spherical cell using pt3dadd

Post by karthik1024 »

Hi,

I am trying to model extracellular fields on truly spherical cells. I used to following simple code

Code: Select all

 

create a
access a
Ra=100
nseg = 10
pt3dclear()
pt3dadd(-Ra, 0, 0, 1)
for i=1,29 {
	x = -Ra + 2*Ra*i/30
	pt3dadd(x, 0, 0, 2*sqrt(Ra^2 - x^2) )
}
pt3dadd(Ra, 0, 0, 1)
objref s
s = new Shape()
s.show(0)
print L

When I run it, it shows a solid circle on the screen. When i 3D rotate it about the X axis it remains a circle, but when I rotate it about Y, it turns into a progressively flatter ellipse and eventually into a thin line at 90 degree rotation. A sphere should remain the same no matter in what direction I look. Am I missing something here ?

Thanks for your time.
Karthik
Raj
Posts: 220
Joined: Thu Jun 09, 2005 1:09 pm
Location: Groningen, The Netherlands
Contact:

Post by Raj »

Except from some serious errors against good coding style, there are few reasons to anticipate that your code would not work. You should not use Ra as a variable because it is predefined as the axial resistance. Furthermore you are trying to set the diameter at finer resolution then nseg, although this is allowed and NEURON will average the quantities involved it will make your cell look more spherical then it actually is.

I tried avoiding pt3dadd and use diam instead and obtained the same (incorrect) result when viewing the cell's shape, see code:

Code: Select all

create cellbody
access cellbody
Radius=100
L=2*Radius
NoOfSeg=33
nseg = NoOfSeg

for i=0,NoOfSeg-1 {
   x = -Radius + 2*Radius*(i+1/2)/NoOfSeg
   diam((i+1/2)/NoOfSeg)= 2*sqrt(Radius^2 - x^2) 
}

objref s
s = new Shape()
s.show(0)
print L
Last edited by Raj on Wed May 10, 2006 3:07 am, edited 2 times in total.
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

That's odd indeed. Looking down the z or y axis, you see a circle, but looking down the
x axis it's only a dot, and rotating that just slightly turns it into a thin ellipse. A bug in
the rendering of shape plots?

As to what you may be missing, there are three or four items, but the appearance of
the model on the monitor isn't one of them.
First the trivial: Ra is a reserved keyword. It means cytoplasmic resistivity. You'll have to
use something else for radius.
Second, in a real sphere, current can flow along any chord whatsoever. In a NEURON
model, all cytoplasmic current flow is axial, i.e. only along one diameter (the centroid of
the model).
Third, an extracellular field may affect the local membrane potential on a spherical
cell, but it will only affect the membrane potential of a NEURON model if the field has
a component that lies parallel to the centroid of the model.
Fourth, a spherical cell with uniform membrane properties produces no extracellular
field whatsoever.
karthik1024

Post by karthik1024 »

Thanks for going through the post. I copied the example as found in the online documentation for specifying cell geometry. The relevant file is http://www.neuron.yale.edu/neuron/stati ... n/cone.hoc . If Ra is predefined then probably it is a good idea to change the example program to reflect this.

3D rotating in the example program seems to work fine btw.

Karthik
karthik1024

Post by karthik1024 »

Third, an extracellular field may affect the local membrane potential on a spherical
cell, but it will only affect the membrane potential of a NEURON model if the field has
a component that lies parallel to the centroid of the model
I am using the extracellular mechanism in addition to the xtra mechanism using a modified version of the program posted earlier by Ted in this forum https://www.neuron.yale.edu/phpBB2/view ... racellular I fix the voltage e_extracellular based on the distance of a segment from the extracellular stimulation electrode. So, as long as I confine myself to field geometries (hence electrode placement) which are symmetric with respect to the centriod of the sphere I am safe.
Fourth, a spherical cell with uniform membrane properties produces no extracellular field whatsoever.
Since I am not interested in looking at extracellular recording, I don't think this affects me.

Thanks,
Karthik
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

karthik1024 wrote:If Ra is predefined then probably it is a good idea to change the example program to reflect this.
Ra is not predefined. It is a keyword, which means only that it has a specific meaning
and should not be usurped for some other purpose. The example you cite in the
Programmer's Reference uses Ra correctly. Here is the code to which you refer:

Code: Select all

forall delete_section()
//@code
create a
access a
Ra=100
nseg = 10
pt3dclear()
for i=0,30 {
        x = PI*i/30
        pt3dadd(200*sin(x), 200*cos(x), 0, 100*sin(4*x))
}
objref s
s = new Shape()
s.show(0)
print L
for (x) print x, diam(x), area(x), PI*diam(x)*L/nseg, ri(x), .01*Ra*(L/2/nseg)/(PI*(diam(x)/2)^2)
This usage of Ra is perfectly correct--it refers to specific resistivity of the cytoplasm.
Your own code used Ra to refer to radius, a usage that could easily lead to a mismatch
between your conceptual model (what you think is in the computer) and the
computational model (what is actually in the computer).
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

karthik1024 wrote:[So, as long as I confine myself to field geometries (hence electrode placement) which are symmetric with respect to the centriod of the sphere I am safe.
At the risk of seeming pedantic, and mostly for the potential benefit of others who may read
these exchanges, could you be more explicit about what you mean by "symmetric with
respect to the centroid"? These wretched cartoons crudely represent the outline of a
spherical section with a hexagon, the line ___c___ represents its centroid, and e1 and e2
are extracellular electrodes that are placed symmetrically with respect to the centroid.
The extracellular field will affect the membrane potential of the model cell in Case 1
but not in Case 2. The Case 1 result corresponds to what would happen to a physical
system.

Code: Select all

Case 1.
|    _____    |
|   /     \   |
|  /___c___\  |
|  \       /  |
|   \_____/   |
|             |
e1            e2

Case 2.
_____________e1
    _____
   /     \
  /___c___\
  \       /
   \_____/
_____________e2
karthik1024

Post by karthik1024 »

Thanks for pointing out the silly error ... my bad.

What I said about the extracellular electrode needs to be read in context of the xtra mechanism which was posted earlier in this forum here https://www.neuron.yale.edu/phpBB2/view ... racellular

In the above mentioned program, potentials at different sections (and segments) are calculated based on the effective resistance (transfer resistance) of that section from the electrode. As long as we are using spherical electrodes calculation of transfer resistance is easy and the xtra mechanism can be used unmodified. However, if we are using cylindrical pippets as electrodes, calculating resistance is a bit more tricky. One method to overcome this problem is to find as expression for the potential V(r,z) (in cylindrical coordinates) for the pippet (cylindrcal) electrode in terms of the applied potential and use the xtra mechanism to assign the values of e_extracellular based on distances of various segments from the electrode. Here the input to the program is voltage rather than current since the relation between current and voltage is related by the resistance which in such a geometry is hard to obtain for any abritrary point.

With that intro, if I am using a cylindrical electrode then the potential distribution is symmetric about the azimuthal angle and the following orientation of assigning e_extracellular using xtra mechanism would work

Code: Select all

                    | | |  
                  | | | | | 
   -----|       | | | | | | |            |--------
                  | | | | |
                    | | | 
On the right is the cylindrical electrode and on the left is a crude shperical cell. The vertical (broken) lines show how our sections are defined using 3D point as a series of cylinders (or frusta) stacked next to each other. In this configuration one can still define e_extracellular at each section since the potential distribution is symmetric, but for the orientation shown below we cannot do it, since now the sections are not "symmetric" with respect to electrode for the purposed of calculating potential at the surface.

Code: Select all

        |
        |
        |
       ---


       | | |  
     | | | | | 
   | | | | | | |     
     | | | | |
       | | | 


       ---
        |
        |
        |
Note that this error which I allude to above is reduced if not completely eliminated when we are dealing with large realistic models of neurons where the potential difference across two surfaces of a soma, axon etc is less important than the potential difference existing across the length of an axon or dentrite.

I hope that explains my point in a better fashion.

Karthik
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

As long as we are using spherical electrodes calculation of transfer resistance is easy and the xtra mechanism can be used unmodified. However, if we are using cylindrical pippets as electrodes, calculating resistance is a bit more tricky. One method to overcome this problem is to find as expression for the potential V(r,z) (in cylindrical coordinates) for the pippet (cylindrcal) electrode in terms of the applied potential and use the xtra mechanism to assign the values of e_extracellular based on distances of various segments from the electrode. Here the input to the program is voltage rather than current
For an electrode with simple geometric shape of diameter D, if the distance X from the
electrode is large compared to D (i.e. X/D > 10 or so), the field can be approximated quite
closely by that which is produced by the same total current applied to a spherical electrode.

If more precision is necessary, the proper approach is current based, and starts from
the fact that a point source of current I produces a field whose potential is
V = I rho / 4 PI r
where r is the distance from the point and rho is the resistivity of the conductive medium.
If the electrode cannot be approximated by a point source, then we must instead do a
surface integral
V = (rho / 4 PI) INTEGRAL J dS / r
where r is the distance from the location of V in the conductive medium to a point on the
surface of the electrode, J is the current density at that point on the electrode, and dS is
the infinitesimal for area on the electrode.

An equivalent approach is to convolve the potential of a point source with the geometry
of the electrode and the current density function.
Post Reply