Skip to main content

msr

Pure Python and cross-platform reader for MSR/OBF image files as created by Imspector.

Implementation follows the description at: https://imspectordocs.readthedocs.io/en/latest/fileformat.html

WARNING: Only tested on data from our own Abberior Expert Line STED microscope with a narrow range of Imspector versions.

Installation

pip install msr-reader

Usage

from msr_reader import OBFFile
from xml.etree import ElementTree
import ome_types

with OBFFile('file_path.msr') as f:

    # reading image data
    idx = 0
    img = f.read_stack(idx) # read stack with index idx into numpy array

    # multi-channel (or confocal + STED) data is acquired into separate stacks by Imspector.
    # stack_groups groups stacks with same series number in the stack name and identical geometry.
    # every stack belongs to exactly one group, unmatched stacks
    # (e.g. line profiles, rescue_info maps) form single-member groups.
    groups = f.stack_groups # list of StackGroup
    img = f.read_stack_group(0) # read all "channels", stacked along a new first axis: e.g. (C, Z, Y, X)

    # stacks without names (sometimes found in old files) can be grouped by geometry alone:
    # with OBFFile('file_path.msr', group_unnamed_stacks=True) as f:

    # Lightbox files use hierarchical stack names ('Overview 1/Image 1/14:03:01/STAR RED'):
    # for .obf files, grouping by the path up to the last component (the
    # acquisition) and the last component (the channel name) is enabled by
    # default. for .msr files (Imspector), enable it explicitly:
    # with OBFFile('file_path.msr', group_hierarchical_stacks=True) as f:
    # pass group_hierarchical_stacks=False to disable it for .obf files.

    # metadata
    stack_shapes = f.shapes # list of stack shapes, including stack and dimension names
    pixel_sizes = f.pixel_sizes # like shapes, but with pixel sizes (unit: meters)

    # imspector metadata as xml string
    xml_imspector_metadata = f.get_imspector_xml_metadata(idx)
    
    # can be parsed with ElementTree, for example    
    et = ElementTree.fromstring(xml_imspector_metadata)
    # find, e.g. x pixel size in XML
    et.find('doc/ExpControl/scan/range/x/psz').text

    # OME-XML metadata as xml string
    xml_ome_metadata = f.get_ome_xml_metadata()
    # can be parsed with ome-types, for example
    ome_meta = ome_types.from_xml(xml_ome_metadata)

Metadata

Release files for msr-reader 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for msr-reader 0.3.0
File Size Uploaded Provenance Actions
msr_reader-0.3.0.tar.gz 4.4 MB Without provenance Details for msr_reader-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for msr-reader 0.3.0
File Interpreter ABI Platform Actions
msr_reader-0.3.0-py3-none-any.whl Python 3 none any Details for msr_reader-0.3.0-py3-none-any.whl

Total release size: 4.4 MB

Release files / msr_reader-0.3.0.tar.gz

Download URL msr_reader-0.3.0.tar.gz
Size 4.4 MB
Tags Source
SHA-256 checksum
How to use checksums
0d7a052c01f60be60f9b5a3c44efc6e5f659ad056ab6d6f921523192c8e32b54
BLAKE2b-256 checksum
How to use checksums
31f6465ea90fab257c9b52bb32907f438ded4b586dcaf67a3ce8279784b05b33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / msr_reader-0.3.0-py3-none-any.whl

Download URL msr_reader-0.3.0-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d2b9e4ac93176e73a7de55ebe1df532990e2679e2c659e68ac6a226c9eafa56
BLAKE2b-256 checksum
How to use checksums
1afad8069ab683f16e88dda04eb8d091c9f3f0f95013dee033a6da1ed41e3066
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for msr-reader 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page