Skip to main content

OMERO figure creation app

Project description

Image.sc forum https://github.com/ome/omero-figure/workflows/OMERO/badge.svg https://badge.fury.io/py/omero-figure.svg

OMERO.figure

An OMERO.web app for creating figures from images in OMERO.

For full details see SUPPORT.md.

Requirements

  • OMERO.web 5.6.0 or newer.

Installing from PyPI

This section assumes that an OMERO.web is already installed.

Install the app using pip:

NB: You need to ensure that you are running pip from the python environment where omero-web is installed. Depending on your install, you may need to call pip with, for example: /path/to_web_venv/venv/bin/pip install ...

$ pip install -U omero-figure

Add figure custom app to your installed web apps:

$ omero config append omero.web.apps '"omero_figure"'

Display a link to ‘Figure’ at the top of the webclient:

$ omero config append omero.web.ui.top_links '["Figure", "figure_index",
  {"title": "Open Figure in new tab", "target": "_blank"}]'

Add ‘Figure’ to the ‘Open with’ options, available from context menu on the webclient tree:

$ omero config append omero.web.open_with '["omero_figure", "new_figure",
  {"supported_objects":["images"], "target": "_blank", "label": "OMERO.figure"}]'

Now restart OMERO.web as normal.

Enabling figure export

This section assumes that an OMERO.server is already installed.

Figures can be exported as PDF or TIFF files using a script that runs on the OMERO.server. This script needs to be uploaded to the OMERO.server and its dependencies installed in the OMERO.server virtual environment.

The script can be uploaded using two alternative workflows, both of which require you to have the correct admin privileges. To find where OMERO.figure has been installed using pip, run:

$ pip show omero-figure

The command will display the absolute path to the directory where the application is installed e.g. ~/<virtualenv_name>/lib/python3.6/site-packages. Go to that directory.

Option 1: Connect to the OMERO server and upload the script via the CLI. It is important to be in the correct directory when uploading so that the script is uploaded with the full path: omero/figure_scripts/Figure_To_Pdf.py:

$ cd omero_figure/scripts
$ omero script upload omero/figure_scripts/Figure_To_Pdf.py --official

Option 2: Alternatively, before starting the OMERO.server, copy the script from the figure install /omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py to the OMERO.server path/to/OMERO.server/lib/scripts/omero/figure_scripts. Then restart the OMERO.server.

Option 3: Upload the script through the OMERO web interface: For this, log into your OMERO web interface as admin, select the scripts icon and click on the “Upload Script” button. Select the Figure_To_Pdf.py script from the directory where you copied it to locally and upload it into the directory omero/figure_scripts.

Now install the script’s dependencies:

  • Install reportlab PDF python package. This needs to be installed in the virtual environment where the OMERO.server is installed. Depending on your install, you may need to call pip with, for example: /path/to_server_venv/venv/bin/pip install ...

$ pip install reportlab
  • Optional: Figure legends can be formatted using Markdown syntax. To see this correctly in the exported PDF info page, we need Python Markdown:

$ pip install markdown

Upgrading OMERO.figure

After upgrading OMERO.figure with:

$ pip install -U omero-figure

You need to update the Figure export script using one of the 3 options described above. If using Option 1, you need to replace the existing script:

# Get the ID of the existing Figure_To_Pdf script:
$ omero script list

# Replace the script
$ cd omero_figure/scripts
$ omero script replace <SCRIPT_ID> omero/figure_scripts/Figure_To_Pdf.py

Development

See docs/contributing.md for information on code layout and other details.

We use vite.js to build and serve the app during development.

Install Node from https://nodejs.org, then:

$ cd omero-figure
$ npm install

To serve the app at http://localhost:8080/ using the vite dev server (this will automatically refresh the page when changes are saved):

$ npm run start

If you are editing the Shape-Editor code, you can view the test page at http://localhost:8080/shapeEditorTest.html

CORS

During development, we load and save figure files to an omero-web server. You will need to have CORS enabled on your local omero-web server at http://localhost:4080/ and be logged in already. This URL can be edited in src/index.html.

You MUST access the figure app at http://localhost:8080/ (NOT http://127.0.0.1:8080/) for CORS to work.

NB: in general, POST actions such as saving of figure files or exporting figures doesn’t yet work with the dev server. To test these actions, build the app as described below:

Build

To build the app:

$ npm run build

This compiles index.html and other static assets into correct locations to be served by the Django omero-web server.

To serve this on a local omero-web, set config as above and install with:

$ pip install -e .

In order to build whenever changes are saved within the src/ directory:

$ npm run watch

Release process

This repository uses bump2version to manage version numbers. To tag a release run:

$ bumpversion release

This will remove the .dev0 suffix from the current version, commit, and tag the release.

To switch back to a development version run:

$ bumpversion --no-tag [major|minor|patch]

specifying major, minor or patch depending on whether the development branch will be a major, minor or patch release. This will also add the .dev0 suffix.

Remember to git push all commits and tags.

License

OMERO.figure is released under the AGPL.

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_figure-7.3.1.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

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

omero_figure-7.3.1-py3-none-any.whl (1.2 MB view details)

Uploaded Python 3

File details

Details for the file omero_figure-7.3.1.tar.gz.

File metadata

  • Download URL: omero_figure-7.3.1.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for omero_figure-7.3.1.tar.gz
Algorithm Hash digest
SHA256 79fe436ab8f74a47bf02e484d156d2f2763d41826f792484f3f5c4f935385fb7
MD5 b8ee302abd90df34d0abe40cb0e21140
BLAKE2b-256 e999b2a089fdac870ccd8b8d6561f78b03567edb7c5852b8d280ecd5c65342de

See more details on using hashes here.

File details

Details for the file omero_figure-7.3.1-py3-none-any.whl.

File metadata

  • Download URL: omero_figure-7.3.1-py3-none-any.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for omero_figure-7.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 81f5c67144c567f72f69ba57c5b61b0826448b236b45922c6582c38b80925538
MD5 93a4ae53f13bd8fb89d433788a317b09
BLAKE2b-256 52644e3f2531c8ff50cd2bb40619260a834564e28d0ff9e6f71a681b3c0275ad

See more details on using hashes here.

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