metadata#

class ChannelPatternSpec(name: str, data_type: str, extension: str, pattern_relpath: str)[source]#

Bases: object

data_type: str#
extension: str#
name: str#
pattern_relpath: str#
class Pattern(pattern_str)[source]#

Bases: Expression

Extends expression to support unlabeled axes. We start with undefined axes i.e. I,J,K, etc. and then we replace them with the actual axis name when we know it. we can parse the pattern from a string containing the placeholders (by default ‘?’). We can also highlight a given axis specified by index or name.

assign_axes_from_combo(axis_names: list[str]) None[source]#

axis_names is a list like [‘Z’,’Y’,’X’] mapped to existing tag slots.

get_channel_indices()[source]#
highlight_digits(axis=None, cluster_idx=None)[source]#

Highlight the placeholder digits of the pattern at index cluster_idx

Parameters:

cluster_idx (int) – The index in the string of the first digit to be highlighted

Returns

relative_string(base_dir: Path) str[source]#

Return the pattern string relative to base_dir.

set_axes_names(names)[source]#
set_axis_name(axis_index, new_name)[source]#
set_channel_tag_name()[source]#
string(values=None)[source]#

Convert a value to a string according to the tag specification.

Examples

>>> exp = Expression('file_<X,2>_<Y,3>.npy')
>>> exp.string({'X':1, 'Y':10})
'file_01_010.npy'
Parameters:

values (dict) – A dictionary with values for the tags. Each key is the tag name.

Returns

str

The string representation of the value.

class PatternFinder(folder, tiff_list=None, df=None, axes_order=None)[source]#

Bases: object

classmethod from_mixed_file_list(folder, file_list)[source]#

Create a PatternFinder from a list of tiff paths potentially containing different channels

Parameters:
  • folder

  • file_list

Returns

classmethod split_channel(folder, df, pattern)[source]#
static file_list_to_df(file_names)[source]#
static pattern_from_df(df)[source]#
to_channel_config(*, data_type: str, extension: str, base_dir: Path) dict[source]#

Returns a minimal config subtree for this channel.

define_auto_resolution(img_path, cfg_res)[source]#
define_auto_stitching_params(img_path, stitching_cfg)[source]#
extract_channel_number(pattern_str: str) int | None[source]#
get_ome_dict(img_path)[source]#
get_tiles_list_from_sample_folder(src_dir: Path, min_file_number: int = 10, tile_extensions: List[str] = ['.ome.tif', '.ome.npy']) Dict[Path, List[Path]][source]#
parse_img_res(img_path)[source]#
parse_img_shape(img_path)[source]#
parse_ome_info(img_path: Path) Dict[str, Any][source]#
parse_overlaps(img_path)[source]#
pattern_finders_from_base_dir(src_dir: str | Path, min_file_number: int = 10, tile_extension: List[str] = ['.ome.tif', '.ome.npy']) List[PatternFinder][source]#