Skip to content

Commit

Permalink
Allow using lists of kwargs in morph_stats features (#1021)
Browse files Browse the repository at this point in the history
Makes possible to specify a list of kwargs in morph-stats to execute the same feature
multiple times with different parameters.
  • Loading branch information
eleftherioszisis committed Apr 13, 2022
1 parent f4cb039 commit 1ecce98
Show file tree
Hide file tree
Showing 4 changed files with 543 additions and 93 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog
Version 3.2.0
-------------

- List of multiple kwargs configurations are now allowed in``neurom.apps.morph_stats``.
- ``neurom.features.neurite.principal_direction_extents`` directions correspond to extents
ordered in a descending order.
- Add features ``neurom.features.morphology.(aspect_ration, circularity, shape_factor)```
Expand Down
67 changes: 63 additions & 4 deletions doc/source/morph_stats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Short format (prior version 3.0.0)
An example config:

.. code-block:: yaml
neurite:
section_lengths:
- max
Expand All @@ -67,13 +67,13 @@ An example config:
- total
section_branch_orders:
- max
neurite_type:
- AXON
- APICAL_DENDRITE
- BASAL_DENDRITE
- ALL
neuron:
soma_radius:
- mean
Expand All @@ -93,7 +93,7 @@ function, 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. It applies only to ``neurite`` features. A sample output using the above
configuration:
Expand Down Expand Up @@ -198,6 +198,65 @@ So the example config from `Short format (prior version 3.0.0)`_ looks:
- mean
List of features format (starting version 3.2.0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The kwargs entry was converted into a list to allow running the same feature with different arguments. The ``partition_asymmetry`` feature in the example above can be specified multiple times with different arguments as follows:

.. code-block:: yaml
neurite:
partition_asymmetry:
kwargs:
- method: petilla
variant: length
- method: uylings
variant: branch-order
modes:
- max
- sum
To allow differentiation between the feature multiples, the keys and values of the kwargs are appended at the end of the feature name:

.. code-block::
partition_asymmetry__variant:length__method:petilla
partition_asymmetry__variant:branch-order__method:uylings
The example config from `Short format (prior version 3.0.0)`_ becomes:

.. code-block:: yaml
neurite:
section_branch_orders:
kwargs:
- {}
modes:
- max
section_lengths:
kwargs:
- {}
modes:
- max
- sum
section_volumes:
kwargs:
- {}
modes:
- sum
morphology:
soma_radius:
kwargs:
- {}
modes:
- mean
neurite_type:
- AXON
- APICAL_DENDRITE
- BASAL_DENDRITE
- ALL
Features
--------

Expand Down

0 comments on commit 1ecce98

Please sign in to comment.