Skip to main content

Plugin for exporting images in zarr format.

Project description

https://github.com/ome/omero-cli-zarr/workflows/Precommit/badge.svg https://badge.fury.io/py/omero-cli-zarr.svg

OMERO CLI Zarr plugin

This OMERO command-line plugin allows you to export Images and Plates from OMERO as zarr files, according to the spec at https://github.com/ome/omero-ms-zarr/blob/master/spec.md as well as Masks associated with Images.

Images are 5D arrays of shape (t, c, z, y, x). Plates are a hierarchy of plate/row/column/field(image). Masks are 2D bitmasks which can exist on muliplte planes of an Image. In ome-zarr sets of Masks are collected together into “labels”.

It supports export using 2 alternative methods:

  • By default the OMERO API is used to load planes as numpy arrays and the zarr file is created from this data. NB: currently, large tiled images are not supported by this method.

  • Alternatively, if you can read directly from the OMERO binary repository and have installed https://github.com/glencoesoftware/bioformats2raw then you can use this to create zarr files.

Usage

Images and Plates

To export Images or Plates via the OMERO API:

# Image will be saved in current directory as 1.zarr
$ omero zarr export Image:1

# Plate will be saved in current directory as 2.zarr
$ omero zarr export Plate:2

# Specify an output directory
$ omero zarr --output /home/user/zarr_files export Image:1

# Cache each plane as a numpy file.npy. If connection is lost, and you need
# to export again, we can use these instead of downloading again
# omero zarr --cache_numpy export Image:1

To export images via bioformats2raw we use the `--bf` flag:

export MANAGED_REPO=/var/omero/data/ManagedRepository
export BF2RAW=/opt/tools/bioformats2raw-0.2.0-SNAPSHOT

$ omero zarr --output /home/user/zarr_files export 1 --bf
Image exported to /home/user/zarr_files/2chZT.lsm

Masks

To export Masks for an Image or Plate:

# Saved under 1.zarr/labels/0 - 1.zarr/ must already exist
$ omero zarr masks Image:1

# Labels saved under each image. e.g 2.zarr/A/1/0/labels/0
# Plate should already be exported
$ omero zarr masks Plate:2

# Saved under zarr_files/1.zarr/labels/0
$ omero zarr --output /home/user/zarr_files masks Image:1

# Specify the label-name. (default is '0')
# e.g. Export to 1.zarr/labels/A
$ omero zarr masks Image:1 --label-name=A

The default behaviour is to export all masks on the Image to a single 5D “labeled” zarr array, with a different value for each mask Shape. An exception will be thrown if any of the masks overlap.

To handle overlapping masks, split masks into non-overlapping zarr groups using a “label-map” which is a csv file of that specifies the name of the zarr group for each ROI on the Image. Columns are ID, NAME, ROI_ID.

For example, to create a group from the textValue of each Shape, you can use this command:

omero hql --style=plain "select distinct s.textValue, s.roi.id from Shape s where s.roi.image.id = 5514375" --limit=-1 | tee 5514375.rois

This creates a file 5514375.rois like this:

0,Cell,1369132
1,Cell,1369134
2,Cell,1369136
...
40,Chromosomes,1369131
41,Chromosomes,1369133
42,Chromosomes,1369135
...

This will create zarr groups of Cell and Chromosomes under 5514375.zarr/labels/:

$ omero zarr masks Image:5514375 --label-map=5514375.rois

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

omero-cli-zarr-0.3.0.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

omero_cli_zarr-0.3.0-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file omero-cli-zarr-0.3.0.tar.gz.

File metadata

  • Download URL: omero-cli-zarr-0.3.0.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for omero-cli-zarr-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b43bbc4c73e01e7b106c6ed82a4a4f3ad6031f2ff9265767d4a77f12cb2c7d12
MD5 7cbc8496c6a15df4d6e394c34095e63e
BLAKE2b-256 6d6e4a03438f624844e57e54b692ebc4ad585cbe373cf0cb3121b4333972f42b

See more details on using hashes here.

File details

Details for the file omero_cli_zarr-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: omero_cli_zarr-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 24.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for omero_cli_zarr-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4515dd9af34bac2b4db4d11369e603b737558bb74f226181e33cb5cfe3ab3736
MD5 f0fabae20f75bb23e798beaf513cd99c
BLAKE2b-256 ae45a16ddeb75d75aa82c26fe6b41858c547f0832d8f9b1ad270298470ac75b4

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