skimage2.io.MultiImage#
- class skimage2.io.MultiImage(filename, conserve_memory=True, dtype=None, **imread_kwargs)[source]#
Bases:
ImageCollectionA class containing all frames from multi-frame TIFF images.
- Parameters:
- load_patternstr or list of str
Pattern glob or filenames to load. The path can be absolute or relative.
- conserve_memorybool, optional
Whether to conserve memory by only caching the frames of a single image. Default is True.
Notes
MultiImagereturns a list of image-data arrays. In this regard, it is very similar toImageCollection, but the two differ in their treatment of multi-frame images.For a TIFF image containing N frames of size WxH,
MultiImagestores all frames of that image as a single element of shape(N, W, H)in the list.ImageCollectioninstead creates N elements of shape(W, H).For an animated GIF image,
MultiImagereads only the first frame, whileImageCollectionreads all frames by default.Examples
>>> from pathlib import Path >>> from _skimage2.io import ImageCollection
Get directory containing data files.
>>> from _skimage2 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 1 >>> 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 2 >>> for frame in image_col: ... print(frame.shape) # each element is a frame of shape (15, 10) ... (15, 10) (15, 10)
- concatenate()[source]#
Concatenate all images in the collection into an array.
- Returns:
- arnp.ndarray
An array having one more dimension than the images in
self.
- Raises:
- ValueError
If images in the
skimage.io.ImageCollectiondo not have identical shapes.
See also
- property conserve_memory#
- property filename#
- property files#