EMIFile — seremi 0.0.1 documentation

# EMIFile

class seremi.EMIFile(path: str | Path)

  Bases: `object`

  Read an EMI file, which contains detailed metadata and the last frame of an SER.

  close()

    Close internal resource handles

  domain: str

    domain metadata field

  img_height: int

    height of the image in pixels

  img_width: int

    width of the image in pixels

  info_dict: dict

    metadata XML object converted to dictionary

  open()

    Open the EMI and populate metadata fields. This method does not read frame contents.

  original_filepath: str

    the filepath of the SER when it was saved the first time

  path: Path

    user-provided path

  read_frame() → ndarray

    Extract the one frame stored inside the EMI file. In my testing, this image is always the last frame of the corresponding SER file. :return: 2D int32 array

class seremi.SERFile(path: Path | str)

  Bases: `object`

  Read a SER microscope image file, which contains multiple frames. Initially, on opening an SER file, only metadata is read. To access image content of a particular frame, call read_frame().

  SER files contain very little metadata. Instead, for a SER file “abc_1.ser”, there exists a corresponding EMI file “abc.emi”, which contains detailed metadata corresponding to the SER.

  close()

    Close internal resource handles

  img_height: int

    height of each image in pixels

  img_width: int

    width of each image in pixels

  num_frames: int

    number of images inside this one SER file

  open()

    Open the SER file and populate metadata fields. This method does not read frame contents.

  path: Path

    user-provided path of the image file

  read_all_frames() → list[ndarray]

    Extract the content of all the frames. :return: list of 2D int32 arrays

  read_frame(idx: int) → ndarray

    Extract the content of one of the images inside this SER file. :param idx: 0-indexed frame number :return: 2D int32 array

  read_last_frame() → ndarray

    Extract the content of the last frame. :return: 2D int32 array

  read_timestamp(idx: int) → int

    Read UNIX timestamp saved inside this file. :return: integer seconds since Jan 1, 1970, UTC.