liffile


Nameliffile JSON
Version 2025.2.10 PyPI version JSON
download
home_pagehttps://www.cgohlke.com
SummaryRead Leica image files (LIF, LOF, XLIF, XLCF, XLEF, and LIFEXT)
upload_time2025-02-10 20:43:57
maintainerNone
docs_urlNone
authorChristoph Gohlke
requires_python>=3.10
licenseBSD
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Read Leica image files (LIF, LOF, XLIF, XLCF, XLEF, and LIFEXT)
===============================================================

Liffile is a Python library to read image and metadata from Leica image files:
LIF (Leica Image File), LOF (Leica Object File), XLIF (XML Image File),
XLCF (XML Collection File), XLEF (XML Experiment File), and LIFEXT (Leica
Image File Extension).

These files are written by LAS X software to store collections of images
and metadata from microscopy experiments.

:Author: `Christoph Gohlke <https://www.cgohlke.com>`_
:License: BSD 3-Clause
:Version: 2025.2.10
:DOI: `10.5281/zenodo.14740657 <https://doi.org/10.5281/zenodo.14740657>`_

Quickstart
----------

Install the liffile package and all dependencies from the
`Python Package Index <https://pypi.org/project/liffile/>`_::

    python -m pip install -U liffile[all]

See `Examples`_ for using the programming interface.

Source code and support are available on
`GitHub <https://github.com/cgohlke/liffile>`_.

Requirements
------------

This revision was tested with the following requirements and dependencies
(other versions may work):

- `CPython <https://www.python.org>`_ 3.10.11, 3.11.9, 3.12.9, 3.13.2 64-bit
- `NumPy <https://pypi.org/project/numpy>`_ 2.2.2
- `Imagecodecs <https://pypi.org/project/imagecodecs>`_ 2024.12.30
  (required for decoding TIFF, JPEG, PNG, and BMP)
- `Xarray <https://pypi.org/project/xarray>`_ 2025.1.2 (recommended)
- `Matplotlib <https://pypi.org/project/matplotlib/>`_ 3.10.0 (optional)
- `Tifffile <https://pypi.org/project/tifffile/>`_ 2025.1.10 (optional)

Revisions
---------

2025.2.10

- Support case-sensitive file systems.
- Support OMETiffBlock, AiviaTiffBlock, and other memory blocks.
- Remove LifImageSeries.items and paths methods (breaking).
- Deprecate LifImage.xml_element_smd.
- Fix LifImage.parent_image and child_images properties for XML files.
- Work around reading float16 blocks from uint16 OME-TIFF files.

2025.2.8

- Support LIFEXT files.
- Remove asrgb parameter from LifImage.asarray (breaking).
- Do not apply BGR correction when using memory block frames.
- Avoid copying single frame to output array.
- Add LifImage.parent_image and child_images properties.
- Add LifImageSeries.find method.

2025.2.6

- Support XLEF and XLCF files.
- Rename LifFile.series property to images (breaking).
- Rename imread series argument to image (breaking).
- Remove LifImage.index property (breaking).
- Add parent and children properties to LifFile.
- Improve detection of XML codecs.
- Do not keep XML files open.

2025.2.5

- Support XLIF files.
- Revise LifMemoryBlock (breaking).
- Replace LifImage.is_lof property with format (breaking).
- Require imagecodecs for decoding TIF, JPEG, PNG, and BMP frames.

2025.2.2

- Add LifFlimImage class.
- Derive LifImage and LifFlimImage from LifImageABC.
- Rename LifImage.guid property to uuid (breaking).
- Add LifFile.uuid property.

2025.1.31

- Support LOF files.
- Make LifFile.xml_header a function (breaking).

2025.1.30

- Remove LifFile.flim_rawdata (breaking).
- Add index, guid, and xml_element_smd properties to LifImage.

2025.1.26

- Fix image coordinate values.
- Prompt for file name if main is called without arguments.

2025.1.25

- Initial alpha release.

Notes
-----

`Leica Microsystems GmbH <https://www.leica.com/>`_ is a manufacturer of
microscopes and scientific instruments for the analysis of micro and
nanostructures.

This library is in its early stages of development. It is not feature-complete.
Large, backwards-incompatible changes may occur between revisions.

Specifically, the following features are currently not supported:
XLLF formats, image mosaics and pyramids, partial image reads,
reading non-image data like FLIM/TCSPC, heterogeneous channel data types,
discontiguous storage, and bit increments.

The library has been tested with a limited number of version 2 files only.

The Leica image file formats are documented at:

- Leica Image File Formats - LIF, XLEF, XLLF, LOF. Version 3.2.
  Leica Microsystems GmbH. 21 September 2016.
- Annotations to Leica Image File Formats for LAS X Version 3.x. Version 1.4.
  Leica Microsystems GmbH. 24 August 2016.
- TSC SP8 FALCON File Format Description. LAS X Version 3.5.0.

Other implementations for reading Leica image files are
`readlif <https://github.com/Arcadia-Science/readlif>`_ and
`Bio-Formats <https://github.com/ome/bioformats>`_ .

Examples
--------

Read a FLIM lifetime image and metadata from a LIF file:

>>> with LifFile('tests/data/FLIM.lif') as lif:
...     for image in lif.images:
...         name = image.name
...     image = lif.images['Fast Flim']
...     assert image.shape == (1024, 1024)
...     assert image.dims == ('Y', 'X')
...     lifetimes = image.asxarray()
...
>>> lifetimes
<xarray.DataArray 'Fast Flim' (Y: 1024, X: 1024)> Size: 2MB
array([[...]],
      shape=(1024, 1024), dtype=float16)
    Coordinates:
      * Y        (Y) float64... 0.0005564
      * X        (X) float64... 0.0005564
Attributes...
    path:           FLIM_testdata.lif/sample1_slice1/FLIM Compressed/Fast Flim
    F16:            {'Name': 'F16',...
    TileScanInfo:   {'Tile': {'FieldX': 0,...
    ViewerScaling:  {'ChannelScalingInfo': {...

View the image and metadata in a LIF file from the console::

    $ python -m liffile tests/data/FLIM.lif

            

Raw data

            {
    "_id": null,
    "home_page": "https://www.cgohlke.com",
    "name": "liffile",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "Christoph Gohlke",
    "author_email": "cgohlke@cgohlke.com",
    "download_url": "https://files.pythonhosted.org/packages/68/99/fbc9bd0878c8293fe133429294cb5997ef9b9bc8456def090291b3a47fc8/liffile-2025.2.10.tar.gz",
    "platform": "any",
    "description": "Read Leica image files (LIF, LOF, XLIF, XLCF, XLEF, and LIFEXT)\r\n===============================================================\r\n\r\nLiffile is a Python library to read image and metadata from Leica image files:\r\nLIF (Leica Image File), LOF (Leica Object File), XLIF (XML Image File),\r\nXLCF (XML Collection File), XLEF (XML Experiment File), and LIFEXT (Leica\r\nImage File Extension).\r\n\r\nThese files are written by LAS X software to store collections of images\r\nand metadata from microscopy experiments.\r\n\r\n:Author: `Christoph Gohlke <https://www.cgohlke.com>`_\r\n:License: BSD 3-Clause\r\n:Version: 2025.2.10\r\n:DOI: `10.5281/zenodo.14740657 <https://doi.org/10.5281/zenodo.14740657>`_\r\n\r\nQuickstart\r\n----------\r\n\r\nInstall the liffile package and all dependencies from the\r\n`Python Package Index <https://pypi.org/project/liffile/>`_::\r\n\r\n    python -m pip install -U liffile[all]\r\n\r\nSee `Examples`_ for using the programming interface.\r\n\r\nSource code and support are available on\r\n`GitHub <https://github.com/cgohlke/liffile>`_.\r\n\r\nRequirements\r\n------------\r\n\r\nThis revision was tested with the following requirements and dependencies\r\n(other versions may work):\r\n\r\n- `CPython <https://www.python.org>`_ 3.10.11, 3.11.9, 3.12.9, 3.13.2 64-bit\r\n- `NumPy <https://pypi.org/project/numpy>`_ 2.2.2\r\n- `Imagecodecs <https://pypi.org/project/imagecodecs>`_ 2024.12.30\r\n  (required for decoding TIFF, JPEG, PNG, and BMP)\r\n- `Xarray <https://pypi.org/project/xarray>`_ 2025.1.2 (recommended)\r\n- `Matplotlib <https://pypi.org/project/matplotlib/>`_ 3.10.0 (optional)\r\n- `Tifffile <https://pypi.org/project/tifffile/>`_ 2025.1.10 (optional)\r\n\r\nRevisions\r\n---------\r\n\r\n2025.2.10\r\n\r\n- Support case-sensitive file systems.\r\n- Support OMETiffBlock, AiviaTiffBlock, and other memory blocks.\r\n- Remove LifImageSeries.items and paths methods (breaking).\r\n- Deprecate LifImage.xml_element_smd.\r\n- Fix LifImage.parent_image and child_images properties for XML files.\r\n- Work around reading float16 blocks from uint16 OME-TIFF files.\r\n\r\n2025.2.8\r\n\r\n- Support LIFEXT files.\r\n- Remove asrgb parameter from LifImage.asarray (breaking).\r\n- Do not apply BGR correction when using memory block frames.\r\n- Avoid copying single frame to output array.\r\n- Add LifImage.parent_image and child_images properties.\r\n- Add LifImageSeries.find method.\r\n\r\n2025.2.6\r\n\r\n- Support XLEF and XLCF files.\r\n- Rename LifFile.series property to images (breaking).\r\n- Rename imread series argument to image (breaking).\r\n- Remove LifImage.index property (breaking).\r\n- Add parent and children properties to LifFile.\r\n- Improve detection of XML codecs.\r\n- Do not keep XML files open.\r\n\r\n2025.2.5\r\n\r\n- Support XLIF files.\r\n- Revise LifMemoryBlock (breaking).\r\n- Replace LifImage.is_lof property with format (breaking).\r\n- Require imagecodecs for decoding TIF, JPEG, PNG, and BMP frames.\r\n\r\n2025.2.2\r\n\r\n- Add LifFlimImage class.\r\n- Derive LifImage and LifFlimImage from LifImageABC.\r\n- Rename LifImage.guid property to uuid (breaking).\r\n- Add LifFile.uuid property.\r\n\r\n2025.1.31\r\n\r\n- Support LOF files.\r\n- Make LifFile.xml_header a function (breaking).\r\n\r\n2025.1.30\r\n\r\n- Remove LifFile.flim_rawdata (breaking).\r\n- Add index, guid, and xml_element_smd properties to LifImage.\r\n\r\n2025.1.26\r\n\r\n- Fix image coordinate values.\r\n- Prompt for file name if main is called without arguments.\r\n\r\n2025.1.25\r\n\r\n- Initial alpha release.\r\n\r\nNotes\r\n-----\r\n\r\n`Leica Microsystems GmbH <https://www.leica.com/>`_ is a manufacturer of\r\nmicroscopes and scientific instruments for the analysis of micro and\r\nnanostructures.\r\n\r\nThis library is in its early stages of development. It is not feature-complete.\r\nLarge, backwards-incompatible changes may occur between revisions.\r\n\r\nSpecifically, the following features are currently not supported:\r\nXLLF formats, image mosaics and pyramids, partial image reads,\r\nreading non-image data like FLIM/TCSPC, heterogeneous channel data types,\r\ndiscontiguous storage, and bit increments.\r\n\r\nThe library has been tested with a limited number of version 2 files only.\r\n\r\nThe Leica image file formats are documented at:\r\n\r\n- Leica Image File Formats - LIF, XLEF, XLLF, LOF. Version 3.2.\r\n  Leica Microsystems GmbH. 21 September 2016.\r\n- Annotations to Leica Image File Formats for LAS X Version 3.x. Version 1.4.\r\n  Leica Microsystems GmbH. 24 August 2016.\r\n- TSC SP8 FALCON File Format Description. LAS X Version 3.5.0.\r\n\r\nOther implementations for reading Leica image files are\r\n`readlif <https://github.com/Arcadia-Science/readlif>`_ and\r\n`Bio-Formats <https://github.com/ome/bioformats>`_ .\r\n\r\nExamples\r\n--------\r\n\r\nRead a FLIM lifetime image and metadata from a LIF file:\r\n\r\n>>> with LifFile('tests/data/FLIM.lif') as lif:\r\n...     for image in lif.images:\r\n...         name = image.name\r\n...     image = lif.images['Fast Flim']\r\n...     assert image.shape == (1024, 1024)\r\n...     assert image.dims == ('Y', 'X')\r\n...     lifetimes = image.asxarray()\r\n...\r\n>>> lifetimes\r\n<xarray.DataArray 'Fast Flim' (Y: 1024, X: 1024)> Size: 2MB\r\narray([[...]],\r\n      shape=(1024, 1024), dtype=float16)\r\n    Coordinates:\r\n      * Y        (Y) float64... 0.0005564\r\n      * X        (X) float64... 0.0005564\r\nAttributes...\r\n    path:           FLIM_testdata.lif/sample1_slice1/FLIM Compressed/Fast Flim\r\n    F16:            {'Name': 'F16',...\r\n    TileScanInfo:   {'Tile': {'FieldX': 0,...\r\n    ViewerScaling:  {'ChannelScalingInfo': {...\r\n\r\nView the image and metadata in a LIF file from the console::\r\n\r\n    $ python -m liffile tests/data/FLIM.lif\r\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Read Leica image files (LIF, LOF, XLIF, XLCF, XLEF, and LIFEXT)",
    "version": "2025.2.10",
    "project_urls": {
        "Bug Tracker": "https://github.com/cgohlke/liffile/issues",
        "Homepage": "https://www.cgohlke.com",
        "Source Code": "https://github.com/cgohlke/liffile"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "04b166fdf8d0d7b2229b079d7abfb18b8380718417b46b2b826fbdf79d5fb6ad",
                "md5": "d564a4e5e598aa731c5522f96fc52960",
                "sha256": "6c1fadb22df710a4e3c41df7e34c06be8ce18d2de7b3f02560795ebfa46deafc"
            },
            "downloads": -1,
            "filename": "liffile-2025.2.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d564a4e5e598aa731c5522f96fc52960",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 24389,
            "upload_time": "2025-02-10T20:43:55",
            "upload_time_iso_8601": "2025-02-10T20:43:55.736776Z",
            "url": "https://files.pythonhosted.org/packages/04/b1/66fdf8d0d7b2229b079d7abfb18b8380718417b46b2b826fbdf79d5fb6ad/liffile-2025.2.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6899fbc9bd0878c8293fe133429294cb5997ef9b9bc8456def090291b3a47fc8",
                "md5": "9757aa0694cc4d76ef93df73d0795af7",
                "sha256": "fc57242298056c5e3099875d85503d600e8920d5c9377b35ed7aeb8002f7483d"
            },
            "downloads": -1,
            "filename": "liffile-2025.2.10.tar.gz",
            "has_sig": false,
            "md5_digest": "9757aa0694cc4d76ef93df73d0795af7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 35296,
            "upload_time": "2025-02-10T20:43:57",
            "upload_time_iso_8601": "2025-02-10T20:43:57.408363Z",
            "url": "https://files.pythonhosted.org/packages/68/99/fbc9bd0878c8293fe133429294cb5997ef9b9bc8456def090291b3a47fc8/liffile-2025.2.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-10 20:43:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cgohlke",
    "github_project": "liffile",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "liffile"
}
        
Elapsed time: 0.81483s