Cell Volume from Reconstruction SWC File

I am trying to get each neurons’ cell volume from the cell type morphology dataset. For individual cells, I can get the reconstruction SWC files. In python, if I use the total_volume function from neuron_morphology.features.size, it gives me a number for each neuron. Is this number representative of the actual biological size of that neuron (in μm^3)?

I am asking especially since the number calculated by neuron_morphology seems to correlate with but not equal to volume calculated by L-Measure for the same SWC file (I use the python implementation pylmeasure and its function getOneMeasure).

For example, here are the volume I got from the SWC files of three cells from Allen:
Cell_ID Volume(neuron_morphology) Volume(L-Measure)
555241040 3149.566951 3420.16
530737765 3417.700939 3060.25
584872371 1615.318717 1649.62

To answer your first question, yes, the total_volume function is giving a number that is a calculation of the actual volume of the reconstruction in the SWC file.

The difference between L-Measure and neuron_morphology is that they are using different models of what the SWC file represents. As mentioned in the docstring of Morphology.get_compartment_volume, neuron_morphology assumes that each compartment is a conic frustrum, so it can grow or taper depending on the size of the endpoints.

On the other hand, L-Measure assumes that each compartment is a cylinder, with the radius defined by the endpoint.

If you have an extremely simple SWC file, you can test this and see that you get different answers. If we just have a two-node SWC file:

1 3 0 0 0 1 -1
2 3 1 0 0 2 1

and calculate the volume using the two methods, you get 7.33 from neuron_morphology and 12.57 from L-Measure, because L-Measure doesn’t care that the initial point has a smaller diameter than the end point.

If you modify the SWC file by making the first point have a much larger diameter:

1 3 0 0 0 10 -1
2 3 1 0 0 2 1

you now get 129.85 from neuron_morphology but still get 12.57 from L-measure.

So you would expect values that are close but not exactly the same between the two methods, depending on how the diameters of compartments are changing throughout the cell.

1 Like

That makes a lot of sense and exactly answers my question! Thank you!