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: /home/casper/code/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([[211, 152, 27, ..., 119, 172, 33],
[175, 193, 188, ..., 219, 211, 91],
[248, 60, 72, ..., 91, 98, 136],
...,
[246, 110, 87, ..., 123, 182, 25],
[254, 34, 136, ..., 64, 114, 233],
[132, 26, 208, ..., 152, 225, 35]], dtype=uint8)
In [5]: images[-5] # fifth from the end