assets_specs#

This module contains the specifications for the assets in the pipeline. The specifications are used to create the assets and to determine the file names and locations. The specs passed to the asset are TypeSpec objects and ChannelSpec objects.

TypeSpec

contain the information about the type of asset (i.e. the step in the pipeline, e.g. stitched, layout, cells, density, binary…)

ChannelSpec

contain the information about the channel (i.e. the labeling of the asset, e.g. cfos, dapi, autofluorescence, gfp… and the type of labelling e.g. nuclei, cells, vessels, veins, arteries, axons…).

class ChannelSpec(channel: str | tuple[str, ...], content_type: str, channel_number: int | None = None)[source]#

Bases: object

A specification for a channel. Not a concrete asset. This has all the information for a channel regardless of the type of asset.

name#

The name of the channel. (Typically the name of the labeling, e.g. cfos, dapi, autofluorescence, gfp …) If a tuple, the channel is a composite of the channels in the tuple.

Type:

ChannelId

content_type#

The type of content in the channel. E.g. ‘nuclei’, ‘cells’, ‘vessels’…

Type:

str

number#

The number id of the channel.

Type:

int

classmethod channel_number_to_name(channel_number)[source]#
classmethod from_dict(data)[source]#
has_pipeline()[source]#
is_compound()[source]#
is_simple_channel()[source]#
to_dict()[source]#
channel_names = []#
class StateManager[source]#

Bases: object

A context manager to handle the state (e.g. debug mode). It is multiprocess safe using shared memory for the status.

_status#

The current context keyword.

Type:

str

known_contexts#

The list of known context keywords.

Type:

list[str]

property status#
class SubTypeSpec(**kwargs)[source]#

Bases: TypeSpec

A specification for a subtype of an asset. Not a concrete asset. This has all the information for a substep in the pipeline regardless of the channel.

property main_type#
class TypeSpec(*, resource_type: str | None = None, type_name: str | None = None, sub_types: list[str] | dict | None = None, basename: str = '', sub_folder: str = '', file_format_category: str | None = None, resource_type_to_folder: dict | None = None, relevant_pipelines: list[str] | None = None, compression_algorithms: list[str] | None = None, checksum_algorithm: str | None = None, extensions: list[str] | None = None)[source]#

Bases: object

A specification for a type of asset. Not a concrete asset. This has all the information for a step in the pipeline regardless of the channel.

classmethod from_dict(data)[source]#
add_sub_type(sub_type_name, extensions=None, file_format_category=None, expression=None)[source]#

Adds or updates an asset subtype

Parameters:
  • sub_type_name

  • extensions

  • file_format_category

  • expression

Returns

get_sub_type(sub_type_name, extensions=None, file_format_category=None, expression=None)[source]#
is_expression()[source]#
to_dict()[source]#
property basename#
property default_extension#

The default extension for this asset (based on type and sub_type).

Returns

str

The default extension for this asset.

property directory#

The directory where the asset should be stored. Returns the directory based on the resource type. If empty, returns the root directory.

Returns

str

The directory where the asset should be stored.

property is_folder#
property name#