organoid_tracker.image_loading.folder_image_loader module

class organoid_tracker.image_loading.folder_image_loader.FolderImageLoader(folder: str, file_name_format: str, min_time_point: int, max_time_point: int, min_channel: int, max_channel: int)

Bases: ImageLoader

can_save_images(image_channel: ImageChannel) bool

Returns True if images can be saved for the given channel via self.save_3d_image_array, False otherwise.

copy() ImageLoader

Copies the image loader, so that you can use it on another thread.

first_time_point_number() Optional[int]

Gets the first time point for which images are available.

get_2d_image_array(time_point: TimePoint, image_channel: ImageChannel, image_z: int) Optional[ndarray]

Loads one single 2d slice of an image. Returns None if there is no image for this z, time point or channel. Note: the image z always goes from 0 to image_size_z - 1.

get_3d_image_array(time_point: TimePoint, image_channel: ImageChannel) Optional[ndarray]

Loads an image, usually from disk. Returns None if there is no image for this time point or channel.

get_channel_count() int

Gets the number of available channels.

get_image_size_zyx() Optional[Tuple[int, int, int]]

Just get the size of the image at the first time point, and cache it.

last_time_point_number() Optional[int]

Gets the last time point (inclusive) for which images are available.

save_3d_image_array(time_point: TimePoint, image_channel: ImageChannel, image: ndarray)

Saves the given 3D image stack to disk. If the image already exists, it will be overwritten.

Raises ValueError if the image loader does not support saving images. (Check with can_save_images() first.).

Warning: don’t call this method directly from experiment.images.image_loader().save_3d_image_array(…) because then you bypass the caching mechanism. Instead, call it as experiment.images.save_3d_image_array(…).

serialize_to_config() Tuple[str, str]

Serializes this image loader into a path and a file/series name. This can be stored in configuration files.

Note: not every image loader can be serialized fully using just two strings. There is also a newer method, self.serialize_to_dictionary(), which does contain all information.

organoid_tracker.image_loading.folder_image_loader.load_images_from_folder(experiment: Experiment, folder: str, file_name_format: str, min_time_point: Optional[int] = None, max_time_point: Optional[int] = None)