PIMS: Python Image Sequence¶
PIMS is a lazy-loading interface to sequential data with numpy-like slicing.
Key features:
- One consistent interface to many file formats
- Numpy-like slicing returns lazy-loading, iterable, sliceable objects
Contents¶
Built-in Readers¶
Example¶
Everything is demonstrated in this IPython notebook.
Load a sequence of images from a directory, where the images are named
img-0.png
, img-1.png
, etc.
In [1]: from pims import ImageSequence
In [2]: images = ImageSequence('img-*.png')
In [3]: images
Out[3]:
<Frames>
Source: D:\Casper\Documents\GitHub\pims\doc\img-*.png
Length: 9 frames
Frame Shape: (256, 256)
Pixel Datatype: uint8
Images can be randomly accessed with standard Python slicing syntax.
In [4]: images[0] # first image
Out[4]:
Frame([[101, 64, 104, ..., 112, 56, 226],
[ 3, 230, 233, ..., 173, 192, 135],
[100, 36, 143, ..., 231, 238, 78],
...,
[175, 186, 55, ..., 143, 229, 60],
[231, 33, 219, ..., 79, 253, 240],
[225, 186, 13, ..., 7, 146, 246]], dtype=uint8)
In [5]: images[-5] # fifth from the end