Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New feature: percentage of neuronal mass with respect to soma #1022

Closed
lidakanari opened this issue Apr 11, 2022 · 3 comments
Closed

New feature: percentage of neuronal mass with respect to soma #1022

lidakanari opened this issue Apr 11, 2022 · 3 comments
Assignees

Comments

@lidakanari
Copy link
Contributor

We need a feature to measure the percentage of mass "above" and "below" the soma. The direction is determined based on the selected axis (default='Y').

A draft for this feature can be found here:

from neurom.core.morphology import iter_neurites
from neurom.core.types import tree_type_checker as is_type
from neurom.features import section as sf


def get_mass_above_soma(neuron, neurite_type, axis='Y'):
    """Computes the percentage of points above / below the soma
       with respect to the selected axis.
    """
    col = getattr(neurom.COLS, axis)

    points = list(
            iter_neurites(neuron, mapfun=sf.section_points, filt=is_type(neurite_type))
        )
    point_sel = np.vstack(points)[:, col]
    soma_center = neuron.soma.center
    return 100 * np.count_nonzero(point_sel > soma_center[col]) / len(point_sel)

Example values for a test neuron

neuron = neurom.load_morphology('./tests/data/neurolucida/bio_neuron-000.asc')

get_mass_above_soma(neuron, neurite_type=neurom.AXON, axis='Y') == 73.25581395348837
get_mass_above_soma(neuron, neurite_type=neurom.AXON, axis='X') == 56.60377358490566
get_mass_above_soma(neuron, neurite_type=neurom.AXON, axis='Z') == 26.39315489249671

get_mass_above_soma(neuron, neurite_type=neurom.BASAL_DENDRITE, axis='Z') == 48.285198555956676
get_mass_above_soma(neuron, neurite_type=neurom.BASAL_DENDRITE, axis='X') == 50.90252707581227
get_mass_above_soma(neuron, neurite_type=neurom.BASAL_DENDRITE, axis='Y') == 62.99638989169675
@adrien-berchet
Copy link
Member

If you want to estimate the mass, shouldn't you sum up the lengths (volumes would be even better) of the segments above or below the soma? The number of points is a good approximation only if the morphology was resampled before calling this function.

@lidakanari
Copy link
Contributor Author

Yes, you are right @adrien-berchet, computing the length percentages would actually be better. @eleftherioszisis can you easily implement this with lengths?

@lidakanari
Copy link
Contributor Author

One more comment, I'm not sure if this should be 100% maybe just leave the value without the 100. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants