Skip to content

Instantly share code, notes, and snippets.

@will-moore
will-moore / omezarr.json
Last active December 23, 2020 23:42
Vitessce config file for loading an OME-Zarr - Work in progress
{
"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 November 13, 2020 16:36
Performance test for concatenating tiles into multi-dimensional pyramid with dask.array.stack vv map_blocks
"""
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
// 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);
@will-moore
will-moore / copy_rois.py
Last active September 3, 2020 12:57
Copy ROIs from one Image to another (can be on different OMERO servers)
import argparse
import sys
import omero
import omero.clients
from omero.rtypes import unwrap, rint, rstring
from omero.cli import cli_login
from omero.api import RoiOptions
from omero.gateway import BlitzGateway
@will-moore
will-moore / Rename_Images.py
Last active December 20, 2021 10:27
OMERO.server script to rename Images e.g. myimage_s1.tif to myimage_s001.tif to fix ordering in the clients.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# See https://forum.image.sc/t/omero-screens-data-import/33466/10
# and https://forum.image.sc/t/upload-issue-with-metadata-ome-xml-companion-file/59290/9
import omero.scripts as scripts
from omero.gateway import BlitzGateway
import omero
@will-moore
will-moore / roi_comments_search.py
Created June 10, 2020 09:44
OMERO query for Images via Comments (or Tags) on their ROIs
# See https://forum.image.sc/t/searching-by-roi-comment-field-in-omero-web/38808
# Usage:
# $ python roi_comments_search.py my_search_term
import argparse
import sys
import omero
import omero.clients
@will-moore
will-moore / skimage_segmentation_dataset.py
Created March 18, 2020 14:13
Used on 8-bit images from idr0002 to segment to OMERO Polygons.
import omero
from omero.gateway import BlitzGateway
from omero.rtypes import rint, rstring
from skimage import morphology
from skimage import measure
# Adapted from https://gist.github.com/stefanv/7c296c26b0c3624746f4317bed6a3540
@will-moore
will-moore / nuclei_svs_segmentation.py
Created February 25, 2020 22:13
Adds Polygons around nuclei, works with image https://downloads.openmicroscopy.org/images/SVS/77928.svs Takes around 2 hours to run on that image, creating 160k polygons
import omero
from omero.gateway import BlitzGateway
from omero.rtypes import rint, rstring
from skimage import morphology
from skimage import measure
# Adapted from https://gist.github.com/stefanv/7c296c26b0c3624746f4317bed6a3540
@will-moore
will-moore / FRAP_segmentation.py
Created February 25, 2020 22:07
Draw a Polygon around FRAP bleach spot. Works with FRAP images from https://downloads.openmicroscopy.org/images/DV/will/FRAP/
import omero
from omero.gateway import BlitzGateway
from omero.rtypes import rint, rstring
from skimage import morphology
from skimage import measure
conn = BlitzGateway('user', 'password', port=4064, host='localhost')
conn.connect()