braincell.io.load_neuromorpho

braincell.io.load_neuromorpho#

braincell.io.load_neuromorpho(neuron_id, *, cache_dir=None, mode='neuromorpho', client=None, return_report=False, overwrite=False)[source]#

Fetch a NeuroMorpho.Org neuron and return it as a Morphology.

Downloads the standardized CNG SWC into cache_dir (defaulting to ~/.cache/braincell/neuromorpho) and parses it with Morphology.from_swc() using mode="neuromorpho".

Already-cached neurons are not re-downloaded; pass overwrite=True to force a refresh.

Parameters:
  • neuron_id (int) – NeuroMorpho.Org numeric identifier (e.g. 10047).

  • cache_dir (str | Path | None) – Cache root. None resolves to DEFAULT_USER_CACHE_DIR (~/.cache/braincell/neuromorpho). The directory is created lazily.

  • mode (str | None) – SWC import mode forwarded to Morphology.from_swc(). Defaults to "neuromorpho" (copies soma attachment points into child branches).

  • client (NeuroMorphoClient | None) – Optional pre-configured client.

  • return_report (bool) – If True, also return the SwcReport from parsing.

  • overwrite (bool) – If True, re-download even when the file is already cached.

Returns:

The parsed morphology, optionally with a diagnostic report.

Return type:

Morphology | tuple[Morphology, SwcReport]

Raises:

See also

fetch_neuromorpho

Download files without parsing.

Morphology.from_neuromorpho

Equivalent classmethod entry point.

Morphology.from_swc

Underlying SWC reader.

Examples

>>> from braincell import load_neuromorpho
>>> morph = load_neuromorpho(10047)
>>> morph, report = load_neuromorpho(10047, return_report=True)