Video

PIMS provides reading of video through PyAV (fastest), ImageIO or MoviePy.

PyAV (fastest)

PyAV can be installed via Anaconda, as follows:

conda install av -c conda-forge

Non-anaconda users will have to compile PyAV themselves, which is complicated, especially on Windows. For this we refer the users to the PyAV documentation.

There are two ways PIMS provides random access to video files, which is not something that video formats natively support:

  • PyAVReaderTimed bases the indices of the video frames on the frame_rate that is reported by the video file, along with the timestamps that are imprinted on the separate video frames. The readers PyAVVideoReader and Video are different names for this reader.

  • PyAVReaderIndexed scans through the entire video to build a table of contents. This means that opening the file can take some time, but once it is open, random access is fast. In the case timestamps or frame_rate` are not available, this reader is the preferred option.

pims.PyAVReaderTimed

alias of pims.api.not_available.<locals>.raiser

pims.PyAVReaderIndexed

alias of pims.api.not_available.<locals>.raiser

ImageIO and MoviePy

Both ImageIO and MoviePy implement interfaces with ffmpeg through a Pipe. These are implemented through ImageIOReader and MoviePyReader, respectively.

class pims.ImageIOReader(filename, **kwargs)[source]
Attributes
axes

Returns a list of all axes.

bundle_axes

This determines which axes will be bundled into one Frame.

default_coords

When a axis is not present in both iter_axes and bundle_axes, the coordinate contained in this dictionary will be used.

exts

Property to get the extensions of a FramesStream class.

frame_rate
frame_shape

Returns the shape of the frame as returned by get_frame.

iter_axes

This determines which axes will be iterated over by the FramesSequence.

ndim

Returns the number of axes.

pixel_type

Returns a numpy.dtype for the data type of the pixel values

sizes

Returns a dict of all axis sizes.

Methods

additional_class_exts()

If imageio-ffmpeg is available, more filetypes are supported.

class_exts()

Return a set of the file extensions that this reader can deal with.

close()

A method to clean up anything that need to be cleaned up.

get_frame(i)

Returns a Frame of shape determined by bundle_axes.

get_frame_2D

get_metadata

classmethod additional_class_exts()[source]

If imageio-ffmpeg is available, more filetypes are supported.

classmethod class_exts()[source]

Return a set of the file extensions that this reader can deal with.

Sub-classes should over-ride this function to list what extensions they deal with.

The default interpretation of the returned set is ‘file extensions including but not exclusively’.

close()[source]

A method to clean up anything that need to be cleaned up.

Sub-classes should use super to call up the MRO stack and then do any class-specific clean up

property frame_shape

Returns the shape of the frame as returned by get_frame.

property pixel_type

Returns a numpy.dtype for the data type of the pixel values