https://github.com/arcadia-science/readlif

Leica Image Format (LIF) file reader for Python

https://github.com/arcadia-science/readlif

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.1%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Leica Image Format (LIF) file reader for Python

Basic Info
  • Host: GitHub
  • Owner: Arcadia-Science
  • License: gpl-3.0
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 44.1 MB
Statistics
  • Stars: 36
  • Watchers: 5
  • Forks: 13
  • Open Issues: 23
  • Releases: 15
Created about 7 years ago · Last pushed 12 months ago
Metadata Files
Readme Changelog License

README.md

readlif

The readlif package is a fast, pure Python reader for Leica Image Format (LIF) files. It supports Python 3.9 and above.

This code is inspired by the Open Microscopy Bio-Formats project.

Auto-generated documentation is available here.

Project status: Ownership change

In September 2024, ownership of the readlif package was transferred from Nick Negretti, its original author, to Arcadia Science. We are committed to maintaining and improving this project for the imaging community as part of Arcadia's committment to open science. For any questions or support, please open an issue in this repo.

Roadmap

The following is a summary of recent and planned changes to the readlif package by Arcadia Science:

  • [Done] Fix a bug related to reading 16-bit images.
  • [Done] Use ruff for formatting and linting.
  • [Done] migrate to pyproject.toml for package configuration.
  • [Planned] add support for reading 32-bit images.
  • [Planned] add support for extracting relevant metadata from the raw XML metadata embedded in LIF files.
  • [Planned] refactor the get_plane method to make it easier to use.
  • [Planned] improve tests using realistic test files from internal sources.

Installation

This package is available on PyPI, so it can be installed with pip:

sh pip install readlif

Development

Please see the DEVELOPMENT.md readme for information on how to set up a development environment for this package.

Usage

LIF files are represented by LifFile instances. These objects can be created by passing the path to a LIF file:

python from readlif.reader import LifFile lif_file = LifFile('./path/to/file.lif')

This object contains a few methods to access the images contained within the LIF file. All images, whether in a folder or not, will be accessible sequentially from the LifFile object.

```python

Access a specific image directly.

image0 = new.getimage(0)

Create a list of images using a generator.

allimages = [image for image in liffile.getiterimage()] ```

The resulting LifImage object has a few methods to access the specific two-dimensional frame contained in the image, where z is the z position, t is the timepoint, and c is the channel.

```python

Access a specific frame in the image.

image0.getframe(z=0, t=0, c=0)

Iterate over different dimensions, holding the other dimensions fixed.

images = [image for image in image0.getitert(c=0, z=0)] images = [image for image in image0.getiterz(t=0, c=0)] images = [image for image in image0.getiter_c(t=0, z=0)] ```

The two-dimensional images returned by these methods are Pillow objects, so all Pillow methods (like .show()) will work with them.

Known issues

Below are known issues and limitations with the readlif package. If you encounter these issues, please open an issue.

  • There may be an issue where a truncated 16-bit file will load incorrectly; however, this is not tested.

  • There is not support for FlipX, FlipY and SwapXY metadata.

  • Truncated images are returned as blank images.

  • There is currently no support for returning arbitrary planes from get_plane by specifying display_dims.

  • The package has only been tested with LIF files that were generated with Leica LAS X and Leica LAS AF. It may not work with LIF files from other sources.

Note about 16-bit images

As of 0.3.0, reaflif supports images with bit depths greater than 8.

However, while some images will be returned as 16-bit arrays, the image data in the LIF file may actually be 10- or 12-bit. The original bit depth of each channel can be found in the bit_depth attribute of LifImage.

Owner

  • Name: Arcadia Science
  • Login: Arcadia-Science
  • Kind: organization
  • Location: United States of America

GitHub Events

Total
  • Issues event: 2
  • Watch event: 4
  • Delete event: 2
  • Issue comment event: 12
  • Push event: 4
  • Pull request review event: 2
  • Pull request event: 4
  • Create event: 5
Last Year
  • Issues event: 2
  • Watch event: 4
  • Delete event: 2
  • Issue comment event: 12
  • Push event: 4
  • Pull request review event: 2
  • Pull request event: 4
  • Create event: 5

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 0
  • Total pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: 2 months
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.33
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 3
Past Year
  • Issues: 0
  • Pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: 2 months
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.33
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 3
Top Authors
Issue Authors
  • lanery (1)
Pull Request Authors
  • keithchev (5)
  • dependabot[bot] (3)
  • zindy (1)
Top Labels
Issue Labels
Pull Request Labels
dependencies (3)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 5,973 last-month
  • Total docker downloads: 18
  • Total dependent packages: 12
  • Total dependent repositories: 5
  • Total versions: 17
  • Total maintainers: 2
pypi.org: readlif

Fast Leica Image Format (LIF) file reader

  • Versions: 17
  • Dependent Packages: 12
  • Dependent Repositories: 5
  • Downloads: 5,973 Last month
  • Docker Downloads: 18
Rankings
Dependent packages count: 1.6%
Downloads: 4.4%
Dependent repos count: 6.7%
Average: 7.2%
Forks count: 10.9%
Stargazers count: 12.6%
Maintainers (2)
Last synced: 10 months ago

Dependencies

.github/workflows/lint.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • snok/install-poetry v1 composite
.github/workflows/test.yml actions
  • abatilo/actions-poetry v2 composite
  • actions/cache v3 composite
  • actions/checkout v4 composite
  • actions/setup-python v4 composite
poetry.lock pypi
  • alabaster 0.7.16
  • babel 2.16.0
  • beautifulsoup4 4.12.3
  • build 1.2.2
  • cachecontrol 0.14.0
  • certifi 2024.8.30
  • cffi 1.17.1
  • cfgv 3.4.0
  • charset-normalizer 3.3.2
  • cleo 2.1.0
  • colorama 0.4.6
  • crashtest 0.4.1
  • cryptography 43.0.1
  • distlib 0.3.8
  • docutils 0.21.2
  • dulwich 0.21.7
  • dunamai 1.22.0
  • exceptiongroup 1.2.2
  • fastjsonschema 2.20.0
  • filelock 3.16.0
  • identify 2.6.0
  • idna 3.8
  • imagesize 1.4.1
  • importlib-metadata 8.4.0
  • iniconfig 2.0.0
  • installer 0.7.0
  • jaraco-classes 3.4.0
  • jeepney 0.8.0
  • jinja2 3.1.4
  • keyring 24.3.1
  • markupsafe 2.1.5
  • more-itertools 10.5.0
  • msgpack 1.1.0
  • nodeenv 1.9.1
  • numpy 2.0.2
  • packaging 24.1
  • pbr 6.1.0
  • pexpect 4.9.0
  • pillow 10.4.0
  • pkginfo 1.11.1
  • platformdirs 4.3.2
  • pluggy 1.5.0
  • poetry 1.8.3
  • poetry-core 1.9.0
  • poetry-dynamic-versioning 1.4.0
  • poetry-plugin-export 1.8.0
  • pre-commit 3.5.0
  • ptyprocess 0.7.0
  • pycparser 2.22
  • pygments 2.18.0
  • pyproject-hooks 1.1.0
  • pytest 8.2.1
  • pywin32-ctypes 0.2.3
  • pyyaml 6.0.2
  • rapidfuzz 3.9.7
  • requests 2.32.3
  • requests-toolbelt 1.0.0
  • ruff 0.4.4
  • secretstorage 3.3.3
  • shellingham 1.5.4
  • snowballstemmer 2.2.0
  • soupsieve 2.6
  • sphinx 7.4.7
  • sphinxcontrib-apidoc 0.5.0
  • sphinxcontrib-applehelp 2.0.0
  • sphinxcontrib-devhelp 2.0.0
  • sphinxcontrib-htmlhelp 2.1.0
  • sphinxcontrib-jsmath 1.0.1
  • sphinxcontrib-qthelp 2.0.0
  • sphinxcontrib-serializinghtml 2.0.0
  • tomli 2.0.1
  • tomlkit 0.13.2
  • trove-classifiers 2024.7.2
  • urllib3 2.2.2
  • virtualenv 20.26.4
  • xattr 1.1.0
  • zipp 3.20.1
pyproject.toml pypi