Skip to content

Instantly share code, notes, and snippets.

@will-moore
will-moore / createImageFromTiffs.py
Last active March 18, 2019 15:35
createImageFromTiffs
# See https://www.openmicroscopy.org/community/viewtopic.php?f=4&t=8679
# and https://www.openmicroscopy.org/community/posting.php?mode=reply&f=6&t=8706
import omero
from omero.gateway import BlitzGateway
from PIL import Image
import numpy
conn = BlitzGateway("username", "password", host="localhost", port=4064)
@will-moore
will-moore / renderingDefReset.py
Last active April 24, 2019 12:26
Reset rendering defs in OMERO, and regenerate thumbnails.
import omero
from omero.gateway import BlitzGateway
# See https://www.openmicroscopy.org/community/viewtopic.php?f=4&t=8728
conn = BlitzGateway("username", "password", host="localhost", port=4064)
conn.connect()
# Supports "Project", "Dataset" or "Image"
import omero
from omero.gateway import BlitzGateway
# See https://www.openmicroscopy.org/community/posting.php?mode=reply&f=6&t=8736
idr_client = omero.client(host="idr.openmicroscopy.org", port=4064)
idr_client.createSession('public', 'public')
conn = BlitzGateway(client_obj=idr_client)
@will-moore
will-moore / simple_FRAP.py
Created June 11, 2019 08:23
OMERO training script
# coding: utf-8
# ### Please use the following link to try out the OMERO Python language bindings
# https://docs.openmicroscopy.org/latest/omero/developers/Python.html
# ### Import Packages required to connect to OMERO
# In[1]:
@will-moore
will-moore / pixel_size_test.py
Last active January 23, 2020 14:29
For testing images with different pixel sizes
from omero.model.enums import UnitsLength
import omero
from omero.rtypes import rstring
from omero.gateway import BlitzGateway
conn = BlitzGateway('user', 'password', port=4064, host='localhost')
conn.connect()
units = [
UnitsLength.PICOMETER,
import re
from omero.gateway import BlitzGateway, MapAnnotationWrapper, LongAnnotationWrapper
conn = BlitzGateway("user", "pass", port=4064, host="localhost")
conn.connect()
# Some example chromosome regions we want to annotate Images with...
regions = [
"hg19:chr19:15200000-15560000",
@will-moore
will-moore / add_ellipse_per_channel.py
Created February 10, 2020 15:03
Finds the brightest point in a plane and draws an ellipse around it. Useful for generating test ROIs.
import omero
from omero.rtypes import rdouble, rint
import omero.grid
from omero.gateway import BlitzGateway
import numpy as np
USERNAME = "user"
PASSWORD = "password"
HOST = "merge-ci-devspace.openmicroscopy.org"
PORT = 4064
@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()
@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 / 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