morph_stats: morphometric statistics extraction

The neurom stats application extracts morphometrics from a set of neuron morphology files and produces a summary in JSON or CSV format. It may obtain any of the morphometrics available in the neurom.get() function, and is highly configurable, allowing the user to get raw or summary statistics from a large set of neurite and neuron features.

An example usage:

neurom stats path/to/morph/file_or_dir --config path/to/config --output path/to/output/file

The functionality can be best explained by looking at a sample configuration file that is supposed to go under --config option:

neurite:
    section_lengths:
        - max
        - total
    section_volumes:
        - total
    section_branch_orders:
        - max

neurite_type:
    - AXON
    - APICAL_DENDRITE
    - BASAL_DENDRITE
    - ALL

neuron:
    soma_radii:
        - mean

Here, there are two feature categories,

  1. neurite: these are morphometrics obtained from neurites, e.g. branch orders, section lengths, bifurcation angles, path lengths.

  2. neuron: these are morphometrics that can be applied to a whole neuron, e.g. the soma radius, the trunk radii, etc.

Each category sub-item (section_lengths, soma_radii, etc) corresponds to a neurom.get() feature, and each one of its sub-items corresponds to a statistic, e.g.

  • raw: array of raw values

  • max, min, mean, median, std: self-explanatory.

  • total: sum of the raw values

An additional field neurite_type specifies the neurite types into which the morphometrics are to be split. This is a sample output using the above configuration:

{
  "some/path/morph.swc":{
    "mean_soma_radius":0.17071067811865476,
    "axon":{
      "total_section_length":207.87975220908129,
      "max_section_length":11.018460736176685,
      "max_section_branch_order":10,
      "total_section_volume":276.73857657289523
    },
    "all":{
      "total_section_length":840.68521442251949,
      "max_section_length":11.758281556059444,
      "max_section_branch_order":10,
      "total_section_volume":1104.9077419665782
    },
    "apical_dendrite":{
      "total_section_length":214.37304577550353,
      "max_section_length":11.758281556059444,
      "max_section_branch_order":10,
      "total_section_volume":271.9412385728449
    },
    "basal_dendrite":{
      "total_section_length":418.43241643793476,
      "max_section_length":11.652508126101711,
      "max_section_branch_order":10,
      "total_section_volume":556.22792682083821
    }
  }
}

For more information on the application and available options, invoke it with the --help or -h option.

neurom stats --help
neurom --help  # to see all logging options

Features

To see all available features for --config:

$ neurom features
Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/neurom/envs/v2.0.2/lib/python3.7/site-packages/neurom/view/plotly.py", line 8, in <module>
    import plotly.graph_objs as go
ModuleNotFoundError: No module named 'plotly'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/neurom/envs/v2.0.2/bin/neurom", line 5, in <module>
    from neurom.apps.cli import cli
  File "/home/docs/checkouts/readthedocs.org/user_builds/neurom/envs/v2.0.2/lib/python3.7/site-packages/neurom/apps/cli.py", line 38, in <module>
    from neurom.view.plotly import draw as plotly_draw
  File "/home/docs/checkouts/readthedocs.org/user_builds/neurom/envs/v2.0.2/lib/python3.7/site-packages/neurom/view/plotly.py", line 13, in <module>
    ) from e
ImportError: neurom[plotly] is not installed. Please install it by doing: pip install neurom[plotly]