Other formats

PIMS

Through PIMS, MorphoCut supports reading Bioformats and Video.

PIMS is a lazy-loading interface to sequential data with numpy-like slicing.”

Note

PIMS is required to use the nodes defined in this module.

morphocut.pims.BioformatsReader()[source]

Stream Read frames from Bio-Formats files.

Bio-Formats is a software tool for reading and writing image data using standardized, open formats. It is able to read over 150 file formats, including OME-TIFF and Amnis FlowSight (.cif).

Note

JPype is required to use this reader.

On first use of BioformatsReader, the required java library loci_tools.jar will be automatically downloaded from openmicroscopy.org.

Parameters
  • path (str) – Path to a Bioformats file.

  • meta (bool, optional) – When true, the metadata object is generated. Takes time to build.

  • series (int, optional) – Active image series index. Defaults to None, meaning that all series are read.

  • **kwargs – Additional keyword parameters for pims.BioformatsReader

Example

frame, series = BioformatsReader(path)

# frame (pims.Frame): The frame.
#   frame.frame_no (int): Frame number.
#   frame.metadata (dict): Frame metadata.
# series (int): The series extracted from the file.
morphocut.pims.VideoReader()[source]

Stream Read frames from video files.

Note

PyAV is required to use this reader.

Parameters
  • path – Path to a video file.

  • **kwargs – Additional keyword parameters for pims.PyAVReaderIndexed.

Example

frame = VideoReader(path)

# frame (pims.Frame): The frame.
#   frame.frame_no (int): Frame number.
#   frame.metadata (dict): Frame metadata.

Example

"""Process video data using MorphoCut and store frames as individual frames."""

from morphocut import Pipeline
from morphocut.image import ImageWriter
from morphocut.pims import VideoReader
from morphocut.str import Format

with Pipeline() as p:
    # Read individual frames from a video file
    frame = VideoReader("/path/to/video.avi")

    # Format filename
    filename = Format("/output/path/frame_#{}.png", frame.frame_no)

    # Write individual frames as image files
    ImageWriter(filename, frame)

p.run()

Contributed

EcotaxaReader

Stream Read an archive of images and metadata that is importable to EcoTaxa.

EcotaxaWriter

Create an archive of images and metadata that is importable to EcoTaxa.