Skip to content

Instantly share code, notes, and snippets.

@will-moore
will-moore / omero_import.py
Created December 1, 2017 09:57
Python code to import files to OMERO
# From http://www.openmicroscopy.org/community/viewtopic.php?f=6&t=8407
# Uses code from https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/tools/OmeroPy/src/omero/testlib/__init__.py
import omero
import platform
import os
from omero.model import ChecksumAlgorithmI
from omero.model import NamedValue
from omero.model.enums import ChecksumAlgorithmSHA1160
@will-moore
will-moore / LRoi.py
Created March 12, 2018 21:22
OMERO.script for creating Polygon from Line and exporting pixel intensities
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (C) 2018 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.
@will-moore
will-moore / Merge_Tags.py
Last active April 18, 2018 10:38
OMERO.script which merges duplicate Tags and moves Images ONLY to remaining Tag.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (C) 2018 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,
// Tilting the microbit to one side or the other,
// drives a continuous servo one direction (10) or the other (100)
// Editor: https://makecode.microbit.org/
let angle = 0
let millig = 0
input.onButtonPressed(Button.A, () => {
for (let i = 0; i < 4; i++) {
pins.analogWritePin(AnalogPin.P0, 100)
basic.pause(100)
pins.analogWritePin(AnalogPin.P0, 0)
// Editor https://makecode.microbit.org/
// Use 1 microbit as 'master' controller. Others act as 'moles', randomly showing image to hit.
// If hit (shake) while showing image, master microbit increments and shows score
let showing = false
let score = 0
let master = false
input.onButtonPressed(Button.A, () => {
master = true
radio.sendString("start")
})
@will-moore
will-moore / idr_get_map_annotations.py
Created April 25, 2018 08:16
Grabs a bunch of map annotations from IDR to populate a local OMERO with test data
import omero
from omero.gateway import BlitzGateway
from omero.sys import ParametersI
from omero.rtypes import rint
import requests
USERNAME = "username"
PASSWORD = "secret"
conn = BlitzGateway(USERNAME, PASSWORD, host="localhost", port=4064)
conn.connect()
@will-moore
will-moore / WarGames.js
Created May 15, 2018 21:21 — forked from gingemonster/WarGames.js
Micromonsters Episode 7 - WarGames code
let missile: game.LedSprite = null
let opponentsmissile: game.LedSprite = null
let score = 0
let nummissles = 0
let player: game.LedSprite = null
let switchxposition = 0
input.onButtonPressed(Button.A, () => {
player.change(LedSpriteProperty.X, -1)
})
radio.onDataPacketReceived( ({ receivedString: name, receivedNumber: value }) => {
import csv
import omero
from omero.gateway import BlitzGateway, TagAnnotationWrapper, MapAnnotationWrapper
conn = BlitzGateway("username", "password", host='localhost', port=4064)
conn.connect()
DATASET = 25403
NAMESPACE = "map.annotation.from.csv"
@will-moore
will-moore / test_import_cli.py
Created June 19, 2018 15:00
An OMERO.script that imports an image via the CLI
import sys
import subprocess
from path import path
import omero.scripts as scripts
from omero.gateway import BlitzGateway
import omero.util.script_utils as script_utils
import omero
from omero.rtypes import rint, rlong, rstring, robject, unwrap
@will-moore
will-moore / rois_to_centre_points.py
Last active February 5, 2019 05:42
Script to process OMERO Polygons, creating a Point at the centre of each Polygon (with Polygon ID as Point label)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import omero
from omero.rtypes import rdouble, rint, rstring, unwrap
from omero.gateway import BlitzGateway
USERNAME = 'username'
PASSWORD = 'password'
HOST = 'localhost'