Skip to content

nikhartman/pims

 
 

Repository files navigation

pims: Python Image Sequence

build status

What Problem Does PIMS Solve?

Scientific video can be packaged in various ways: familiar video formats like .AVI and .MOV, folders full of numbered images, or "stacks" of TIFF images. Each of these requires a separate Python module. And, once loaded, they have different methods for accessing individual images, looping through the images in bulk, or access a specific range. PIMS can do all of these using a consistent interface, handling the differences between different inputs invisibly.

Examples & Documentation

Everything is demonstrated in this IPython notebook.

Dependencies

One of the following is required:

  • [scikit-image]
  • [matplotlib]
  • [scipy]

Depending on what file formats you want to read, you will also need:

Basic Installation

Installation is simple on Windows, OSX, and Linux, even for Python novices.

To get started with Python on any platform, download and install Anaconda. It comes with the common scientific Python packages built in.

If you are using Windows, I recommend 32-bit Anaconda even if your system is 64-bit. (One of the optional dependencies is not yet compatible with 64-bit Python.)

Open a command prompt. That's "Terminal" on a Mac, and "Start > Applications > Command Prompt" on Windows. Type these lines:

conda update conda
conda install numpy matplotlib scikit-image pillow
conda install pip

Then, to install pims:

pip install pims

Finally, to try it out, type:

ipython notebook

Optional Dependencies

Reading Multi-Frame TIFF Stacks

PIMS can read most TIFF files out of the box, so you should try reading you files (open('my_tiff_file.tif') and revisit this section if you encounter an error. Many camera and software manufacturers have their own special variants of the TIFF format. Our default reader, built around Christoph Gohlke's tifffile.py, handles all the formats we have personally enountered. But we have alternative TIFF readers built around Pillow (see above) and libtiff, which can be installed like so:

pip install libtiff

Reading Video Files (AVI, MOV, etc.)

To load video files directly, you need FFmpeg or libav. These can be tricky to install, especially on Windows, so we advise less sophisticated users to simply work around this requirement by converting their video files to folders full of images using a utility like ImageJ.

But if either FFmpeg or libav is available, PIMS enables fast random access to video files. It relies on PyAV, which can be installed like so:

pip install av

Troubleshooting

If you use conda / Anaconda, watch out for an error like:

version `GLIBC_2.15' not found

This seems to be because conda includes an old version of a library needed by PyAV. To work around this, simply delete anaconda's version of the library:

rm ~/anaconda/lib/libm.so.6

and/or

rm ~/anaconda/envs/name_of_your_environment/lib/libm.so.6

which will cause PyAV to use the your operating system's version of the library.

Updating Your Installation

The code is under active development. To update to the current development version, run this in the command prompt:

pip install --upgrade http://github.com/soft-matter/pims/zipball/master

Contributors

  • Daniel B. Allan
  • Thomas A. Caswell (major refactoring, additional formats)

Supporting Grant

This package was originally developed and maintained by Daniel Allan, as part of his PhD thesis work on microrheology in Robert L. Leheny's group at Johns Hopkins University in Baltimore, MD. The work was supported by the National Science Foundation under grant number CBET-1033985.

Dan can be reached at daniel.b.allan@jhu.edu.

About

Python Image Sequence: Load video and sequential images in many formats with a simple, consistent interface.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%