measurments of area by section

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
fabien tell
Posts: 45
Joined: Mon Mar 25, 2013 1:36 pm
Location: france
Contact:

measurments of area by section

Post by fabien tell » Fri Nov 15, 2019 8:55 am

Hello,

I'm trying to obtain the surface of the different compartments.
I understood that to obtain it for a section I should write

Code: Select all

 totalarea_soma = 0
soma for (x,0) totalarea_soma += area(x) # take into account the number of nseg
or for the all neuron

Code: Select all

totalarea_neuron  = 0
all for (x,0) totalarea_neuron += area(x) # take into account the number of nseg
But is it possible l to obtain it for a subsets such as this one :

Code: Select all


all_ABD = new SectionList()
    ABD all_ABD.append()
    axonstart all_ABD.append()
    for i=0, 1 axoD[i] all_ABD.append()
    for i=0, 1 axoD_sec[i] all_ABD.append()
by typing

Code: Select all

totalarea_allABD  = 0
all_ABD for (x,0) totalarea_allABD += area(x)
Thanks

Fabien

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

Re: measurments of area by section

Post by ted » Sun Nov 17, 2019 2:49 pm

I'm trying to obtain the surface of the different compartments.
I understood that to obtain it for a section I should write

Code: Select all

 totalarea_soma = 0
soma for (x,0) totalarea_soma += area(x) # take into account the number of nseg
True.
soma for (x,0) statement
is equivalent to the following pseudocode:

Code: Select all

for each segment in soma
  do whatever statement says
In your particular case, statement is a function that returns the value of the segment whose center is located at x.

Comment for readers who may be unfamiliar with iteration: this is an example of iteration. In particular, it is iterating over all the segments in soma in order to calculate the total surface area of soma. Translating from geekspeak to english, iteration is a process in which you start with a collection of things that we'll call S, and you do this:

Code: Select all

for each thing in S
  do some task p
for the all neuron

Code: Select all

totalarea_neuron  = 0
all for (x,0) totalarea_neuron += area(x) # take into account the number of nseg
Not quite. You meant this example to do the following

Code: Select all

for each section
  for each segment in the current section
    add the area of this segment to totalarea_neuron
But what will it actually do? See what happens if you execute the following example:

Code: Select all

create soma, dend
dend.nseg = 3
all for (x,0) print secname(), " ", x
If you're right, then this example should print

soma 0.5
dend 0.16666667
dend 0.5
dend 0.83333333

but it won't. Why? Because there's nothing that tells NEURON to iterate over all of the sections. You can fix this by changing "all" to "forall", because forall iterates over all sections that exist.
But is it possible l to obtain it for a subsets
Yes, as long as your code iterates over the sections that belong to a subset. In your third example, everything is OK until this statement

all_ABD for (x,0) totalarea_allABD += area(x)[/code]

which fails because there is nothing to tell NEURON to iterate over the sections that belong to the section list all_ABD. To fix this, change all_ABD to forsec all_ABD.

And be sure to read the Programmer's Reference entries on forall and forsec.

fabien tell
Posts: 45
Joined: Mon Mar 25, 2013 1:36 pm
Location: france
Contact:

Re: measurments of area by section

Post by fabien tell » Mon Nov 18, 2019 7:22 am

Dear TED,

Thanks a lot for your prompt answer.

Regards

Fabien

Post Reply