Skip to main content

Converter from the Lif files (Leica Microscope) to OME-Zarr format.

Project description

Lif to OME-Zarr Converters

Fractal lif converter logo

CI (build and test) codecov

This repository contains the code to convert Lif files to OME-Zarr format.

Installation

To install the package, run the following command:

pip install git+https://github.com/fractal-analytics-platform/fractal-lif-converters

Example usage

  • Plate Converter:
from pathlib import Path

from lif_converters.wrappers import convert_lif_plate_to_omezarr

zarr_dir = "./exports" # Directory path where the OME-Zarr file will be saved
lif_file_path = "./testData_Leica/" # File or directory path containing the lif files
n_levels = 5 # Number of levels to be created in the OME-Zarr file
coarsening_xy = 2 # Coarsening factor for the xy dimensions

convert_lif_plate_to_omezarr(
    zarr_dir=zarr_dir,
    lif_files_path=lif_file_path,
    num_levels=n_levels,
    coarsening_xy=coarsening_xy,
    overwrite=True,
    verbose=True,
)

Where the .lif file is formatted as follows:

/Project.lif
----/Tilescan 1/A/1
----/Tilescan 1/A/2
    ...
----/Tilescan 1/B/1
    ...
----/Tilescan 2/A/1

and the OME-Zarr file will be formatted as follows:

/Project.zarr
----/A
--------/1
------------/0 # This will correspond to "Tilescan 1/A/1"
------------/1 # This will correspond to "Tilescan 2
            ...
  • Single Acquisition Converter:
from pathlib import Path

from lif_converters.wrappers import convert_lif_scene_to_omezarr

zarr_dir = "./exports" # Directory path where the OME-Zarr file will be saved
lif_file_path = "./testData_Leica/" # File or directory path containing the lif files
scene_name = "Scene-1" # Name of the scene to be converted
n_levels = 5 # Number of levels to be created in the OME-Zarr file
coarsening_xy = 2 # Coarsening factor for the xy dimensions

convert_lif_plate_to_omezarr(
    zarr_dir=zarr_dir,
    lif_files_path=lif_file_path,
    num_levels=n_levels,
    scene_name=scene_name,
    coarsening_xy=coarsening_xy,
    overwrite=True,
    verbose=True,
)

Note that the if the scene_name is not provided, all the scenes in the lif file will be converted in a single Ngff Image.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fractal_lif_converters-0.3.3.tar.gz (4.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fractal_lif_converters-0.3.3-py3-none-any.whl (31.2 kB view details)

Uploaded Python 3

File details

Details for the file fractal_lif_converters-0.3.3.tar.gz.

File metadata

  • Download URL: fractal_lif_converters-0.3.3.tar.gz
  • Upload date:
  • Size: 4.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for fractal_lif_converters-0.3.3.tar.gz
Algorithm Hash digest
SHA256 c10c9340edc1e9967a76766420a327bbfb5d3f2715158039c7375bbfbb1c9e32
MD5 badc2ed2ae14ebb7b02c137743219172
BLAKE2b-256 e240d20a208eee5ef1642095fde6532fba6ba6f60e7b45a76c16bda18eb61591

See more details on using hashes here.

Provenance

The following attestation bundles were made for fractal_lif_converters-0.3.3.tar.gz:

Publisher: build_and_test.yml on fractal-analytics-platform/fractal-lif-converters

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fractal_lif_converters-0.3.3-py3-none-any.whl.

File metadata

File hashes

Hashes for fractal_lif_converters-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3ffcefa7fee7bda7e15619b744fe952834a99d007c5816bab7976b8d7011482e
MD5 17bde076a429f24f5c90a9ae0c6c972f
BLAKE2b-256 8eed2efe59f553c214b15abe5e545bce6845fc583fa7bbaff9f3688cf6301e1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for fractal_lif_converters-0.3.3-py3-none-any.whl:

Publisher: build_and_test.yml on fractal-analytics-platform/fractal-lif-converters

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page