Skip to content

Instantly share code, notes, and snippets.

@will-moore
will-moore / download_pdi.py
Created Oct 8, 2021
Python script to download original files from Project/Dataset/Image in OMERO using cli download command
View download_pdi.py
import argparse
import sys
import os
from omero.cli import cli_login, CLI
from omero.gateway import BlitzGateway
from omero.plugins.download import DownloadControl
View set_channel_minmax.py
import argparse
import json
import sys
from omero.gateway import BlitzGateway
from omero.cli import cli_login
from omero.model import StatsInfoI
from omero.rtypes import rdouble
View idr0079-parade-crossfilter-prep.py
#!/usr/bin/env python
import pandas
import omero.clients
import omero.cli
import omero
import os
View openZarrPluginExample.imjoy.html
<docs>
# NGFF image file Loader for ImageJ.JS
[Next-generation file formats](https://ngff.openmicroscopy.org/latest/) is a specification for storing bioimaging
data in the cloud.
This plugin enalbes loading NGFF image into ImageJ.JS.
The implementation is adapted from the [OMERO ImJoy](https://github.com/will-moore/omero-imjoy) made by @will-moore
@will-moore
will-moore / copy_masks_2_polygons.py
Last active May 21, 2021
Copy Masks from an Image in one OMERO server and turn them into Polygons on a different OMERO server
View copy_masks_2_polygons.py
import omero
from omero.gateway import BlitzGateway
from omero.rtypes import rint, rstring
from skimage import morphology
from skimage import measure
import argparse
import sys
@will-moore
will-moore / metadata_queries.py
Created Apr 1, 2021
Examples for how to query OMERO for Images based on pixel type of Map Annotations
View metadata_queries.py
# https://forum.image.sc/t/harmonization-of-image-metadata-for-different-file-formats-omero-mde/50827/8
import omero
from omero.gateway import BlitzGateway
conn = BlitzGateway('username', 'password', port=4064, host='omero.server.org')
conn.connect()
# current group
@will-moore
will-moore / copy_dataset.py
Last active May 12, 2021
This script copies a Dataset or Image from one OMERO.server to another. By default it requires https://gitlab.com/openmicroscopy/incubator/omero-python-importer/-/blob/master/import.py and transfers original files. Alternative is to use --pixels to only transfer pixel data (this doesn't support big images).
View copy_dataset.py
# -----------------------------------------------------------------------------
# Copyright (C) 2021 University of Dundee. All rights reserved.
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@will-moore
will-moore / omezarr.json
Last active Dec 23, 2020
Vitessce config file for loading an OME-Zarr - Work in progress
View omezarr.json
{
"description": "test",
"layers": [
{
"name": "raster",
"type": "RASTER",
"fileType": "ome-zarr.json",
"url": "https://s3.embassy.ebi.ac.uk/idr/zarr/v0.1/179706.zarr"
}
],
@will-moore
will-moore / dask_5d_multiscale_napari.py
Created Nov 13, 2020
Performance test for concatenating tiles into multi-dimensional pyramid with dask.array.stack vv map_blocks
View dask_5d_multiscale_napari.py
"""
Display a 5D dask multiscale pyramid
"""
from dask import array as da
from dask import delayed
import datetime
import numpy as np
import napari
from math import ceil
View omero_open_with_url.js
// Configure OMERO.web open_with, pointing to the script_url to this gist
// $ omero config append omero.web.open_with '["openwith_url", "https://hms-dbmi.github.io/vizarr?source=https%3A%2F%2Fs3.embassy.ebi.ac.uk%2Fidr%2Fzarr%2Fv0.1%2F$ID.zarr", {"script_url": "url/to/omero_open_with_url.js", "label":"vizarr"}]'
function getIdrIdForNode(node) {
let idrId = node.id;
// for testing IDR images imported to other OMERO.servers,
// we can rename the images to be the IDR ID
let idFromName = parseInt(node.name);