Differences in area calculations

When Python is the interpreter, what is a good
design for the interface to the basic NEURON
concepts.

Moderator: hines

Post Reply
vellamike

Differences in area calculations

Post by vellamike » Fri Sep 30, 2011 9:21 am

I am finding that NEURON consistently over-estimates the area of morphologies which I convert from swc files to hoc files. This could be because I am calculating the area in the wrong way, or something more fundamental. I have recreated the following issue on a number of morphologies and I am describing an example of the issue:

I got the swc file located here: http://neuromorpho.org/neuroMorpho/neur ... 0-L3pyr-75 and converted it to a hoc file as described in this post: http://www.neuron.yale.edu/phpBB/viewto ... f=2&t=2399

I then measured the area of the hoc file in NEURON like this:

Code: Select all

from neuron import h
h.load_file('area_experiment.hoc')


def section_area(section):
    
    x_list = []
    a = 0
    
    for seg in section:
        x = seg.x
        x_list.append(x)
    
    for x in x_list:
        a += h.area(x, sec=section)
    return a


area=0
for sec in h.allsec():
    area+=section_area(sec)
print area
This code is reporting an area of 13377.3181486 μm^2 whereas software like L-Measure or Neuromantic (and the author if this particular morphology) report 12958.2 μm^2. I wonder if we could clarify what's going on?

You can find the relevant files (original swc, python code and my hoc conversion here: http://www.srcf.ucam.org/~mv333/temp/)

Thanks in advance,
Mike

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

Re: Differences in area calculations

Post by ted » Fri Sep 30, 2011 11:10 am

I am finding that NEURON consistently over-estimates the area of morphologies which I convert from swc files to hoc files. This could be because I am calculating the area in the wrong way
If you're not sure, what is the basis of the strong assertion that "NEURON consistently over-estimates . . . "?

You may notice that I have changed the "Subject" of this thread from
"NEURON over-estimating area"
to
"Differences in area calculations"
The result you presented establishes only that different software reports different computed surface areas for a given morphometric data file. It does not establish that either one overestimated or underestimated anything. Indeed, there is good reason to believe that all software underestimates actual cell surface area (more about this below).

If different software reports different surface areas for the same cell, it would be good to know if and how the differences might be attributed to methodological differences in the algorithms they use. So the key question is: how do these different tools compute area?
Do they assume that each xyzdiam measurement specifies a diameter of a cylindrical segment, or a base of a frustum? Do they include the area of the end faces? How do they treat the area of the soma itself?

Have you tried them on test objects that have known area?
You might try the following:

Code: Select all

cylinder   diam = constant
frustum    diam = a + b*x  where x is distance from 0 end
sphere     diam = sqrt(r^2 - (x-0.5*r)^2)  where x is distance from 0 end
For the latter two, make sure that your sequence of xyzdiam values is sufficiently large. NEURON will give the correct result for the frustum even if you specify just the pt3d points at the 0 and 1 end, but accuracy for the sphere will depend on the number of measurements, and their spacing, along a diameter. Your findings will be of interest.

Answers to the first four questions above with regard to NEURON:
For sections defined by pt3d data, each adjacent pair of measurements is treated as a frustum. Total area of the segment is the sum of the circumferential areas of these frusta. End face areas are omitted.
Soma surface area presents a special problem because there is no uniformity across labs with regard to how the soma is measured. Examples of strategies that have been used:
--approximate (by eye) the whole thing by a sphere ("beach ball" strategy)
--make a series of xyzdiam measurements along the estimated centroid of the soma ("stack of tuna cans," or more descriptively from the NEURON perspective, "stack of frusta" strategy)
--trace out a single outline of the perimeter of the cell in a single plane of focus ("belt" or "necklace" strategy)
--trace a set of perimeter outlines, one per focus plane, for multiple planes of focus ("stack of pancakes" strategy)
The Import3D tool tries to guess which strategy was used and deals with the data appropriately in most cases, although cases arise from time to time that require special attention. That said, in cells that have large dendritic fields, soma surface area is only a _tiny_ fraction of total cell area, so "eyeballing" an approximate soma diameter may not be all that bad.

A final footnote: at some point this can become a lot of straining at gnats while ignoring the elephants that pack the room. There are many reasons to be suspicious of morphometric data, and estimates of neurite length or surface area derived from such measurements. Some are:
* Amputated neurites.
* Incomplete fills.
* Inadequate staining (reduces ability to see, let alone measure, fine neurites).
* Errors in reconstruction (orphan neurites or subtrees, attachment to incorrect parent neurite).
* Tissue shrinkage (usually not quantified, but generally anisotropic and on the order of 5-10 by linear measure).
* Light scatter and diffraction limit issues that reduce accuracy of diameter measurements (in most cells of interest, most dendritic surface area is in neurites with diameter <= 1um, and resolution is seldom as good as 0.2 um, so diameter error of fine neurites is on the order of 20% or worse!).
* In models, neurite cross sections are almost always assumed to be cylindrical, but electron microscopy long ago revealed that surfaces are highly irregular so that cross sections are not only not cylindrical but may even be concave-convex.
* Spines may add a significant amount of surface area (50-100% increase beyond value computed from raw diameter measurement), but spines are almost never included in morphometric data files. Besides, they're: too small for accurate measurement of neck diameter & length, or head diameter; and many of them stick out at angles from the dendritic shaft that would make neck length impossible to determine anyway, many are hidden behind the dendritic shaft where they can't be seen.

Because of amputations, incomplete fills, surface and cross section irregularity, omission of spines, and often uncorrected tissue shrinkage, it seems highly likely that estimates of cell surface area based on morphometric data obtained with light microscopy will underestimate actual cell surface area in most cases, and by a large factor.

Post Reply