Registry / data / pims
library0.7pypypi✓ verified 83d ago

PIMS (Python Image Sequence) provides a lazy-loading, NumPy-like interface for accessing sequential image and video data from various file formats. It handles diverse inputs, including image directories, TIFF stacks, and common video formats, offering a consistent API for slicing and iteration. The library is actively maintained, with a recent major release (v0.7) in June 2024.

pip install pims
INSTALL
IMPORT
SIG · PIMS
P
pims
datapythonv0.7
Install
6.0s avg
Import
541ms
Disk
154MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.7 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.930 runs
installs and imports cleanly · install 0.0s · import 0.543s · 115.8MB
glibc
py 3.103.930 runs
installs and imports cleanly · install 6.0s · import 0.540s · 189MB
154MB installed
● package 154MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

open
from pims import open
import pims
ImageSequence
from pims import ImageSequence
import pims
FramesSequence
from pims import FramesSequence
import pims

This quickstart demonstrates how to open a sequence of image files using `pims.open`, access individual frames, iterate through the sequence, and use NumPy-like slicing. It includes a basic setup to create dummy image files if Pillow is available.

import pims import numpy as np import os # Create dummy image files for demonstration if not os.path.exists('test_images'): os.makedirs('test_images') for i in range(5): # Using a minimal image writing approach or mocking if actual image lib is heavy # For real use, ensure Pillow or scikit-image is installed. try: from PIL import Image img = Image.new('L', (10, 10), color = i * 50) img.save(f'test_images/frame_{i:02d}.png') except ImportError: print("Pillow not found, cannot create dummy images. Skipping image creation.") break # Open a sequence of images try: frames = pims.open('test_images/frame_*.png') print(f"Opened sequence with {len(frames)} frames.") # Access a single frame (lazy loading) first_frame = frames[0] print(f"Shape of the first frame: {first_frame.shape}") print(f"Pixel value at (0,0) in first frame: {first_frame[0, 0]}") # Iterate through frames sum_pixels = 0 for frame in frames: sum_pixels += np.sum(frame) print(f"Total sum of all pixel values: {sum_pixels}") # Slicing returns another lazy-loading object sub_sequence = frames[1:4] print(f"Sub-sequence has {len(sub_sequence)} frames.") # Example with a specific reader (if 'test_tiff.tif' existed) # from pims import TiffStack # tiff_stack = TiffStack('test_tiff.tif') # print(f"Tiff stack has {len(tiff_stack)} frames.") except Exception as e: print(f"Could not run PIMS quickstart example: {e}") print("Ensure test_images/ directory and dummy images exist or necessary reader dependencies are installed.")
Debug
Known issues
breakingPIMS v0.7 removed direct support for `libtiff`. Users who relied on `libtiff` for specific TIFF functionalities might need to ensure `Pillow` or `tifffile` are installed, or switch to other readers. This can lead to `ImportError` or `No reader found` messages for certain TIFF files.
fix
Ensure `Pillow` or `tifffile` are installed: `pip install Pillow tifffile`. If still encountering issues, consider converting problematic TIFF files to a format supported by other PIMS readers or using specific PIMS readers like `pims.TiffStack_tifffile`.
affects: >=0.7
breakingPIMS v0.7 introduced compatibility with `numpy 2.0`. While this ensures PIMS works with the latest NumPy, other libraries in your environment might not yet be compatible, leading to unexpected behavior or errors related to array data types or API changes in `numpy 2.0`.
fix
Review `numpy 2.0` migration guides (e.g., from NumPy official docs). If other dependencies are not yet compatible, you might need to pin an older `numpy` version (e.g., `numpy<2.0`) in your environment until all libraries are updated. Use `ruff` with the `NPY201` rule for automatic code adaptation if applicable to your project.
affects: >=0.7
breakingIn PIMS v0.5, the `process_func`, `dtype`, and `as_grey` keyword arguments were removed from readers. These functionalities are now handled through PIMS's pipeline system, which offers lazy evaluation and more flexible processing.
fix
Migrate your code to use PIMS pipelines. For grayscale conversion, use `pims.as_grey(reader_object)`. For custom processing, define a function and decorate it with `@pims.pipeline`.
affects: >=0.5
gotchaPIMS relies on optional external libraries for specific file formats (e.g., video, microscopy files). Without these dependencies, PIMS might fail to open certain files with an 'ImportError' or 'No reader found' message, even if PIMS itself is installed.
fix
Install the necessary optional dependencies based on the file types you need to read. For video files, `pip install imageio-ffmpeg` or `pip install pyav` is often required. For Bio-formats, install `jpype1`. Refer to the PIMS documentation for a full list of format-specific dependencies.
affects: All
Upgrade
Version history
0.7latest on PyPI · released Jun 10, 2024
Audit
Dependencies
numpyrequiredCore dependency for array-like data handling.
sliceratorrequiredUsed for lazy-loading pipelines.
scikit-imageoptionalRequired for basic image reading.
matplotliboptionalRequired for basic image reading and display.
PillowoptionalFor improved TIFF support and other image formats.
tifffileoptionalAlternative TIFF support.
imageiooptionalMulti-purpose reader/writer, often used with `imageio-ffmpeg` for video.
imageio-ffmpegoptionalProvides FFmpeg binaries and wrapper for video formats (AVI, MOV, MP4).
pyavoptionalAlternative for video formats (AVI, MOV, H.264) using FFmpeg.
jpype1optionalInterface with Bio-formats for microscopy file support.
pims_nd2optionalImproved Nikon .nd2 support.
moviepyoptionalPython module for video editing, can be used by PIMS for video files.
Agent activity
9 hits · last 30 days
node
8
Resources
pims — pip install pims · libregistry