This is a development version (0.26.1rc0.dev0) and may be unstable.Go to latest (0.26.1rc0.dev0+git20260530.b607368ff)
{ } Raw JSON

bundles / skimage 0.26.1rc0.dev0 / skimage / io / collection / MultiImage

class

skimage.io.collection:MultiImage

source: /skimage/io/collection.py

Signature

class MultiImage(filename, conserve_memory = True, dtype = None, **imread_kwargs)

Summary

A class containing all frames from multi-frame TIFF images.

Parameters

load_pattern : str or list of str

Pattern glob or filenames to load. The path can be absolute or relative.

conserve_memory : bool, optional

Whether to conserve memory by only caching the frames of a single image. Default is True.

Notes

MultiImage returns a list of image-data arrays. In this regard, it is very similar to ImageCollection, but the two differ in their treatment of multi-frame images.

For a TIFF image containing N frames of size WxH, MultiImage stores all frames of that image as a single element of shape (N, W, H) in the list. ImageCollection instead creates N elements of shape (W, H).

For an animated GIF image, MultiImage reads only the first frame, while ImageCollection reads all frames by default.

Examples

from pathlib import Path
from skimage.io import ImageCollection
✓
Get directory containing data files.
from skimage import data
data_dir = Path(data.legacy_data_dir)
✓
multipage_tiff = str(data_dir / 'multipage.tif')
multi_img = MultiImage(multipage_tiff)
len(multi_img)  # multi_img contains one element
multi_img[0].shape  # this element is a two-frame image of shape:
✓
(2, 15, 10)
image_col = ImageCollection(multipage_tiff)
len(image_col)  # image_col contains two elements
for frame in image_col:
    print(frame.shape)  # each element is a frame of shape (15, 10)
✓
(15, 10)
(15, 10)

Aliases

  • skimage.io.MultiImage