Skip to main content

Package description.

Project description

Lif to OME-Zarr Converters

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-3.0.1.tar.gz (2.0 MB view details)

Uploaded Source

Built Distribution

fractal_lif_converters-3.0.1-py3-none-any.whl (30.2 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for fractal_lif_converters-3.0.1.tar.gz
Algorithm Hash digest
SHA256 f476a039db395096a7a8d61c24e6420b6228efded0e27b70e110cdc5c6d1affc
MD5 26705bad39987289789b3dd32b05022f
BLAKE2b-256 d584f5393f86873505b94aa1241072d11c30cec1fbf8dbc85776ad047c9a0d10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fractal_lif_converters-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0f9e7bf42e848980f7f6d4e2e3075badb555dbf28ac75ba59a872edf1aa66817
MD5 0b9481eba34b4cb533c689d4bf73ec58
BLAKE2b-256 1c5d25293023ba06012b7722bb554654e11d84db8b761cc36b20339daa9a45c4

See more details on using hashes here.

Supported by

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