Morphology repositories#
Morphology repositories (MRs) are an interface of the storage
module and can be
supported by the Engine
so that morphologies can be stored
inside the network storage.
To access an MR, a Storage
object is required:
from bsb.storage import Storage
store = Storage("hdf5", "morphologies.hdf5")
mr = store.morphologies
print(mr.all())
Similarly, the built-in MR of a network is accessible as network.morphologies
:
from bsb.core import from_storage
network = from_hdf("my_existing_model.hdf5")
mr = network.morphologies
You can use the save()
method to store
Morphologies
. If you don’t immediately need the whole
morphology, you can preload()
it,
otherwise you can load the entire thing with
load()
.
- class bsb.storage.interfaces.MorphologyRepository(engine)[source]
- abstract all()[source]
Fetch all of the stored morphologies.
- Returns:
List of the stored morphologies.
- Return type:
List[StoredMorphology]
- abstract get_all_meta()[source]
Get the metadata of all stored morphologies. :returns: Metadata dictionary :rtype: dict
- abstract get_meta(name)[source]
Get the metadata of a stored morphology.
- abstract has(name)[source]
Check whether a morphology under the given name exists
- import_arb(arbor_morpho, labels, name, overwrite=False, centering=True)[source]
Import and store an Arbor morphology object as a morphology in the repository.
- Parameters:
arbor_morpho (arbor.morphology) – Arbor morphology.
name (str) – Key to store the morphology under.
overwrite (bool) – Overwrite any stored morphology that already exists under that name
centering (bool) – Whether the morphology should be centered on the geometric mean of the morphology roots. Usually the soma.
- Returns:
The stored morphology
- Return type:
- import_file(file, name=None, overwrite=False)[source]
Import and store file contents as a morphology in the repository.
- Parameters:
- Returns:
The stored morphology
- Return type:
- import_swc(file, name=None, overwrite=False)[source]
Import and store .swc file contents as a morphology in the repository.
- Parameters:
- Returns:
The stored morphology
- Return type:
- list()[source]
List all the names of the morphologies in the repository.
- abstract load(name)[source]
Load a stored morphology as a constructed morphology object.
- Parameters:
name (str) – Key of the stored morphology.
- Returns:
A morphology
- Return type:
- abstract preload(name)[source]
Load a stored morphology as a morphology loader.
- Parameters:
name (str) – Key of the stored morphology.
- Returns:
The stored morphology
- Return type:
- abstract save(name, morphology, overwrite=False)[source]
Store a morphology
- Parameters:
name (str) – Key to store the morphology under.
morphology (bsb.morphologies.Morphology) – Morphology to store
overwrite (bool) – Overwrite any stored morphology that already exists under that name
- Returns:
The stored morphology
- Return type:
- abstract select(*selectors)[source]
Select stored morphologies.
- Parameters:
selectors (List[bsb.morphologies.selector.MorphologySelector]) – Any number of morphology selectors.
- Returns:
All stored morphologies that match at least one selector.
- Return type:
List[StoredMorphology]
- abstract set_all_meta(all_meta)[source]
Set the metadata of all stored morphologies. :param all_meta: Metadata dictionary. :type all_meta: dict