livecellx.core.datasets.LiveCellImageDataset

class livecellx.core.datasets.LiveCellImageDataset(dir_path=None, time2url=None, name=None, ext='tif', max_cache_size=50, max_img_num=None, force_posix_path=True, read_img_url_func=<function read_img_default>, index_by_time=True, is_windows_path=False)[source]

Dataset for loading images into RAM, possibly cache images and load them on demand. This class only contains one channel’s imaging data. For multichannel data, we assume you have a single image for each channel. For the case where your images are stored in a single file, #TODO: you can use the MultiChannelImageDataset class.

Initialize the dataset.

Parameters:
  • dir_path (_type_, optional) – _description_, by default None

  • time2url (Dict[int, str], optional) – _description_, by default None

  • name (str, optional) – _description_, by default “livecell-base”

  • ext (str, optional) – _description_, by default “tif”

  • max_cache_size (int, optional) – _description_, by default 50

  • num_imgs (_type_, optional) – _description_, by default None

  • force_posix_path (bool, optional) – _description_, by default True

  • read_img_url_func (Callable, optional) – _description_, by default read_img_default

  • index_by_time (bool, optional) – _description_, by default True

Methods

get_dataset_name()

get_dataset_path()

get_default_json_path([out_dir, posix])

Return the default json path for this dataset

get_img_by_idx(idx)

Get an image by some index in the times list

get_img_by_time(time)

Get an image by time

get_img_by_url(url_str[, exact_match, ...])

Returns the image corresponding to the given URL string.

get_img_path(time)

Get the path of the image at some time

get_sorted_times()

Get the times in the dataset

has_time(time)

infer_shape()

Infer the shape of the images in the dataset

insert_cache(img, idx)

load_from_json_dict(json_dict[, ...])

Load from a json dict.

load_from_json_file(path[, use_cache])

reindex_time2url_sequential()

Reindex the time2url dictionary

subset_by_time(min_time, max_time[, prefix])

Return a subset of the dataset based on time [min, max)

time_span()

Get the time span of the dataset

to_dask([times, ram])

convert to a dask array for napari visualization

to_json_dict()

Return the dataset info as a dictionary object

update_time2url(time2url)

Update the time2url dictionary

update_time2url_from_dir_path()

Updates the time2url dictionary with the file paths of all files in the specified data directory with the specified extension.

write_json([path, overwrite, out_dir])

Write the dataset info to a local json file.

Attributes

DEFAULT_OUT_DIR