omero-cli-zarr


Nameomero-cli-zarr JSON
Version 0.5.5 PyPI version JSON
download
home_pagehttps://github.com/ome/omero-cli-zarr/
SummaryPlugin for exporting images in zarr format.
upload_time2024-01-19 14:34:47
maintainer
docs_urlNone
authorThe Open Microscopy Team
requires_python>=3
license
keywords omero.cli plugin
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://github.com/ome/omero-cli-zarr/workflows/Precommit/badge.svg
   :target: https://github.com/ome/omero-cli-zarr/actions

.. image:: https://badge.fury.io/py/omero-cli-zarr.svg
    :target: https://badge.fury.io/py/omero-cli-zarr

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

    # By default, a tile size of 1024 is used. Specify values with
    $ omero zarr export Image:1 --tile_width 256 --tile_height 256


NB: If the connection to OMERO is lost and the Image is partially exported,
re-running the command will attempt to complete the export.

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 and Polygons
^^^^^^^^^^^^^^^^^^

To export Masks or Polygons for an Image or Plate, use the `masks` or `polygons` command::

    # 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

    # Allow overlapping masks or polygons (overlap will be maximum value of the dtype)
    $ omero zarr polygons Image:1 --overlaps=dtype_max

The default behaviour is to export all masks or polygons on the Image to a single 5D
"labeled" zarr array, with a different value for each Shape.
An exception will be thrown if any of the masks overlap, unless the `--overlaps`
option is used as above.

An alternative to handle overlapping masks is to split masks into non-overlapping zarr
groups using a "label-map" which is a csv file 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

License
-------

This project, similar to many Open Microscopy Environment (OME) projects, is
licensed under the terms of the GNU General Public License (GPL) v2 or later.

Copyright
---------

2020-2023, The Open Microscopy Environment



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ome/omero-cli-zarr/",
    "name": "omero-cli-zarr",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3",
    "maintainer_email": "",
    "keywords": "OMERO.CLI,plugin",
    "author": "The Open Microscopy Team",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/eb/8e/d715a30b580f41dc54a7f0bde40a81ea995033d3e6897fa71403b888da63/omero-cli-zarr-0.5.5.tar.gz",
    "platform": null,
    "description": ".. image:: https://github.com/ome/omero-cli-zarr/workflows/Precommit/badge.svg\n   :target: https://github.com/ome/omero-cli-zarr/actions\n\n.. image:: https://badge.fury.io/py/omero-cli-zarr.svg\n    :target: https://badge.fury.io/py/omero-cli-zarr\n\nOMERO CLI Zarr plugin\n=====================\n\nThis OMERO command-line plugin allows you to export Images and Plates\nfrom OMERO as zarr files, according to the spec at\nhttps://github.com/ome/omero-ms-zarr/blob/master/spec.md\nas well as Masks associated with Images.\n\nImages are 5D arrays of shape `(t, c, z, y, x)`.\nPlates are a hierarchy of `plate/row/column/field(image)`.\nMasks are 2D bitmasks which can exist on muliplte planes of an Image.\nIn `ome-zarr` sets of Masks are collected together into \"labels\".\n\nIt supports export using 2 alternative methods:\n\n- By default the OMERO API is used to load planes as numpy arrays\n  and the zarr file is created from this data. NB: currently, large\n  tiled images are not supported by this method.\n\n- Alternatively, if you can read directly from the OMERO binary\n  repository and have installed https://github.com/glencoesoftware/bioformats2raw\n  then you can use this to create zarr files.\n\n\nUsage\n-------\n\nImages and Plates\n^^^^^^^^^^^^^^^^^\n\nTo export Images or Plates via the OMERO API::\n\n\n    # Image will be saved in current directory as 1.zarr\n    $ omero zarr export Image:1\n\n    # Plate will be saved in current directory as 2.zarr\n    $ omero zarr export Plate:2\n\n    # Specify an output directory\n    $ omero zarr --output /home/user/zarr_files export Image:1\n\n    # By default, a tile size of 1024 is used. Specify values with\n    $ omero zarr export Image:1 --tile_width 256 --tile_height 256\n\n\nNB: If the connection to OMERO is lost and the Image is partially exported,\nre-running the command will attempt to complete the export.\n\nTo export images via bioformats2raw we use the ```--bf``` flag::\n\n    export MANAGED_REPO=/var/omero/data/ManagedRepository\n    export BF2RAW=/opt/tools/bioformats2raw-0.2.0-SNAPSHOT\n\n    $ omero zarr --output /home/user/zarr_files export 1 --bf\n    Image exported to /home/user/zarr_files/2chZT.lsm\n\nMasks and Polygons\n^^^^^^^^^^^^^^^^^^\n\nTo export Masks or Polygons for an Image or Plate, use the `masks` or `polygons` command::\n\n    # Saved under 1.zarr/labels/0 - 1.zarr/ must already exist\n    $ omero zarr masks Image:1\n\n    # Labels saved under each image. e.g 2.zarr/A/1/0/labels/0\n    # Plate should already be exported\n    $ omero zarr masks Plate:2\n\n    # Saved under zarr_files/1.zarr/labels/0\n    $ omero zarr --output /home/user/zarr_files masks Image:1\n\n    # Specify the label-name. (default is '0')\n    # e.g. Export to 1.zarr/labels/A\n    $ omero zarr masks Image:1 --label-name=A\n\n    # Allow overlapping masks or polygons (overlap will be maximum value of the dtype)\n    $ omero zarr polygons Image:1 --overlaps=dtype_max\n\nThe default behaviour is to export all masks or polygons on the Image to a single 5D\n\"labeled\" zarr array, with a different value for each Shape.\nAn exception will be thrown if any of the masks overlap, unless the `--overlaps`\noption is used as above.\n\nAn alternative to handle overlapping masks is to split masks into non-overlapping zarr\ngroups using a \"label-map\" which is a csv file that specifies the name of\nthe zarr group for each ROI on the Image. Columns are ID, NAME, ROI_ID.\n\nFor example, to create a group from the `textValue` of each Shape,\nyou can use this command::\n\n    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\n\nThis creates a file `5514375.rois` like this::\n\n    0,Cell,1369132\n    1,Cell,1369134\n    2,Cell,1369136\n    ...\n    40,Chromosomes,1369131\n    41,Chromosomes,1369133\n    42,Chromosomes,1369135\n    ...\n\nThis will create zarr groups of `Cell` and `Chromosomes` under `5514375.zarr/labels/`::\n\n    $ omero zarr masks Image:5514375 --label-map=5514375.rois\n\nLicense\n-------\n\nThis project, similar to many Open Microscopy Environment (OME) projects, is\nlicensed under the terms of the GNU General Public License (GPL) v2 or later.\n\nCopyright\n---------\n\n2020-2023, The Open Microscopy Environment\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Plugin for exporting images in zarr format.",
    "version": "0.5.5",
    "project_urls": {
        "Homepage": "https://github.com/ome/omero-cli-zarr/"
    },
    "split_keywords": [
        "omero.cli",
        "plugin"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fcafc4e613aaf6984c3d4cd1f8f4763f5c57648ac2d12bf8434302b24bff03f0",
                "md5": "37c77f7240cee42d91e5153e3c3f2876",
                "sha256": "c6921c6fc3db4ce3edf90cf82fd8ecc9635d4f82ffd97ae9613bdf09a0822169"
            },
            "downloads": -1,
            "filename": "omero_cli_zarr-0.5.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "37c77f7240cee42d91e5153e3c3f2876",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3",
            "size": 27458,
            "upload_time": "2024-01-19T14:34:46",
            "upload_time_iso_8601": "2024-01-19T14:34:46.207886Z",
            "url": "https://files.pythonhosted.org/packages/fc/af/c4e613aaf6984c3d4cd1f8f4763f5c57648ac2d12bf8434302b24bff03f0/omero_cli_zarr-0.5.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eb8ed715a30b580f41dc54a7f0bde40a81ea995033d3e6897fa71403b888da63",
                "md5": "2e1bb7a36da26a46d4ab970575d7496a",
                "sha256": "8525ebd4a610c29cf4902017d0e0491b066eaabb49031067b40646215cb5a2a4"
            },
            "downloads": -1,
            "filename": "omero-cli-zarr-0.5.5.tar.gz",
            "has_sig": false,
            "md5_digest": "2e1bb7a36da26a46d4ab970575d7496a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3",
            "size": 25175,
            "upload_time": "2024-01-19T14:34:47",
            "upload_time_iso_8601": "2024-01-19T14:34:47.856477Z",
            "url": "https://files.pythonhosted.org/packages/eb/8e/d715a30b580f41dc54a7f0bde40a81ea995033d3e6897fa71403b888da63/omero-cli-zarr-0.5.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-19 14:34:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ome",
    "github_project": "omero-cli-zarr",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "omero-cli-zarr"
}
        
Elapsed time: 0.28981s