dbbs-lab / bsb-core

The Brain Scaffold Builder
https://bsb.readthedocs.io
GNU General Public License v3.0
21 stars 16 forks source link

Morphology parsing configuration extension #786

Closed Helveg closed 8 months ago

Helveg commented 9 months ago

In order to deal with the wildly different conventions on SWC processing, the MorphologyDependencyNode should accept a new parser node where you can configure the parser and conventions you'd like to use. The morpho dep node should call self.parser.parse(source_ref).

On top of that, morpho pipelines should be able to accept a sources list to process multiple morphologies without repetition of the pipeline.

The data pipelines should be extended so that generically it uses load_objects rather than load_object, and so that load_object becomes a wrapper for [load_object()] and 1 job per loaded object is started.

Helveg commented 9 months ago

Proposed parsers:

BsbParser

Uses bsb.morphologies code to parse things. With @danilobenozzo's work we can include a skip_boundary option str | list[str] with str skipping any boundary that includes the label(s). This would be a temporary parser until the MorphioParser with morphio addresses https://github.com/BlueBrain/MorphIO/issues/469.

MorphioParser

Uses morphio to parse things. We can support all of their opening flags like options: [SOMA_SPHERE, NO_DUPLICATES]

Import3dParser (in bsb-neuron)

Uses NEURON's Import3D mechanism to parse the morphology. Use the extension or a format override.

ArborParser (in bsb-arbor)

Uses Arbor's parser. We should support its load_swc_neuron and load_swc_arbor. Use the extension or a format override.

Instead of keeping a lot of parsing code around in bsb.morphologies we could then provide a singular parse_morphology(*sources, **kwargs) where the kwargs are used to construct the MorphologyParser, and then we call its parse function.