Skip to content

Image Stack Loader Protocol

Source

Protocol and types for loading image stacks from data sources.

ImageStackLoader

Bases: Protocol[P, GenericImageStack]

Protocol to define how ImageStacks are loaded from a source.

An ImageStackLoader is a callable that must take the source of the data as the first argument, and the data axes as the second argument.

Additional *args and **kwargs are allowed, but they should only be used to determine how the data is loaded, not what data is loaded. The source argument has to wholly determine what data is loaded, this is because, downstream, both an input-source and a target-source have to be specified but they will share *args and **kwargs.

An ImageStackLoader must return a sequence of the ImageStack class. This could be a sequence of one of the existing concrete implementations, such as ZarrImageStack, or a custom user defined ImageStack.

__call__(source, axes, *args, **kwargs)

Load ImageStacks from a source.

Parameters:

  • source (Any) –

    Data source (paths, store, etc.).

  • axes (str) –

    Axis order (e.g. "SYX", "SCZYX").

  • *args (args, default: () ) –

    Additional positional arguments for loading.

  • **kwargs (kwargs, default: {} ) –

    Additional keyword arguments for loading.

Returns:

  • Sequence[GenericImageStack]

    The loaded ImageStacks.