Table Of Contents

Previous topic

omero.fs package

Next topic

omero.gateway.scripts package

This Page

omero.gateway package

Submodules

omero.gateway.pytest_fixtures module

conftest.py - py.test fixtures for gatewaytest

Copyright 2013 Glencoe Software, Inc. All rights reserved. Use is subject to license terms supplied in LICENSE.txt

class omero.gateway.pytest_fixtures.GatewayWrapper

Bases: omero.gateway.scripts.testdb_create.TestDBHelper

createTestImg_generated()
omero.gateway.pytest_fixtures.author_testimg(request, gatewaywrapper)

logs in as Author and returns the test image, creating it first if needed.

omero.gateway.pytest_fixtures.author_testimg_bad(request, gatewaywrapper)

logs in as Author and returns the test image, creating it first if needed.

omero.gateway.pytest_fixtures.author_testimg_big(request, gatewaywrapper)

logs in as Author and returns the test image, creating it first if needed.

omero.gateway.pytest_fixtures.author_testimg_generated(request, gatewaywrapper)

logs in as Author and returns the test image, creating it first if needed.

omero.gateway.pytest_fixtures.author_testimg_tiny(request, gatewaywrapper)

logs in as Author and returns the test image, creating it first if needed.

omero.gateway.pytest_fixtures.author_testimg_tiny2(request, gatewaywrapper)

logs in as Author and returns the test image, creating it first if needed.

omero.gateway.pytest_fixtures.gatewaywrapper(request)

Returns a test helper gateway object.

omero.gateway.utils module

class omero.gateway.utils.GatewayConfig

Bases: object

Global Gateway configuration:

  • IMG_RDEFNS: a namespace for annotations linked on images holding

    the default rendering settings object id.

  • IMG_ROPTSNS: a namespace for annotations linked on images holding

    default rendering options that don’t get saved in the rendering settings.

class omero.gateway.utils.ServiceOptsDict(data=None, *args, **kwargs)

Bases: dict

_testItem(item)
clear()

Remove all items from the dictionary.

copy()

Returns a copy of this object.

get(key, default=None)

Return the value for key if key is in the dictionary, else default. If default is not given, it defaults to None, so that this method never raises a KeyError.

getOmeroGroup()
getOmeroShare()
getOmeroUser()
set(key, value)

Set key to value as string.

setOmeroGroup(value=None)
setOmeroShare(value=None)
setOmeroUser(value=None)
omero.gateway.utils.propertiesToDict(m, prefix=None)

Convert omero properties to nested dictionary, skipping common prefix

omero.gateway.utils.toBoolean(val)

Get the boolean value of the provided input.

If the value is a boolean return the value. Otherwise check to see if the value is in [“true”, “yes”, “y”, “t”, “1”] and returns True if value is in the list

Module contents

alias of _AnnotationLinkWrapper

class omero.gateway.AnnotationWrapper(*args, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_AnnotationI class wrapper extends BlitzObjectWrapper.

OMERO_TYPE = None
classmethod _getQueryString(opts=None)

Used for building queries in generic methods such as getObjects(“Annotation”) Returns a tuple of (query, clauses, params).

Parameters:opts – Dictionary of optional parameters. NB: No options supported for this class.
Returns:Tuple of string, list, ParametersI
classmethod _register(regklass)

Adds the AnnotationWrapper regklass to class registry

Parameters:regklass (AnnotationWrapper subclass) – The wrapper class, E.g. DoubleAnnotationWrapper
classmethod _wrap(conn=None, obj=None, link=None)

Class method for creating AnnotationWrapper subclasses based on the type of annotation object, using previously registered mapping between OMERO types and wrapper classes

Parameters:
  • conn (BlitzGateway) – The BlitzGateway connection
  • obj (omero.model.Annotation subclass) – The OMERO annotation object. E.g. omero.model.DoubleAnnotation
  • link (E.g. omero.model.DatasetAnnotationLink) – The link for this annotation
Returns:

Wrapped AnnotationWrapper object or None if obj.__class__ not registered

Return type:

AnnotationWrapper subclass

Class method for creating an instance of this AnnotationWrapper, setting ns and value and linking to the target.

Parameters:
  • target (BlitzObjectWrapper subclass) – The object to link annotation to
  • ns (String) – Annotation namespace
  • val – Value of annotation. E.g Long, Text, Boolean etc.
getNs()

Gets annotation namespace

Returns:Namespace or None
Return type:String
getValue()

Needs to be implemented by subclasses

registry = {<class 'omero.model.FileAnnotationI'>: <class 'omero.gateway.FileAnnotationWrapper'>, <class 'omero.model.TimestampAnnotationI'>: <class 'omero.gateway.TimestampAnnotationWrapper'>, <class 'omero.model.XmlAnnotationI'>: <class 'omero.gateway.XmlAnnotationWrapper'>, <class 'omero.model.DoubleAnnotationI'>: <class 'omero.gateway.DoubleAnnotationWrapper'>, <class 'omero.model.BooleanAnnotationI'>: <class 'omero.gateway.BooleanAnnotationWrapper'>, <class 'omero.model.LongAnnotationI'>: <class 'omero.gateway.LongAnnotationWrapper'>, <class 'omero.model.MapAnnotationI'>: <class 'omero.gateway.MapAnnotationWrapper'>, <class 'omero.model.TagAnnotationI'>: <class 'omero.gateway.TagAnnotationWrapper'>, <class 'omero.model.TermAnnotationI'>: <class 'omero.gateway.TermAnnotationWrapper'>, <class 'omero.model.CommentAnnotationI'>: <class 'omero.gateway.CommentAnnotationWrapper'>}
setNs(val)

Sets annotation namespace

Parameters:val (String) – Namespace value
setValue(val)

Needs to be implemented by subclasses

omero.gateway.ArcWrapper

alias of _ArcWrapper

omero.gateway.BinningWrapper

alias of _BinningWrapper

omero.gateway.BlitzGateway

alias of _BlitzGateway

class omero.gateway.BlitzObjectWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: object

Object wrapper class which provides various methods for hierarchy traversing, saving, handling permissions etc. This is the ‘abstract’ super class which is subclassed by E.g. _ProjectWrapper, _DatasetWrapper etc. All objects have a reference to the BlitzGateway connection, and therefore all services are available for handling calls on the object wrapper. E.g listChildren() uses queryservice etc.

CHILD_WRAPPER_CLASS = None
OMERO_CLASS = None
PARENT_WRAPPER_CLASS = None

Checks links are loaded and returns a list of Annotation Links filtered by namespace if specified

Parameters:ns (String) – Namespace
Returns:List of Annotation Links on this object
Return type:List of Annotation Links
_getChildWrapper()

Returns the wrapper class of children of this object. Checks that this is one of the Wrapper objects in the omero.gateway module Raises NotImplementedError if this is not true or class is not defined (None) This is used internally by the listChildren() and countChildren() methods.

Returns:The child wrapper class. E.g. omero.gateway.DatasetWrapper.__class__
Return type:class
_getParentWrappers()

Returns the wrapper classes of the parent of this object. This is used internally by the listParents() method.

Returns:List of parent wrapper classes. E.g. omero.gateway.DatasetWrapper.__class__
Return type:class
classmethod _getQueryString(opts=None)

Used for building queries in generic methods such as getObjects(“Project”). Returns a tuple of (query, clauses, params). Overridden by sub-classes to specify loading of different portions of the graph. Different sub-classes may allow some control over what’s loaded and filtering of the query using various opts arguments. Opts: See different sub-classes for additional opts.

Parameters:opts – Dictionary of optional parameters.
Returns:Tuple of string, list, ParametersI
_linkAnnotation(ann)

Saves the annotation to DB if needed, setting the permissions manually. Creates the annotation link and saves it, setting permissions manually. TODO: Can’t set permissions manually in 4.2

  • Assumes world & group writable
Parameters:ann (AnnotationWrapper) – The annotation object
_linkObject(obj, lnkobjtype)

Saves the object to DB if needed - setting the permissions manually. Creates the object link and saves it, setting permissions manually. TODO: Can’t set permissions manually in 4.2

  • Assumes world & group writable
Parameters:obj (BlitzObjectWrapper) – The object to link
_listChildren(ns=None, val=None, params=None)

Lists available child objects.

Return type:generator of Ice client proxy objects for the child nodes
Returns:child objects.

Loads the annotation links and annotations for the object (if not already loaded) and saves them to the object. Also loads file for file annotations.

Moves this object from a parent container (first one if there are more than one) to a new parent. TODO: might be more useful if it didn’t assume only 1 parent - option allowed you to specify the oldParent.

Parameters:newParent – The new parent Object Wrapper.
Returns:True if moved from parent to parent. False if no parent exists or newParent has mismatching type
Return type:Boolean
_unwrapunits(obj, units=None)

Returns the value of the Value + Unit object. If units is true, return the omero model unit object, e.g. omero.model.LengthI e.g. _unwrapunits(obj).getValue() == 10 e.g. _unwrapunits(obj).getUnit() == NANOMETER # unit enum e.g. _unwrapunits(obj).getSymbol() == “nm” If units specifies a valid unit for the type of value, then we convert E.g. _unwrapunits(obj, units=”MICROMETER”).getValue() == 10000

Parameters:
  • obj – The Value + Unit object
  • default – Default value if obj is None
  • units – If true, return (value, unit) tuple
Returns:

Value or omero.model units

canAnnotate()

Determines if the current user can annotate this object: ie create annotation links. The canAnnotate() property is set on the permissions of every object as it is read from the server, based on the current user, event context and group permissions.

Return type:Boolean
Returns:True if user can Annotate this object
canChgrp()

Specifies whether the current user can move this object to another group. Web client will only allow this for the data Owner. Admin CAN move other user’s data, but we don’t support this in Web yet.

canDelete()

Determines if the current user can Delete the object

canEdit()

Determines if the current user can Edit (E.g. name, description) link (E.g. Project, Dataset, Image etc) or Delete this object. The canEdit() property is set on the permissions of every object as it is read from the server, based on the current user, event context and group permissions.

Return type:Boolean
Returns:True if user can Edit this object Delete, link etc.

Determines whether user can create ‘hard’ links (Not annotation links). E.g. Between Project/Dataset/Image etc. Previously (4.4.6 and earlier) we only allowed this for object owners, but now we delegate to what the server will allow.

canOwnerWrite()

Delegates to the connection BlitzGateway.canWrite() method

Return type:Boolean
Returns:True if the objects’s permissions allow owner to write
canWrite()

Delegates to the connection BlitzGateway.canWrite() method

Return type:Boolean
countChildren()

Counts available number of child objects.

Returns:The number of child objects available
Return type:Long
countChildren_cached()

countChildren, but caching the first result, useful if you need to call this multiple times in a single sequence, but have no way of storing the value between them. It is actually a hack to support django template’s lack of break in for loops

Returns:The number of child objects available
Return type:Long
creationEventDate()

Gets event time in timestamp format (yyyy-mm-dd hh:mm:ss.fffffff) when object was created.

Returns:The datetime for object creation
Return type:datetime.datetime
findChildByName(name, description=None)

Find the first child object with a matching name, and description if specified.

Parameters:
  • name – The name which must match the child name
  • description – If specified, child description must match too
Returns:

The wrapped child object

Return type:

BlitzObjectWrapper

getAncestry()

Get a list of Ancestors. First in list is parent of this object. TODO: Assumes getParent() returns a single parent.

Return type:List of BlitzObjectWrapper
Returns:List of Ancestor objects
getAnnotation(ns=None)

Gets the first annotation on the object, filtered by ns if specified

Parameters:ns (String) – Namespace
Returns:AnnotationWrapper or None
getAnnotationCounts()

Get the annotion counts for the current object

Get a list of child objects links.

Parameters:chids (Long) – List of children IDs
Return type:List of BlitzObjectWrapper
Returns:List of child object links
getDate()

Returns the object’s acquisitionDate, or creation date (details.creationEvent.time)

Returns:A datetime.datetime() object
Return type:datetime
getDescription()

Gets this object description

Returns:String
getDetails()

Gets the details of the wrapped object

Returns:DetailsWrapper or None if object not loaded
Return type:DetailsWrapper
getId()

Gets this object ID

Returns:Long or None
getName()

Gets this object name

Returns:String or None
getOwner()

Gets user who is the owner of this object.

Returns:_ExperimenterWrapper
getOwnerFullName()

Gets full name of the owner of this object.

Returns:String or None
getOwnerOmeName()

Gets omeName of the owner of this object.

Returns:String
getParent(withlinks=False)

List a single parent, if available.

While the model supports many to many relationships between most objects, there are implementations that assume a single project per dataset, a single dataset per image, etc. This is just a shortcut method to return a single parent object.

Parameters:withlinks (Boolean) – if true result will be a tuple of (linkobj, obj)
Return type:BlitzObjectWrapper or tuple(BlitzObjectWrapper, BlitzObjectWrapper)
Returns:the parent object with or without the link depending on args

Get a list of parent objects links.

Parameters:pids (Long) – List of parent IDs
Return type:List of BlitzObjectWrapper
Returns:List of parent object links
isLeaded()

Returns True if the group that this object belongs to is lead by the currently logged-in user

Return type:Boolean
Returns:see above
isOwned()

Returns True if the object owner is the same user specified in the connection’s Event Context

Return type:Boolean
Returns:True if current user owns this object
isPrivate()

Determines if the object is private

Return type:Boolean
Returns:True if the object is not public and not shared and permissions allow user to read.
isPublic()

Determines if the object permissions are world readable, ie permissions.isWorldRead()

Return type:Boolean
Returns:see above
isShared()

Determines if the object is sharable between groups (but not public)

Return type:Boolean
Returns:True if the object is not public AND the object permissions allow group read.
linkAnnotation(ann, sameOwner=False)

Link the annotation to this object.

Parameters:
  • ann (AnnotationWrapper) – The Annotation object
  • sameOwner (Boolean) – If True, try to make sure that the link is created by the object owner
Returns:

The annotation

Return type:

AnnotationWrapper

listAnnotations(ns=None)

List annotations in the ns namespace, linked to this object

Returns:Generator yielding AnnotationWrapper
Return type:AnnotationWrapper generator
listChildren(ns=None, val=None, params=None)

Lists available child objects.

Return type:generator of BlitzObjectWrapper objs
Returns:child objects.
listOrphanedAnnotations(eid=None, ns=None, anntype=None, addedByMe=True)

Retrieve all Annotations not linked to the given Project, Dataset, Image, Screen, Plate, Well ID controlled by the security system.

Parameters:
  • o_type (String) – type of Object
  • oid (Long) – Object ID
Returns:

Generator yielding Tags

Return type:

AnnotationWrapper generator

listParents(withlinks=False)

Lists available parent objects.

Parameters:withlinks (Boolean) – if true each yielded result will be a tuple of (linkobj, obj)
Return type:list of BlitzObjectWrapper or tuple(BlitzObjectWrapper, BlitzObjectWrapper)
Returns:the parent objects, with or without the links depending on args
removeAnnotations(ns)

Uses the delete service to delete annotations, with a specified ns, and their links on the object and any other objects. Will raise a omero.LockTimeout if the annotation removal has not finished in 5 seconds.

Parameters:ns (String) – Namespace
save()

Uses the updateService to save the wrapped object.

Return type:None
saveAs(details)

Save this object, keeping the object owner the same as the one on provided details If the current user is an admin but is NOT the owner specified in ‘details’, then create a new connection for that owner, clone the current object under that connection and save. Otherwise, simply save.

Parameters:details (DetailsWrapper) – The Details specifying owner to save to
Returns:None
setDescription(value)

Sets the description of the object

Parameters:value (String) – New description
setName(value)

Sets the name of the object

Parameters:value (String) – New name
simpleMarshal(xtra=None, parents=False)

Creates a dict representation of this object. E.g. for Image:

{'description': '', 'author': 'Will Moore', 'date': 1286332557.0,
'type': 'Image', 'id': 3841L, 'name': 'cb_4_w500_t03_z01.tif'}
Parameters:
  • xtra (Dict) – A dict of extra keys to include. E.g. ‘childCount’
  • parents (Boolean) – If True, include a list of ancestors (in simpleMarshal form) as ‘parents’
Returns:

A dict representation of this object

Return type:

Dict

unlinkAnnotations(ns)

Submits request to unlink annotations, with specified ns

Parameters:ns (String) – Namespace
updateEventDate()

Gets event time in timestamp format (yyyy-mm-dd hh:mm:ss.fffffff) when object was updated.

Returns:The datetime for object update
Return type:datetime.datetime
class omero.gateway.BooleanAnnotationWrapper(*args, **kwargs)

Bases: omero.gateway.AnnotationWrapper

omero_model_BooleanAnnotationI class wrapper extends AnnotationWrapper.

OMERO_TYPE

alias of BooleanAnnotationI

classmethod _getQueryString(opts=None)

Used for building queries in generic methods such as getObjects(“BooleanAnnotation”). Returns a tuple of (query, clauses, params).

Parameters:opts – Dictionary of optional parameters. NB: No options supported for this class.
Returns:Tuple of string, list, ParametersI
getValue()

Gets boolean value

Returns:Value
Return type:Boolean
setValue(val)

Sets boolean value

Parameters:val (Boolean) – Value
omero.gateway.ChannelWrapper

alias of _ChannelWrapper

class omero.gateway.ColorHolder(colorname=None)

Bases: object

Stores color internally as (R,G,B,A) and allows setting and getting in multiple formats

_color = {'blue': 0, 'alpha': 255, 'green': 0, 'red': 0}
classmethod fromRGBA(r, g, b, a)

Class method for creating a ColorHolder from r,g,b,a values

Parameters:
  • r (int) – red 0 - 255
  • g (int) – green 0 - 255
  • b (int) – blue 0 - 255
  • a (int) – alpha 0 - 255
Returns:

new Color object

Return type:

ColorHolder

getAlpha()

Gets the Alpha component

Returns:alpha
Return type:int
getBlue()

Gets the Blue component

Returns:blue
Return type:int
getCss()

Gets the css string: rgba(r,g,b,a)

Returns:css color
Return type:String
getGreen()

Gets the Green component

Returns:green
Return type:int
getHtml()

Gets the html usable color. Dumps the alpha information. E.g. ‘FF0000’

Returns:html color
Return type:String
getInt()

Returns the color as an Integer

Returns:Integer
Return type:int
getRGB()

Gets the (r,g,b) as a tuple.

Returns:Tuple of (r,g,b) values
Return type:tuple of ints
getRed()

Gets the Red component

Returns:red
Return type:int
setAlpha(val)

Set alpha, as int 0..255.

Parameters:val – value of alpha.
setBlue(val)

Set Blue, as int 0..255

Parameters:val (Int) – value of Blue.
setGreen(val)

Set green, as int 0..255

Parameters:val (Int) – value of Green.
setRed(val)

Set red, as int 0..255

Parameters:val (Int) – value of Red.
class omero.gateway.CommentAnnotationWrapper(*args, **kwargs)

Bases: omero.gateway.AnnotationWrapper

omero_model_CommentAnnotationI class wrapper extends AnnotationWrapper.

OMERO_TYPE

alias of CommentAnnotationI

classmethod _getQueryString(opts=None)

Used for building queries in generic methods such as getObjects(“CommentAnnotation”). Returns a tuple of (query, clauses, params).

Parameters:opts – Dictionary of optional parameters. NB: No options supported for this class.
Returns:Tuple of string, list, ParametersI
getValue()

Gets the value of the Comment

Returns:Value
Type:String
setValue(val)

Sets comment text value

Parameters:val (String) – Value
omero.gateway.DatasetWrapper

alias of _DatasetWrapper

class omero.gateway.DetailsWrapper(*args, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_DetailsI class wrapper extends BlitzObjectWrapper.

getGroup()

Returns the Group that these details refer to

Returns:Group
Return type:ExperimenterGroupWrapper
getOwner()

Returns the Owner of the object that these details apply to

Returns:Owner
Return type:ExperimenterWrapper
omero.gateway.DetectorSettingsWrapper

alias of _DetectorSettingsWrapper

omero.gateway.DetectorWrapper

alias of _DetectorWrapper

omero.gateway.DichroicWrapper

alias of _DichroicWrapper

class omero.gateway.DoubleAnnotationWrapper(*args, **kwargs)

Bases: omero.gateway.AnnotationWrapper

omero_model_DoubleAnnotationI class wrapper extends AnnotationWrapper.

OMERO_TYPE

alias of DoubleAnnotationI

classmethod _getQueryString(opts=None)

Used for building queries in generic methods such as getObjects(“DoubleAnnotation”). Returns a tuple of (query, clauses, params).

Parameters:opts – Dictionary of optional parameters. NB: No options supported for this class.
Returns:Tuple of string, list, ParametersI
getValue()

Gets the value of the Double Annotation

Returns:Value
Type:Double
setValue(val)

Sets Double annotation value

Parameters:val (Double) – Value
omero.gateway.EnumerationWrapper

alias of _EnumerationWrapper

omero.gateway.ExperimenterGroupWrapper

alias of _ExperimenterGroupWrapper

omero.gateway.ExperimenterWrapper

alias of _ExperimenterWrapper

omero.gateway.FilamentWrapper

alias of _FilamentWrapper

class omero.gateway.FileAnnotationWrapper(*args, **kwargs)

Bases: omero.gateway.AnnotationWrapper, omero.gateway.OmeroRestrictionWrapper

omero_model_FileAnnotationI class wrapper extends AnnotationWrapper.

OMERO_TYPE

alias of FileAnnotationI

_attrs = ('file|OriginalFileWrapper',)
classmethod _getQueryString(opts=None)

Used for building queries in generic methods such as getObjects(“FileAnnotation”). Returns a tuple of (query, clauses, params).

Parameters:opts – Dictionary of optional parameters. NB: No options supported for this class.
Returns:Tuple of string, list, ParametersI
getFile()

Returns an OriginalFileWrapper for the file. Wrapper object will load the file if it isn’t already loaded. File is cached to prevent repeated loading of the file.

getFileInChunks(buf=2621440)

Returns a generator yielding chunks of the file data.

Returns:Data from file in chunks
Return type:Generator
getFileName()

Gets the file name

Returns:File name
Return type:String
getFileSize()

Looks up the size of the file in bytes

Returns:File size (bytes)
Return type:Long
getValue()

Not implemented

isOriginalMetadata()

Checks if this file annotation is an ‘original_metadata’ file

Returns:True if namespace and file name follow metadata convention
Return type:Boolean
setDescription(val)
setFile(originalfile)
setValue(val)

Not implemented

omero.gateway.FilesetWrapper

alias of _FilesetWrapper

omero.gateway.FilterSetWrapper

alias of _FilterSetWrapper

omero.gateway.FilterWrapper

alias of _FilterWrapper

omero.gateway.ImageStageLabelWrapper

alias of _ImageStageLabelWrapper

omero.gateway.ImageWrapper

alias of _ImageWrapper

omero.gateway.ImagingEnviromentWrapper

alias of _ImagingEnviromentWrapper

omero.gateway.ImagingEnvironmentWrapper

alias of _ImagingEnvironmentWrapper

omero.gateway.InstrumentWrapper

alias of _InstrumentWrapper

omero.gateway.LaserWrapper

alias of _LaserWrapper

omero.gateway.LightEmittingDiodeWrapper

alias of _LightEmittingDiodeWrapper

omero.gateway.LightPathWrapper

alias of _LightPathWrapper

omero.gateway.LightSettingsWrapper

alias of _LightSettingsWrapper

omero.gateway.LightSourceWrapper(conn, obj, **kwargs)

Creates wrapper instances for omero.model light source objects

Parameters:
  • connBlitzGateway connection
  • obj – omero.model object
Returns:

_LightSourceWrapper subclass

omero.gateway.LogicalChannelWrapper

alias of _LogicalChannelWrapper

class omero.gateway.LongAnnotationWrapper(*args, **kwargs)

Bases: omero.gateway.AnnotationWrapper

omero_model_LongAnnotationI class wrapper extends AnnotationWrapper.

OMERO_TYPE

alias of LongAnnotationI

classmethod _getQueryString(opts=None)

Used for building queries in generic methods such as getObjects(“LongAnnotation”). Returns a tuple of (query, clauses, params).

Parameters:opts – Dictionary of optional parameters. NB: No options supported for this class.
Returns:Tuple of string, list, ParametersI
getValue()

Gets the value of the Long annotation

Returns:Value
Type:Long
setValue(val)

Sets long annotation value

Parameters:val (Long) – Value
class omero.gateway.MapAnnotationWrapper(*args, **kwargs)

Bases: omero.gateway.AnnotationWrapper

omero_model_MapAnnotationI class wrapper.

OMERO_TYPE

alias of MapAnnotationI

getValue()

Gets the value of the Map Annotation as a list of (key, value) tuples.

Returns:List of tuples
Type:String
setValue(val)

Sets value of the Map Annotation where val is a list of (key, value) tuples or [key, value] lists.

Parameters:val (String) – List of tuples
omero.gateway.MicroscopeWrapper

alias of _MicroscopeWrapper

class omero.gateway.NoProxies

Bases: object

A dummy placeholder to indicate that proxies haven’t been created

values()
omero.gateway.OTFWrapper

alias of _OTFWrapper

omero.gateway.ObjectiveSettingsWrapper

alias of _ObjectiveSettingsWrapper

omero.gateway.ObjectiveWrapper

alias of _ObjectiveWrapper

class omero.gateway.OmeroGatewaySafeCallWrapper(proxyObjectWrapper, attr, f)

Bases: object

Function or method wrapper that handles certain types of server side exceptions and debugging of errors.

debug(exc_class, args, kwargs)
handle_exception(e, *args, **kwargs)

Exception handler that is expected to be overridden by sub-classes. The expected behaviour is either to handle a type of exception and return the server side result or to raise the already thrown exception. The calling context is an except block and the original *args and **kwargs from the wrapped function or method are provided to allow re-execution of the original.

Parameters:e (Exception) – The exception that has already been raised.
class omero.gateway.OmeroRestrictionWrapper

Bases: object

canDownload()

Determines if the current user can Download raw data linked to this object. The canDownload() property is set on objects: Image, Plate and FileAnnotation as it is read from the server, based on the current user, event context and group permissions.

Return type:Boolean
Returns:True if user can download.
omero.gateway.OriginalFileWrapper

alias of _OriginalFileWrapper

omero.gateway.PixelsWrapper

alias of _PixelsWrapper

omero.gateway.PlaneInfoWrapper

alias of _PlaneInfoWrapper

omero.gateway.PlateAcquisitionWrapper

alias of _PlateAcquisitionWrapper

omero.gateway.PlateWrapper

alias of _PlateWrapper

omero.gateway.ProjectWrapper

alias of _ProjectWrapper

class omero.gateway.ProxyObjectWrapper(conn, func_str, cast_to=None, service_name=None)

Bases: object

Wrapper for services. E.g. Admin Service, Delete Service etc. Maintains reference to connection. Handles creation of service when requested.

_connect(forcejoin=False)

Returns True if connected. If connection OK, wrapped service is also created.

Parameters:forcejoin (Boolean) – if True forces the connection to only succeed if we can rejoin the current sessionid
Returns:True if connection OK
Return type:Boolean
_getObj()

Returns the wrapped service. If it is None, service is created.

Returns:The wrapped service
Return type:omero.api.ServiceInterface subclass
_ping()

For some reason, it seems that keepAlive doesn’t, so every so often I need to recreate the objects. Calls serviceFactory.keepAlive(service). If this returns false, attempt to create service.

Returns:True if no exception thrown
Return type:Boolean
_resyncConn(conn)

Reset refs to connection and session factory. Resets session creation function. Attempts to reload the wrapped service - if already created (doesn’t create service)

Parameters:conn (BlitzGateway) – Connection
clone()

Creates and returns a new ProxyObjectWrapper with the same connection and service creation method name as this one.

Returns:Cloned service wrapper
Return type:ProxyObjectWrapper
close(*args, **kwargs)

Closes the underlying service, so next call to the proxy will create a new instance of it.

taint()

Sets the tainted flag to True

untaint()

Sets the tainted flag to False

omero.gateway.RoiWrapper

alias of _RoiWrapper

omero.gateway.SafeCallWrapper

alias of OmeroGatewaySafeCallWrapper

omero.gateway.ScreenWrapper

alias of _ScreenWrapper

omero.gateway.ShapeWrapper

alias of _ShapeWrapper

class omero.gateway.TagAnnotationWrapper(*args, **kwargs)

Bases: omero.gateway.AnnotationWrapper

omero_model_BooleanAnnotationI class wrapper extends AnnotationWrapper.

OMERO_TYPE

alias of TagAnnotationI

classmethod _getQueryString(opts=None)

Used for building queries in generic methods such as getObjects(“TagAnnotation”). Returns a tuple of (query, clauses, params).

Parameters:opts – Dictionary of optional parameters. NB: No options supported for this class.
Returns:Tuple of string, list, ParametersI
countTagsInTagset()
getValue()

Gets the value of the Tag

Returns:Value
Type:String
listParents(withlinks=True)

We override the listParents() to look for ‘Tag-Group’ Tags on this Tag

listTagsInTagset()
setValue(val)

Sets Tag value

Parameters:val (String) – Tag text value
class omero.gateway.TermAnnotationWrapper(*args, **kwargs)

Bases: omero.gateway.AnnotationWrapper

omero_model_TermAnnotationI class wrapper extends AnnotationWrapper.

only in 4.2+

OMERO_TYPE

alias of TermAnnotationI

classmethod _getQueryString(opts=None)

Used for building queries in generic methods such as getObjects(“TermAnnotation”). Returns a tuple of (query, clauses, params).

Parameters:opts – Dictionary of optional parameters. NB: No options supported for this class.
Returns:Tuple of string, list, ParametersI
getValue()

Gets the value of the Term

Returns:Value
Type:String
setValue(val)

Sets term value

Parameters:val (String) – Value
class omero.gateway.TimestampAnnotationWrapper(*args, **kwargs)

Bases: omero.gateway.AnnotationWrapper

omero_model_TimestampAnnotationI class wrapper extends AnnotationWrapper.

OMERO_TYPE

alias of TimestampAnnotationI

classmethod _getQueryString(opts=None)

Used for building queries in generic methods such as getObjects(“TimestampAnnotation”). Returns a tuple of (query, clauses, params).

Parameters:opts – Dictionary of optional parameters. NB: No options supported for this class.
Returns:Tuple of string, list, ParametersI
getValue()

Returns a datetime object of the timestamp in seconds

Returns:Timestamp value
Return type:datetime.datetime
setValue(val)

Sets the timestamp value

Parameters:val (datetime.datetime OR omero.RTime OR Long) – Timestamp value
omero.gateway.TransmittanceRangeWrapper

alias of _TransmittanceRangeWrapper

omero.gateway.WellSampleWrapper

alias of _WellSampleWrapper

omero.gateway.WellWrapper

alias of _WellWrapper

class omero.gateway.XmlAnnotationWrapper(*args, **kwargs)

Bases: omero.gateway.CommentAnnotationWrapper

omero_model_XmlAnnotationI class wrapper extends CommentAnnotationWrapper.

OMERO_TYPE

alias of XmlAnnotationI

Bases: omero.gateway.BlitzObjectWrapper

omero_model_AnnotationLinkI class wrapper extends omero.gateway.BlitzObjectWrapper.

getAnnotation()
getParent()

Gets the parent (Annotated Object) as a BlitzObjectWrapper, but attempts to wrap it in the correct subclass using L{KNOWN_WRAPPERS}, E.g. ImageWrapper

class omero.gateway._ArcWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway._FilamentWrapper

omero_model_ArcI class wrapper extends FilamentWrapper.

OMERO_CLASS = 'Arc'
class omero.gateway._BinningWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_BinningI class wrapper extends BlitzObjectWrapper.

OMERO_CLASS = 'Binning'
class omero.gateway._BlitzGateway(username=None, passwd=None, client_obj=None, group=None, clone=False, try_super=False, host=None, port=None, extra_config=None, secure=False, anonymous=True, useragent=None, userip=None)

Bases: object

Connection wrapper. Handles connecting and keeping the session alive, creation of various services, context switching, security privileges etc.

ICE_CONFIG = '/opt/hudson/workspace/OMERO-DEV-release/src/dist/etc/ice.config'

ICE_CONFIG - Defines the path to the Ice configuration

_closeSession()

Close session.

_createProxies()

Creates proxies to the server services. Called on connection or security switch. Doesn’t actually create any services themselves. Created if/when needed. If proxies have been created already, they are resynced and reused.

_createSession()

Creates a new session for the principal given in the constructor. Used during :meth`connect` method

_getSessionId()
_resetOmeroClient()

Creates new omero.client object using self.host or self.ice_config (if host is None) Also tries to setAgent for the client

_waitOnCmd(handle, loops=10, ms=500, failonerror=True, failontimeout=False, closehandle=False)
applySettingsToSet(fromid, to_type, toids)

Applies the rendering settings from one image to others. Returns a dict of success { True:[ids], False:[ids] }

Parameters:
  • fromid – ID of Image to copy settings from.
  • toids – List of Image IDs to apply setting to.
  • to_type – toids refers to Images by default, but can refer to Project, Dataset, Image, Plate, Screen, Pixels
buildCountQuery(obj_type, opts=None)

Prepares a ‘projection’ query to count objects.

Based on buildQuery(), we modify the query to only return a count. Modified query does not ‘fetch’ any data or add any other unnecessary objects to query. We return just the query and omero.sys.ParametersI for the query.

Parameters:
  • obj_type – Object type, e.g. “Project” see above
  • opts – Dict of options for filtering by offset, limit and owner for all objects. Additional opts handled by _getQueryString() e.g. filter Dataset by ‘project’
Returns:

(query, params)

buildQuery(obj_type, ids=None, params=None, attributes=None, opts=None)

Prepares a query for iQuery. Also prepares params and determines appropriate wrapper for result Returns (query, params, wrapper) which can be used with the appropriate query method. Used by getObjects() and getObject() above.

Parameters:
  • obj_type (String) – Object type, e.g. “Project” see above
  • ids (List of Long) – object IDs
  • params – omero.sys.Parameters, can be used for pagination, & filtering by owner. Takes precedence over opts.
  • attributes – Dict of key-value pairs to filter results by. Key must be attribute of obj_type. E.g. ‘name’, ‘ns’
  • opts – Dict of additional options for filtering or defining extra data to load. offset, limit and owner for all objects. Also ‘order_by’: ‘obj.name’ to order results. Additional opts handled by _getQueryString() e.g. filter Dataset by ‘project’
Returns:

(query, params, wrapper)

canBeAdmin()

Checks if a user is in system group, i.e. can have administration privileges.

Returns:Boolean
canOwnerWrite(obj)

Returns isUserWrite() from the object’s permissions

Parameters:obj – Given object
Returns:True if the objects’s permissions allow owner to write
canWrite(obj)

Checks if a user has write privileges to the given object.

Parameters:obj – Given object
Returns:Boolean
chgrpObjects(graph_spec, obj_ids, group_id, container_id=None)

Change the Group for a specified objects using queue.

Parameters:
  • graph_spec

    String to indicate the object type or graph specification. Examples include:

    • ‘Image’
    • ‘Project’ # will move contents too.
    • NB: Also supports ‘/Image’ etc for backwards compatibility.
  • obj_ids – IDs for the objects to move.
  • group_id – The group to move the data to.
chmodGroup(group_Id, permissions)

Change the permissions of a particular Group. Returns the proxy ‘prx’ handle that can be processed like this: callback = CmdCallbackI(self.gateway.c, prx) callback.loop(20, 500) rsp = prx.getResponse()

clone()

Returns a new instance of this class, with all matching properties. TODO: Add anonymous and userAgent parameters?

Returns:Clone of this connection wrapper
Return type:_BlitzGateway
close()

Terminates connection with killSession(). The session is terminated regardless of its connection refcount.

connect(sUuid=None)

Creates or retrieves connection for the given sessionUuid. Returns True if connected.

Parameters:sUuid – omero_model_SessionI
Returns:Boolean
containedExperimenters(gid)

Fetch all users contained in this group. The returned users will have all fields filled in and all collections unloaded.

Parameters:gid (Long) – Group ID
Returns:Generator of experimenters
Return type:ExperimenterWrapper generator
countAnnotations(obj_type, obj_ids=[])

Count the annotions linked to the given objects

Parameters:
  • obj_type – The type of the object the annotations are linked to
  • obj_ids – List of object ids
Returns:

Dictionary of annotation counts per annotation type

createEnumeration(obj)

Create an enumeration with given object

Parameters:obj (omero.model.IObject) – Object
createExporter()

New instance of non cached Exporter, wrapped in ProxyObjectWrapper.

Returns:omero.gateway.ProxyObjectWrapper
createFileAnnfromLocalFile(localPath, origFilePathAndName=None, mimetype=None, ns=None, desc=None)

Class method to create a FileAnnotationWrapper from a local file. File is uploaded to create an omero.model.OriginalFileI referenced from this File Annotation. Returns a new FileAnnotationWrapper

Parameters:
  • conn – Blitz connection
  • localPath – Location to find the local file to upload
  • origFilePathAndName – Provides the ‘path’ and ‘name’ of the OriginalFile. If None, use localPath
  • mimetype – The mimetype of the file. String. E.g. ‘text/plain’
  • ns – The namespace of the file.
  • desc – A description for the file annotation.
Returns:

New FileAnnotationWrapper

createGroup(name, owner_Ids=None, member_Ids=None, perms=None, description=None, ldap=False)

Creates a new ExperimenterGroup. Must have Admin permissions to call this.

Parameters:
  • name – New group name
  • owner_Ids – Option to add existing Experimenters as group owners
  • member_Ids – Option to add existing Experimenters as group members
  • perms – New group permissions. E.g. ‘rw—-‘ (private), ‘rwr—’(read-only), ‘rwrw–’
  • description – Group description
  • ldap – Group ldap setting
createImageFromNumpySeq(zctPlanes, imageName, sizeZ=1, sizeC=1, sizeT=1, description=None, dataset=None, sourceImageId=None, channelList=None)

Creates a new multi-dimensional image from the sequence of 2D numpy arrays in zctPlanes. zctPlanes should be a generator of numpy 2D arrays of shape (sizeY, sizeX) ordered to iterate through T first, then C then Z. Example usage:

original = conn.getObject("Image", 1)
sizeZ = original.getSizeZ()
sizeC = original.getSizeC()
sizeT = original.getSizeT()
clist = range(sizeC)
zctList = []
for z in range(sizeZ):
    for c in clist:
        for t in range(sizeT):
            zctList.append( (z,c,t) )
def planeGen():
    planes = original.getPrimaryPixels().getPlanes(zctList)
    for p in planes:
        # perform some manipulation on each plane
        yield p
createImageFromNumpySeq(
    planeGen(), imageName, sizeZ=sizeZ, sizeC=sizeC, sizeT=sizeT,
    sourceImageId=1, channelList=clist)
Parameters:
  • session – An OMERO service factory or equivalent with getQueryService() etc.
  • zctPlanes – A generator of numpy 2D arrays, corresponding to Z-planes of new image.
  • imageName – Name of new image
  • description – Description for the new image
  • dataset – If specified, put the image in this dataset. omero.model.Dataset object
  • sourceImageId – If specified, copy this image with metadata, then add pixel data
  • channelList – Copies metadata from these channels in source image (if specified). E.g. [0,2]
Returns:

The new OMERO image: omero.model.ImageI

createOriginalFileFromFileObj(fo, path, name, fileSize, mimetype=None, ns=None)

Creates a OriginalFileWrapper from a local file. File is uploaded to create an omero.model.OriginalFileI. Returns a new OriginalFileWrapper

Parameters:
  • conn – Blitz connection
  • fo – The file object
  • path – The file path
  • name – The file name
  • fileSize – The file size
  • mimetype – The mimetype of the file. String. E.g. ‘text/plain’
  • ns – The file namespace
Returns:

New OriginalFileWrapper

createOriginalFileFromLocalFile(localPath, origFilePathAndName=None, mimetype=None, ns=None)

Creates a OriginalFileWrapper from a local file. File is uploaded to create an omero.model.OriginalFileI. Returns a new OriginalFileWrapper

Parameters:
  • conn – Blitz connection
  • localPath – Location to find the local file to upload
  • origFilePathAndName – Provides the ‘path’ and ‘name’ of the OriginalFile. If None, use localPath
  • mimetype – The mimetype of the file. String. E.g. ‘text/plain’
  • ns – The namespace of the file.
Returns:

New OriginalFileWrapper

createRawFileStore()

Creates a new raw file store. This service is special in that it does not get cached inside BlitzGateway so every call to this function returns a new object, avoiding unexpected inherited states.

Returns:omero.gateway.ProxyObjectWrapper
createRawPixelsStore()

Creates a new raw pixels store. This service is special in that it does not get cached inside BlitzGateway so every call to this function returns a new object, avoiding unexpected inherited states.

Returns:omero.gateway.ProxyObjectWrapper
createRenderingEngine()

Creates a new rendering engine. This service is special in that it does not get cached inside BlitzGateway so every call to this function returns a new object, avoiding unexpected inherited states.

Returns:omero.gateway.ProxyObjectWrapper
createSearchService()

Gets a reference to the searching service on this connection object or creates a new one if none exists.

Returns:omero.gateway.ProxyObjectWrapper
createServiceOptsDict()
createThumbnailStore()

Gets a reference to the thumbnail store on this connection object or creates a new one if none exists.

Return type:omero.gateway.ProxyObjectWrapper
Returns:The proxy wrapper of the thumbnail store
deleteEnumeration(obj)

Deletes an enumeration object

Parameters:obj (omero.model.IObject) – Enumeration object
deleteObject(obj)

Delete a single object.

Parameters:obj (IObject) – Object to delete
deleteObjectDirect(obj)

Directly Delete object (removes row from database). This may fail with various constraint violations if the object is linked to others in the database

Parameters:obj (IObject) – Object to delete

** Deprecated ** Use deleteObject() or deleteObjects().

deleteObjects(graph_spec, obj_ids, deleteAnns=False, deleteChildren=False, dryRun=False, wait=False)

Generic method for deleting using the delete queue. Options allow to delete ‘independent’ Annotations (Tag, Term, File) and to delete child objects.

Parameters:
  • graph_spec

    String to indicate the object type or graph specification. Examples include:

    • ‘Project’
    • ‘Dataset’
    • ‘Image’
    • ‘Screen’
    • ‘Plate’
    • ‘Well’
    • ‘Annotation’
    • ‘OriginalFile’
    • ‘Roi’
    • ‘Image/Pixels/Channel’

    As of OMERO 4.4.0 the correct case is now explicitly required, the use of ‘project’ or ‘dataset’ is no longer supported.

  • obj_ids – List of IDs for the objects to delete
  • deleteAnns – If true, delete linked Tag, Term and File annotations
  • deleteChildren – If true, delete children. E.g. Delete Project AND it’s Datasets & Images.
Returns:

Delete handle

Return type:

omero.api.delete.DeleteHandle

findExperimenters(start='')

Return a generator for all Experimenters whose omeName starts with ‘start’. Experimenters ordered by omeName.

Parameters:start (String) – omeName must start with these letters
Returns:Generator of experimenters
Return type:ExperimenterWrapper generator
getAdminService()

Gets reference to the admin service from ProxyObjectWrapper.

Returns:omero.gateway.ProxyObjectWrapper
getAdministrators()

Returns Experimenters with administration privileges.

Returns:Current Experimenter
Returns:Generator of BlitzObjectWrapper subclasses
getAnnotationCounts(objDict={})

Get the annotion counts for the given objects

Retrieve Annotation Links by parent_type E.g. “Image”. Not Ordered. Returns generator of AnnotationLinkWrapper If parent_ids is None, all available objects will be returned. i.e. listObjects()

Parameters:
  • obj_type (String) – Object type, e.g. “Project” see above
  • ids (List of Long) – object IDs
Returns:

Generator yielding wrapped objects.

getArchivedFilesInfo(imageIds)

Gets summary of Original Files that are archived from OMERO 4 imports Returns a dict of files ‘count’ and sum of ‘size’

Parameters:imageIds – Image IDs list
Returns:Dict of files ‘count’ and ‘size’
getClientSettings()

Returns all client properties matching omero.client.*

getConfigService()

Gets reference to the config service from ProxyObjectWrapper.

Returns:omero.gateway.ProxyObjectWrapper
getContainerService()

Gets reference to the container service from ProxyObjectWrapper.

Returns:omero.gateway.ProxyObjectWrapper
getDefaultGroup(eid)

Retrieve the default group for the given user id.

Parameters:eid (Long) – Experimenter ID
Returns:The default group for user
Return type:ExperimenterGroupWrapper
getDefaultOmeroGroup()
getDefaultOmeroUser()
getDownloadAsMaxSizeSetting()

Returns default max size of images that can be downloaded as jpg, png or tiff, expressed as number of pixels. Default is 144000000 (12k * 12k image)

Returns:Integer
getEnumeration(klass, string)

Get enumeration by class and value

Parameters:
  • klass (Class or string) – Class
  • string (String) – Enum value
Returns:

Enumeration or None

Return type:

EnumerationWrapper

getEnumerationById(klass, eid)

Get enumeration by class and ID

Parameters:
  • klass (Class or string) – Class
  • eid (Long) – Enum ID
Returns:

Enumeration or None

Return type:

EnumerationWrapper

getEnumerationEntries(klass)

Get all enumerations by class

Parameters:klass (Class or string) – Class
Returns:Generator of Enumerations
Return type:EnumerationWrapper generator
getEnumerations()

Gets list of enumeration types

Returns:List of enum types
Return type:List of Strings
getEnumerationsWithEntries()

Get enumeration types, with lists of Enum entries

Returns:Dictionary of type: entries
Return type:Dict of <string: EnumerationWrapper list >
getEventContext()

Returns omero_System_ice.EventContext. It contains: shareId, sessionId, sessionUuid, userId, userName, groupId, groupName, isAdmin, isReadOnly, eventId, eventType, eventType, memberOfGroups, leaderOfGroups Also saves context to self._ctx

Returns:Event Context from admin service.
Return type:omero.sys.EventContext
getFilesetFilesInfo(imageIds)

Gets summary of Original Files that are part of the FS Fileset linked to images Returns a dict of files ‘count’ and sum of ‘size’

Parameters:imageIds – Image IDs list
Returns:Dict of files ‘count’ and ‘size’
getFreeSpace()

Returns the free or available space on this file system including nested subdirectories.

Returns:Free space in bytes
Return type:Int
getGroupFromContext()

Returns current omero_model_ExperimenterGroupI.

Returns:omero.model.ExperimenterGroupI
getGroupsLeaderOf()

Look up Groups where current user is a leader of.

Returns:Groups that current user leads
Return type:ExperimenterGroupWrapper generator
getGroupsMemberOf()

Look up Groups where current user is a member of (except “user” group).

Returns:Current users groups
Return type:ExperimenterGroupWrapper generator
getInitialZoomLevel()

Returns default initial zoom level set on the server.

getInterpolateSetting()

Returns default interpolation setting on the server. This is a string but represents a boolean, E.g. ‘true’

Returns:String
getLastError()

Returns error if thrown by _BlitzGateway.connect connect.

Returns:String
getMaxPlaneSize()

Returns the maximum plane size the server will allow for an image to not be considered big i.e. width or height larger than this will trigger image pyramids to be calculated.

This is useful for the client to filter images based on them needing pyramids or not, without the full rendering engine overhead.

Returns:tuple holding (max_plane_width, max_plane_height) as set on the server
Return type:Tuple
getMetadataService()

Gets reference to the metadata service from ProxyObjectWrapper.

Returns:omero.gateway.ProxyObjectWrapper
getObject(obj_type, oid=None, params=None, attributes=None, opts=None)

Retrieve single Object by type E.g. “Image” or None if not found. If more than one object found, raises ome.conditions.ApiUsageException See getObjects() for more info.

Parameters:
  • obj_type (String) – Object type, e.g. “Project” see above
  • ids (List of Long) – object IDs
  • params – omero.sys.Parameters, can be used for pagination, filtering etc.
  • attributes – Map of key-value pairs to filter results by. Key must be attribute of obj_type. E.g. ‘name’, ‘ns’
Returns:

getObjects(obj_type, ids=None, params=None, attributes=None, respect_order=False, opts=None)

Retrieve Objects by type E.g. “Image” Returns generator of appropriate BlitzObjectWrapper type. E.g. ImageWrapper. If ids is None, all available objects will be returned. i.e. listObjects() Filter objects by attributes. E.g. attributes={‘name’:name}

Parameters:
  • obj_type (String) – Object type, e.g. “Project” see above
  • ids (List of Long) – object IDs
  • params – omero.sys.Parameters, can be used for pagination, & filtering by owner. Takes precedence over opts.
  • attributes – Dict of key-value pairs to filter results by. Key must be attribute of obj_type. E.g. ‘name’, ‘ns’
  • respect_order – Returned items will be ordered according to the order of ids
  • opts – Dict of additional options for filtering or defining extra data to load. offset, limit and owner for all objects. Additional opts handled by _getQueryString() e.g. filter Dataset by ‘project’
Returns:

Generator of BlitzObjectWrapper subclasses

getObjectsByAnnotations(obj_type, annids)

Retrieve objects linked to the given annotation IDs controlled by the security system.

Parameters:annids (Long) – Annotation IDs
Returns:Generator yielding Objects
Return type:BlitzObjectWrapper generator
getOriginalEnumerations()

Gets original enumerations. Returns a dictionary of enumeration class: list of Enumerations

Returns:Original enums
Return type:Dict of <string: EnumerationWrapper list >
getOtherGroups(eid)

Fetch all groups of which the given user is a member. The returned groups will have all fields filled in and all collections unloaded.

Parameters:eid (Long) – Experimenter ID
Returns:Generator of groups for user
Return type:ExperimenterGroupWrapper generator
getPixelsService()

Gets reference to the pixels service from ProxyObjectWrapper.

Returns:omero.gateway.ProxyObjectWrapper
getProperty(k)

Returns named property of the wrapped omero.client

Returns:named client property
getQueryService()

Gets reference to the query service from ProxyObjectWrapper.

Returns:omero.gateway.ProxyObjectWrapper
getRenderingSettingsService()

Gets reference to the rendering settings service from ProxyObjectWrapper.

Returns:omero.gateway.ProxyObjectWrapper
getRepositoryInfoService()

Gets reference to the repository info service from ProxyObjectWrapper.

Returns:omero.gateway.ProxyObjectWrapper
getRoiLimitSetting()
getRoiService()

Gets ROI service.

Returns:omero.gateway.ProxyObjectWrapper
getScriptService()

Gets script service.

Returns:omero.gateway.ProxyObjectWrapper
getSession()

Returns the existing session, or creates a new one if needed

Returns:The session from session service
Return type:omero.model.session
getSessionService()

Gets reference to the session service from ProxyObjectWrapper.

Returns:omero.gateway.ProxyObjectWrapper
getShareService()

Gets reference to the share service from ProxyObjectWrapper.

Returns:omero.gateway.ProxyObjectWrapper
getSharedResources()

Gets reference to the sharedresources from ProxyObjectWrapper.

Returns:omero.gateway.ProxyObjectWrapper
getThumbnailSet(image_ids, max_size=64)

Retrieves a number of thumbnails for image sets. If the Thumbnails exist in the on-disk cache they will be returned directly, otherwise they will be created, for more details see ome.api.ThumbnailStore.getThumbnailByLongestSideSet

Parameters:
  • image_ids – A list of image ids
  • max_size – The longest side of the image will be used to calculate the size for the smaller side in order to keep the aspect ratio of the original image.
Returns:

dictionary of strings holding a rendered JPEG of the thumbnails.

getTimelineService()

Gets reference to the timeline service from ProxyObjectWrapper.

Returns:omero.gateway.ProxyObjectWrapper
getTypesService()

Gets reference to the types service from ProxyObjectWrapper.

Returns:omero.gateway.ProxyObjectWrapper
getUpdateService()

Gets reference to the update service from ProxyObjectWrapper.

Returns:omero.gateway.ProxyObjectWrapper
getUser()

Returns current Experimenter.

Returns:Current Experimenter
Return type:ExperimenterWrapper
getUserId()

Returns current experimenter id

Returns:Current Experimenter id
Return type:long
getWebclientHost()

Returns default initial zoom level set on the server.

groupSummary(gid=None, exclude_self=False)

Returns unsorted lists of ‘leaders’ and ‘members’ of the specified group (default is current group) as a dict with those keys.

Returns:{‘leaders’: list ExperimenterWrapper, ‘colleagues’: list ExperimenterWrapper}
Return type:dict

** Deprecated ** Use ExperimenterGroupWrapper.groupSummary().

isAdmin()

Checks if a user has administration privileges.

Returns:Boolean
isAnonymous()

Returns the anonymous flag

Returns:Anonymous
Return type:Boolean
isConnected()

Returns last status of connection.

Returns:Boolean
isLeader(gid=None)

Is the current group (or a specified group) led by the current user?

Returns:True if user leads the current group
Return type:Boolean
isSecure()

Returns ‘True’ if the underlying omero.clients.BaseClient is connected using SSL

keepAlive()

Keeps service alive. Returns True if connected. If connection was lost, reconnecting. If connection failed, returns False and error is logged.

Returns:True if connection alive.
Return type:Boolean
listColleagues()

Look up users who are a member of the current user active group. Returns None if the group is private and isn’t lead by the current user

Returns:Generator of Experimenters or None
Return type:ExperimenterWrapper generator
listFileAnnotations(eid=None, toInclude=[], toExclude=[])

Lists FileAnnotations created by users, filtering by namespaces if specified. If NO namespaces are specified, then ‘known’ namespaces are excluded by default, such as original files and companion files etc. File objects are loaded so E.g. file name is available without lazy loading.

Parameters:
  • eid – Filter results by this owner Id
  • toInclude – Only return annotations with these namespaces. List of strings.
  • toExclude – Don’t return annotations with these namespaces. List of strings.
Returns:

Generator of FileAnnotationWrapper - with files loaded.

listGroups()

Look up all experimenters and related groups. Groups are also loaded

Returns:All experimenters
Return type:ExperimenterWrapper generator
listOrphanedAnnotations(parent_type, parent_ids, eid=None, ns=None, anntype=None, addedByMe=True)

Retrieve all Annotations not linked to the given parents: Projects, Datasets, Images, Screens, Plates OR Wells etc.

Parameters:
  • parent_type – E.g. ‘Dataset’, ‘Image’ etc.
  • parent_ids – IDs of the parent.
  • eid – Optional filter by Annotation owner
  • ns – Filter by annotation namespace
  • anntype – Optional specify ‘Text’, ‘Tag’, ‘File’, Long’, ‘Boolean’
Returns:

Generator yielding AnnotationWrappers

Return type:

AnnotationWrapper generator

listOrphans(obj_type, eid=None, params=None, loadPixels=False)

List orphaned Datasets, Images, Plates controlled by the security system, Optionally filter by experimenter ‘eid’

Parameters:
  • obj_type – ‘Dataset’, ‘Image’, ‘Plate’
  • eid (Long) – experimenter id
  • params – omero.sys.ParametersI, can be used for pagination, filtering etc.
  • attributes – Map of key-value pairs to filter results by. Key must be attribute of obj_type. E.g. ‘name’, ‘ns’
Returns:

Generator yielding Datasets

Return type:

DatasetWrapper generator

listOwnedGroups()

Looks up owned groups for the logged user.

Returns:Groups owned by current user
Return type:ExperimenterGroupWrapper generator
listProjects(eid=None)

List every Project controlled by the security system.

Parameters:eid – Filters Projects by owner ID
Return type:ProjectWrapper list
listScreens(eid=None)

List every Screens controlled by the security system.

Parameters:eid – Filters Screens by owner ID
Return type:ProjectWrapper list
listStaffs()

Look up users who are members of groups lead by the current user.

Returns:Members of groups lead by current user
Return type:ExperimenterWrapper generator
resetEnumerations(klass)

Resets the enumerations by type

Parameters:klass (String) – Type of enum to reset
revertGroupForSession()

Switches the group to the previous group

searchObjects(obj_types, text, created=None, fields=(), batchSize=1000, page=0, searchGroup=None, ownedBy=None, useAcquisitionDate=False)

Search objects of type “Project”, “Dataset”, “Image”, “Screen”, “Plate” Returns a list of results

Parameters:
  • obj_types – E.g. [“Dataset”, “Image”]
  • text – The text to search for
  • createdomero.rtime list or tuple (start, stop)
  • useAcquisitionDate – if True, then use Image.acquisitionDate rather than import date for queries.
Returns:

List of Object wrappers. E.g. ImageWrapper

seppuku(softclose=False)

Terminates connection with killSession(). If softclose is False, the session is really terminated disregarding its connection refcount. If softclose is True then the connection refcount is decremented by 1.

Parameters:softclose – Boolean

** Deprecated ** Use close(). Our apologies for any offense caused by this previous method name.

setChannelNames(data_type, ids, nameDict, channelCount=None)

Sets and saves new names for channels of specified Images. If an image has fewer channels than the max channel index in nameDict, then the channel names will not be set for that image.

Parameters:
  • data_type – ‘Image’, ‘Dataset’, ‘Plate’
  • ids – Image, Dataset or Plate IDs
  • nameDict – A dict of index:’name’ ** 1-based ** E.g. {1:”DAPI”, 2:”GFP”}
  • channelCount – If specified, only rename images with this number of channels
Returns:

{‘imageCount’:totalImages, ‘updateCount’:updateCount}

setDefaultOmeroGroup(defaultOmeroGroup)
setDefaultOmeroUser(defaultOmeroUser)
setGroupForSession(groupid)

Sets the security context of this connection to the specified group

Parameters:groupid (Long) – The ID of the group to switch to
Return type:Boolean
Returns:True if the group was switched successfully
setGroupNameForSession(group)

Looks up the group by name, then delegates to setGroupForSession(), returning the result

Parameters:group (String) – Group name
Returns:True if group set successfully
Return type:Boolean
setIdentity(username, passwd, _internal=False)

Saves the username and password for later use, creating session etc

Parameters:
  • username (String) – User name.
  • passwd (String) – Password.
  • _internal (Boolean) – If False, set _anonymous = False
setSecure(secure=True)

Switches between SSL and insecure (faster) connections to Blitz. The gateway must already be connected.

Parameters:secure (Boolean) – If False, use an insecure connection
setUserId(uid)

Sets current experimenter id

suConn(username, group=None, ttl=60000)

If current user isAdmin, return new connection owned by ‘username’

Parameters:
  • username (String) – Username for new connection
  • group (String) – If specified, try to log in to this group
  • ttl (Int) – Timeout for new session
Returns:

Clone of this connection, with username’s new Session

Return type:

_BlitzGateway or None if not admin or username unknown

timelineListImages(tfrom=None, tto=None, limit=10, only_owned=True)

List images based on their creation times. If both tfrom and tto are None, grab the most recent batch.

Parameters:
  • tfrom – milliseconds since the epoch for start date
  • tto – milliseconds since the epoch for end date
  • limit – maximum number of results
  • only_owned – Only owned by the logged user. Boolean.
Returns:

Generator yielding _ImageWrapper

Return type:

ImageWrapper generator

updateEnumerations(new_entries)

Updates enumerations with new entries

Parameters:new_entries (List of omero.model.IObject) – List of objects
class omero.gateway._ChannelWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_ChannelI class wrapper extends BlitzObjectWrapper.

BLUE_MAX = 500
BLUE_MIN = 400
COLOR_MAP = ((400, 500, <omero.gateway.ColorHolder object at 0x14bfed50>), (501, 600, <omero.gateway.ColorHolder object at 0x14bfed90>), (601, 700, <omero.gateway.ColorHolder object at 0x14bfe5d0>))
GREEN_MAX = 600
GREEN_MIN = 501
OMERO_CLASS = 'Channel'
RED_MAX = 700
RED_MIN = 601
getColor()

Returns the rendering settings color of this channel

Returns:Channel color
Return type:ColorHolder
getEmissionWave(units=None)

Returns the emission wave or None. If units is true, returns omero.model.LengthI If units specifies a unit e,g, “METER”, we convert.

Returns:Emission wavelength or None
Return type:float or omero.model.LengthI
getExcitationWave(units=None)

Returns the excitation wave or None. If units is true, returns omero.model.LengthI If units specifies a unit e,g, “METER”, we convert.

Returns:Excitation wavelength or None
Return type:float or omero.model.LengthI
getLabel()

Returns the logical channel name, emission wave or index. The first that is not null in the described order.

Returns:The logical channel string representation
Return type:String
getLogicalChannel()

Returns the logical channel

Returns:Logical Channel
Return type:LogicalChannelWrapper
getLut()

Returns the Lookup Table name for the Channel. E.g. “cool.lut” or None if no LUT.

Returns:Lut name.
Return type:String
getName()

Returns the logical channel name or None

Returns:The logical channel string representation
Return type:String
getWindowEnd()

Returns the rendering settings window-end of this channel

Returns:Window end
Return type:double
getWindowMax()

Returns the maximum pixel value of the channel

Returns:Min pixel value
Return type:double
getWindowMin()

Returns the minimum pixel value of the channel

Returns:Min pixel value
Return type:double
getWindowStart()

Returns the rendering settings window-start of this channel

Returns:Window start
Return type:double
isActive()

Returns True if the channel is active (turned on in rendering settings)

Returns:True if Channel is Active
Return type:Boolean
isReverseIntensity()

Returns True if this channel has ReverseIntensityContext set on it.

Returns:True if ReverseIntensityContext found
Return type:Boolean
save()

Extends the superclass save method to save Pixels. Returns result of saving superclass (TODO: currently this is None)

setWindow(minval, maxval)
setWindowEnd(val)
setWindowStart(val)
class omero.gateway._DatasetWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_DatasetI class wrapper extends BlitzObjectWrapper.

CHILD_WRAPPER_CLASS = 'ImageWrapper'
OMERO_CLASS = 'Dataset'
PARENT_WRAPPER_CLASS = 'ProjectWrapper'
classmethod _getQueryString(opts=None)

Extend base query to handle filtering of Datasets by Projects. Returns a tuple of (query, clauses, params). Supported opts: ‘project’: <project_id> to filter by Project

‘image’: <image_id> to filter by child Image ‘orphaned’: <bool>. Filter by ‘not in Project’
Parameters:opts – Dictionary of optional parameters.
Returns:Tuple of string, list, ParametersI
class omero.gateway._DetectorSettingsWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_DetectorSettingsI class wrapper extends BlitzObjectWrapper.

OMERO_CLASS = 'DetectorSettings'
_attrs = ('voltage', 'gain', 'offsetValue', 'readOutRate', 'binning|BinningWrapper', 'detector|DetectorWrapper', 'version')
class omero.gateway._DetectorWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_DetectorI class wrapper extends BlitzObjectWrapper.

OMERO_CLASS = 'Detector'
_attrs = ('manufacturer', 'model', 'serialNumber', 'voltage', 'gain', 'offsetValue', 'zoom', 'amplificationGain', '#type;detectorType', 'version')
getDetectorType()

The type of detector (enum value)

Returns:Detector type
Return type:EnumerationWrapper
class omero.gateway._DichroicWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_DichroicI class wrapper extends BlitzObjectWrapper.

OMERO_CLASS = 'Dichroic'
_attrs = ('manufacturer', 'model', 'lotNumber', 'version')
class omero.gateway._EnumerationWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

getType()

Gets the type (class) of the Enumeration

Returns:The omero class
Type:Class
class omero.gateway._ExperimenterGroupWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_ExperimenterGroupI class wrapper extends BlitzObjectWrapper.

CHILD_WRAPPER_CLASS = 'ExperimenterWrapper'
OMERO_CLASS = 'ExperimenterGroup'
PARENT_WRAPPER_CLASS = None
classmethod _getQueryString(opts=None)

Returns string for building queries, loading Experimenters for each group. Returns a tuple of (query, clauses, params).

Parameters:opts – Dictionary of optional parameters. NB: No options supported for this class.
Returns:Tuple of string, list, ParametersI
groupSummary(exclude_self=False)

Returns tuple of unsorted lists of ‘leaders’ and ‘members’ of the group.

Returns:(list ExperimenterWrapper, list ExperimenterWrapper)
Return type:tuple
class omero.gateway._ExperimenterWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_ExperimenterI class wrapper extends BlitzObjectWrapper.

CHILD_WRAPPER_CLASS = None
OMERO_CLASS = 'Experimenter'
PARENT_WRAPPER_CLASS = 'ExperimenterGroupWrapper'
classmethod _getQueryString(opts=None)

Returns string for building queries, loading Experimenters only.

Returns a tuple of (query, clauses, params).

Parameters:opts – Dictionary of optional parameters. NB: No options supported for this class.
Returns:Tuple of string, list, ParametersI
getDescription()

Returns Experimenter’s Full Name

Returns:Full Name or None
Return type:String
getFullName()

Gets full name of this experimenter. E.g. ‘William James. Moore’ or ‘William Moore’ if no middle name

Returns:Full Name or None
Return type:String
getName()

Returns Experimenter’s omeName

Returns:Name
Return type:String
getNameWithInitial()

Returns first initial and Last name. E.g. ‘W. Moore’

Returns:Initial and last name
Return type:String
getPreference(key, default='', section=None)

Gets a preference for the experimenter

Parameters:
  • key – Preference key
  • default – Default value to return
  • section – Preferences section
Returns:

Preference value

getPreferences(section=None)

Gets all preferences for section

Parameters:section – Preferences section
Returns:Dict of preferences
getRawPreferences()

Returns the experimenter’s preferences annotation contents, as a ConfigParser instance

Returns:See above
Return type:ConfigParser
isActive()

Returns true if Experimenter is Active (if they are in any group named ‘user’)

Returns:True if experimenter is Active
Return type:Boolean
isAdmin()

Returns true if Experimenter is Admin (if they are in any group named ‘system’)

Returns:True if experimenter is Admin
Return type:Boolean
isGuest()

Returns true if Experimenter is Guest (if they are in any group named ‘guest’)

Returns:True if experimenter is Admin
Return type:Boolean
is_self()

Returns True if this Experimenter is the current user

setPreference(key, value, section=None)

Sets a preference for the experimenter

Parameters:
  • key – Preference key
  • value – Value to set
  • section – Preferences section - created if needed
setRawPreferences(prefs)

Sets the experimenter’s preferences annotation contents, passed in as a ConfigParser instance

Parameters:prefs (ConfigParser) – ConfigParser of preferences
simpleMarshal(xtra=None, parents=False)
class omero.gateway._FilamentWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway._LightSourceWrapper

omero_model_FilamentI class wrapper extends LightSourceWrapper.

OMERO_CLASS = 'Filament'
class omero.gateway._FilesetWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_FilesetI class wrapper extends BlitzObjectWrapper

OMERO_CLASS = 'Fileset'
classmethod _getQueryString(opts=None)

Used for building queries in generic methods such as getObjects(“Fileset”). Returns a tuple of (query, clauses, params).

Parameters:opts – Dictionary of optional parameters. NB: No options supported for this class.
Returns:Tuple of string, list, ParametersI
copyImages()

Returns a list of ImageWrapper linked to this Fileset

listFiles()

Returns a list of OriginalFileWrapper linked to this Fileset via Fileset Entries

class omero.gateway._FilterSetWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_FilterSetI class wrapper extends BlitzObjectWrapper.

OMERO_CLASS = 'FilterSet'
_attrs = ('manufacturer', 'model', 'lotNumber', 'dichroic|DichroicWrapper', 'version')
copyEmissionFilters()

TODO: not implemented

copyExcitationFilters()

TODO: not implemented

class omero.gateway._FilterWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_FilterI class wrapper extends BlitzObjectWrapper.

OMERO_CLASS = 'Filter'
_attrs = ('manufacturer', 'model', 'lotNumber', 'filterWheel', '#type;filterType', 'transmittanceRange|TransmittanceRangeWrapper', 'version')
getFilterType()

Gets the Filter type for this filter (enum value)

Returns:Filter type
Return type:EnumerationWrapper
class omero.gateway._ImageStageLabelWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_StageLabelI class wrapper extends BlitzObjectWrapper.

class omero.gateway._ImageWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper, omero.gateway.OmeroRestrictionWrapper

omero_model_ImageI class wrapper extends BlitzObjectWrapper.

CHILD_WRAPPER_CLASS = None
LINE_PLOT_DTYPES = {(1, False, False): 'B', (1, False, True): 'b', (4, True, True): 'f', (2, False, True): 'h', (2, False, False): 'H'}
LP_BGCOLOR = 1
LP_FGCOLOR = 2
LP_PALLETE = [0, 0, 0, 0, 0, 0, 255, 255, 255]
LP_TRANSPARENT = 0
OMERO_CLASS = 'Image'
PARENT_WRAPPER_CLASS = ['DatasetWrapper', 'WellSampleWrapper']
PLANEDEF = 0
PROJECTIONS = {'intmax': MAXIMUMINTENSITY, 'intsum': SUMINTENSITY, 'intmean': MEANINTENSITY, 'normal': -1}
_archivedFileCount = None
_collectRenderOptions()
Returns a map of rendering options not stored in rendering settings.
  • ‘p’ : projection
  • ‘ia’ : inverted axis (swap Z and T)
Returns:Dict of render options
Return type:Dict
_deleteSettings()
_filesetFileCount = None
_getProjectedThumbnail(*args, **kwargs)
classmethod _getQueryString(opts=None)

Extend base query to handle filtering of Images by Datasets. Returns a tuple of (query, clauses, params). Supported opts: ‘dataset’: <dataset_id> to filter by Dataset

‘load_pixels’: <bool> to load Pixel objects ‘load_channels’: <bool> to load Channels and

Logical Channels

‘orphaned’: <bool> Images not in Dataset or WellSample

Parameters:opts – Dictionary of optional parameters.
Returns:Tuple of string, list, ParametersI
_getRDef()

Return a rendering def ID based on custom logic.

Returns:Rendering definition ID or None if no custom logic has found a rendering definition.
_importedFilesInfo = None
_invertedAxis = False
_loadPixels()

Checks that pixels are loaded

Returns:True if loaded
Return type:Boolean
_loadRenderOptions()

Loads rendering options from an Annotation on the Image.

Returns:Dict of rendering options
Return type:Dict
_onResetDefaults(rdid)

Called whenever a reset defaults is called by the preparation of the rendering engine or the thumbnail bean.

Parameters:rdid (Long) – Current Rendering Def ID
_pd = None
_pixels = None
_pr = None
_prEnd = None
_prStart = None
_prepareRE(rdid=None)

Prepare the rendering engine with pixels ID and existing or new rendering def.

Returns:The Rendering Engine service
Return type:ProxyObjectWrapper
_prepareRenderingEngine(rdid=None)

Checks that the rendering engine is prepared, calling _prepareRE() if needed. Used by the assert_re() method to wrap calls requiring rendering engine

Returns:True if rendering engine is created
Return type:Boolean
_prepareTB(_r=False, rdefId=None)

Prepares Thumbnail Store for the image.

Parameters:
  • _r (Boolean) – If True, don’t reset default rendering (return None if no rDef exists)
  • rdefId (Long) – Rendering def ID to use for rendering thumbnail
Returns:

Thumbnail Store or None

Return type:

ProxyObjectWrapper

_re = None
_renderSplit_channelLabel(channel)
_rm = {}
_thumbInProgress = False
_wordwrap(width, text, font)

Wraps text into lines that are less than a certain width (when rendered in specified font)

Parameters:
  • width (Int) – The max width to wrap text (pixels)
  • text (String) – The text to wrap
  • font (E.g. PIL ImageFont) – Font to use.
Returns:

List of text lines

Return type:

List of Strings

clearDefaults()

Removes specific color settings from channels

Returns:True if allowed to do this
Return type:Boolean
countArchivedFiles()

Returns the number of Original ‘archived’ Files linked to primary pixels.

countFilesetFiles()

Counts the Original Files that are part of the FS Fileset linked to this image

countImportedImageFiles()

Returns a count of the number of Imported Image files (Archived files for pre-FS images) This will only be 0 if the image was imported pre-FS and original files NOT archived

createMovie(*args, **kwargs)
exportOmeTiff(bufsize=0)

Exports the OME-TIFF representation of this image.

Parameters:bufsize (int or tuple) – if 0 return a single string buffer with the whole OME-TIFF if >0 return a tuple holding total size and generator of chunks (string buffers) of bufsize bytes each
Returns:OME-TIFF file data
Return type:String or (size, data generator)
classmethod fromPixelsId(conn, pid)

Creates a new Image wrapper with the image specified by pixels ID

Parameters:
  • conn (BlitzGateway) – The connection
  • pid (Long) – Pixels ID
Returns:

New Image wrapper

Return type:

ImageWrapper

getAcquisitionDate()

Returns the acquisition date for the image or None if not set.

Returns:A datetime.datetime() object
Return type:datetime
getAllRenderingDefs(eid=-1)

Returns a dict of the rendering settings that exist for this Image Can be filtered by owner using the eid parameter.

Returns:Rdef dict
Return type:Dict
getArchivedFiles()

Returns a generator of OriginalFileWrapper corresponding to the archived files linked to primary pixels ** Deprecated ** Use getImportedImageFiles().

getAuthor()

Returns ‘Firstname Lastname’ of image owner

Returns:Image owner
Return type:String
getChannelLabels()

Returns a list of the labels for the Channels for this image

getChannels(noRE=False)

Returns a list of Channels, each initialised with rendering engine. If noRE is True, Channels will not have rendering engine enabled. In this case, calling channel.getColor() or getWindowStart() etc will return None.

Returns:Channels
Return type:List of ChannelWrapper
getCol(z, t, x, channels=None, range=None)

Grab a horizontal line from the image pixel data, for the specified channels (or active ones)

Parameters:
  • z – Z index
  • t – T index
  • x – X position of column
  • channels – map of {index: ChannelWrapper }
  • range – height of scale (use image width by default)
Returns:

rv List of lists (one per channel)

getDefaultT(*args, **kwargs)
getDefaultZ(*args, **kwargs)
getFileset()

Returns the Fileset linked to this Image. Fileset images, usedFiles and originalFiles are loaded.

getHistogram(*args, **kwargs)

Tries to load pixels, then call function and return the result

getImagingEnvironment()

Gets the Imaging Environment of the Image, or None

Returns:Imaging Environment
Return type:ImagingEnvironmentWrapper
getImportedFilesInfo()

Returns a dict of ‘count’ and ‘size’ of the Fileset files (OMERO 5) or the Original Archived files (OMERO 4)

Returns:A dict of ‘count’ and sum ‘size’ of the files.
getImportedImageFilePaths()

Returns a generator of path strings corresponding to the Imported image files that created this image, if available.

getImportedImageFiles()

Returns a generator of OriginalFileWrapper corresponding to the Imported image files that created this image, if available.

getInplaceImport()

If the image was imported using file transfer, return the type of file transfer. One of: ‘ome.formats.importer.transfers.MoveFileTransfer’, ‘ome.formats.importer.transfers.CopyFileTransfer’, ‘ome.formats.importer.transfers.CopyMoveFileTransfer’, ‘ome.formats.importer.transfers.HardlinkFileTransfer’, ‘ome.formats.importer.transfers.SymlinkFileTransfer’

Return type:String or None
Returns:Transfer type or None
getInstrument()

Returns the Instrument for this image (or None) making sure the instrument is loaded.

Returns:Instrument (microscope)
Return type:InstrumentWrapper
getObjectiveSettings()

Gets the Objective Settings of the Image, or None

Returns:Objective Settings
Return type:ObjectiveSettingsWrapper
getPixelLine(z, t, pos, axis, channels=None, range=None)

Grab a horizontal or vertical line from the image pixel data, for the specified channels (or ‘active’ if not specified) and using the specified range (or 1:1 relative to the image size). Axis may be ‘h’ or ‘v’, for horizontal or vertical respectively.

Parameters:
  • z – Z index
  • t – T index
  • pos – X or Y position
  • axis – Axis ‘h’ or ‘v’
  • channels – map of {index: ChannelWrapper }
  • range – height of scale (use image height (or width) by default)
Returns:

rv List of lists (one per channel)

getPixelRange(*args, **kwargs)

Tries to load pixels, then call function and return the result

getPixelSizeX(*args, **kwargs)

Tries to load pixels, then call function and return the result

getPixelSizeY(*args, **kwargs)

Tries to load pixels, then call function and return the result

getPixelSizeZ(*args, **kwargs)

Tries to load pixels, then call function and return the result

getPixelsId(*args, **kwargs)

Tries to load pixels, then call function and return the result

getPixelsType(*args, **kwargs)

Tries to load pixels, then call function and return the result

getPlate()

If the image is in a Plate/Well hierarchy, returns the parent Plate, otherwise None

Returns:Plate
Return type:PlateWrapper
getPrimaryPixels(*args, **kwargs)

Tries to load pixels, then call function and return the result

getProject()

Gets the Project that image is in, or None. TODO: Assumes image is in only 1 Project. Why not use getAncestory()[-1] Returns None if Image is in more than one Dataset & Project.

Returns:Project
Return type:ProjectWrapper
getProjection()

Returns the current projection option (checking it is valid).

Returns:Projection key. E.g. ‘intmax’
Return type:String
getProjectionRange()

Gets the range used for Z-projection as tuple (proStart, proEnd)

getProjections()

Returns list of available keys for projection. E.g. [‘intmax’, ‘intmean’]

Returns:Projection options
Return type:List of strings
getROICount(shapeType=None, filterByCurrentUser=False)

Count number of ROIs associated to an image

Parameters:
  • shapeType – Filter by shape type (“Rectangle”,...).
  • filterByCurrentUser – Whether or not to filter the count by the currently logged in user.
Returns:

Number of ROIs found for the currently logged in user if filterByCurrentUser is True, otherwise the total number found.

getRenderingDefId(*args, **kwargs)
getRenderingModel(*args, **kwargs)
getRenderingModels(*args, **kwargs)
getRow(z, t, y, channels=None, range=None)

Grab a horizontal line from the image pixel data, for the specified channels (or active ones)

Parameters:
  • z – Z index
  • t – T index
  • y – Y position of row
  • channels – map of {index: ChannelWrapper }
  • range – height of scale (use image height by default)
Returns:

rv List of lists (one per channel)

getSizeC(*args, **kwargs)

Tries to load pixels, then call function and return the result

getSizeT(*args, **kwargs)

Tries to load pixels, then call function and return the result

getSizeX(*args, **kwargs)

Tries to load pixels, then call function and return the result

getSizeY(*args, **kwargs)

Tries to load pixels, then call function and return the result

getSizeZ(*args, **kwargs)

Tries to load pixels, then call function and return the result

getStageLabel()

Returns the stage label or None

Returns:Stage label
Return type:ImageStageLabelWrapper
getT(*args, **kwargs)
getThumbVersion(*args, **kwargs)

Tries to load pixels, then call function and return the result

getThumbnail(size=(64, 64), z=None, t=None, direct=True, rdefId=None)

Returns a string holding a rendered JPEG of the thumbnail.

Parameters:
  • size (tuple or number) – A tuple with one or two ints, or an integer. If a tuple holding a single int, or a single int is passed as param, then that will be used as the longest size on the rendered thumb, and image aspect ratio is kept. If two ints are passed in a tuple, they set the width and height of the rendered thumb.
  • z (number) – the Z position to use for rendering the thumbnail. If not provided default is used.
  • t (number) – the T position to use for rendering the thumbnail. If not provided default is used.
  • direct – If true, force creation of new thumbnail (don’t use cached)
  • rdefId – The rendering def to apply to the thumbnail.
Return type:

string or None

Returns:

the rendered JPEG, or None if there was an error.

getZ(*args, **kwargs)
getZoomLevelScaling(*args, **kwargs)
isGreyscaleRenderingModel()

Returns True if the current rendering model is ‘greyscale’

Returns:isGreyscale
Return type:Boolean
isInvertedAxis()

Returns the inverted axis flag

Returns:Inverted Axis
Return type:Boolean
loadOriginalMetadata(sort=True)

Gets original metadata from the file annotation. Returns the File Annotation, list of Global Metadata, list of Series Metadata in a tuple. Metadata lists are lists of (key, value) tuples.

Parameters:sort – If True, we sort Metadata by key
Returns:Tuple (file-annotation, global-metadata, series-metadata)
Return type:Tuple (FileAnnotationWrapper, [], [])
loadRenderOptions()

Loads rendering options from an Annotation on the Image and applies them to the Image.

Returns:True! TODO: Always True??
prepareLinePlotCanvas()

Common part of horizontal and vertical line plot rendering.

Returns:(Image, width, height).
renderBirdsEyeView(*args, **kwargs)
renderColLinePlotGif(*args, **kwargs)
renderImage(z, t, compression=0.90000000000000002)

Render the Image, (projected) and compressed. For projection, call setProjection() before renderImage.

Parameters:
  • z – Z index
  • t – T index
  • compression – Image compression level
Returns:

A PIL Image or None

Return type:

PIL Image.

renderJpeg(*args, **kwargs)
renderJpegRegion(*args, **kwargs)
renderRowLinePlotGif(*args, **kwargs)
renderSplitChannel(z, t, compression=0.90000000000000002, border=2)

Prepares a jpeg representation of a 2d grid holding a render of each channel, along with one for all channels at the set Z and T points.

Parameters:
  • z – Z index
  • t – T index
  • compression – Image compression level
  • border
Returns:

value

renderSplitChannelImage(z, t, compression=0.90000000000000002, border=2)

Prepares a PIL Image with a 2d grid holding a render of each channel, along with one for all channels at the set Z and T points.

Parameters:
  • z – Z index
  • t – T index
  • compression – Compression level
  • border – space around each panel (int)
Returns:

canvas

Return type:

PIL Image

requiresPixelsPyramid(*args, **kwargs)

Tries to load pixels, then call function and return the result

resetDefaults(*args, **kwargs)
resetRDefs()
saveDefaults(*args, **kwargs)
setActiveChannels(channels, windows=None, colors=None, reverseMaps=None)

Sets the active channels on the rendering engine. Also sets rendering windows and channel colors (for channels that are active)

Examples: # Turn first channel ON, others OFF image.setActiveChannels([1]) # First OFF, second ON, windows and colors for both image.setActiveChannels(

[-1, 2], [[20, 300], [50, 500]], [‘00FF00’, ‘FF0000’])

# Second Channel ON with windows. All others OFF image.setActiveChannels([2], [[20, 300]])

Parameters:
  • channels (List of int) – List of active channel indexes ** 1-based index **
  • windows (List of [start, stop]. [[20, 300], [None, None], [50, 500]]. Must be list for each channel) – Start and stop values for active channel rendering settings
  • colors – List of colors. [‘F00’, None, ‘00FF00’]. Must be item for each channel
  • reverseMaps – List of boolean (or None). If True/False then set/remove reverseIntensityMap on channel
setColorRenderingModel()

Sets the HSB rendering model on this image’s current renderer

setDefaultT(*args, **kwargs)
setDefaultZ(*args, **kwargs)
setGreyscaleRenderingModel()

Sets the Greyscale rendering model on this image’s current renderer

setInvertedAxis(inverted)

Sets the inverted axis flag

Parameters:inverted (Boolean) – Inverted Axis
setProjection(proj)

Sets the current projection option.

Parameters:proj (String) – Projection Option. E.g. ‘intmax’ or ‘normal’
setProjectionRange(projStart, projEnd)

Sets the range used for Z-projection. Will only be used if E.g. setProjection(‘intmax’) is not ‘normal’

setReverseIntensity(*args, **kwargs)
shortname(length=20, hist=5)

Provides a truncated name of the image. E.g. ...catedNameOfTheImage.tiff

Parameters:
  • length (Int) – The ideal length to return. If truncated, will be ...length
  • hist (Int) – The amount of leeway allowed before truncation (avoid truncating 1 or 2 letters)
Returns:

Truncated ...name

Type:

String

simpleMarshal(xtra=None, parents=False)

Creates a dict representation of the Image, including author and date info.

Parameters:xtra – controls the optional parts of simpleMarshal; - thumbUrlPrefix - allows customizing the thumb URL by either a static string prefix or a callable function that will take a single ImgId int argument and return the customized URL string - tiled - if passed and value evaluates to true, add information on whether this image is tiled on this server.
Type:Dict
Returns:Dict
Return type:Dict
splitChannelDims(border=2)

Returns a dict of layout parameters for generating split channel image. E.g. row count, column count etc. for greyscale and color layouts.

Parameters:border (int) – spacing between panels
Returns:Dict of parameters
Return type:Dict
class omero.gateway._ImagingEnviromentWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_ImagingEnvironmentI class wrapper extends BlitzObjectWrapper.

OMERO_CLASS = 'ImagingEnvironment'
_attrs = ('temperature', 'airPressure', 'humidity', 'co2percent', 'version')
class omero.gateway._ImagingEnvironmentWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_ImagingEnvironment class wrapper extends BlitzObjectWrapper.

class omero.gateway._InstrumentWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_InstrumentI class wrapper extends BlitzObjectWrapper.

OMERO_CLASS = 'Instrument'
_attrs = ('microscope|MicroscopeWrapper',)
getDetectors()

Gets the Instrument detectors.

Returns:List of Detectors
Return type:DetectorWrapper list
getDichroics()

Gets the Instrument Dichroics.

Returns:List of Dichroics
Return type:DichroicWrapper list
getFilterSets()

Gets the Instrument FilterSets.

Returns:List of FilterSets
Return type:FilterSetWrapper list
getFilters()

Gets the Instrument Filters.

Returns:List of Filters
Return type:FilterWrapper list
getLightSources()

Gets the Instrument LightSources.

Returns:List of LightSources
Return type:LightSourceWrapper list
getMicroscope()

Returns the microscope component of the Instrument.

Returns:Microscope
Return type:omero.model.Microscope
getOTFs()

Gets the Instrument OTFs.

Returns:List of OTFs
Return type:OTFWrapper list
getObjectives()

Gets the Instrument Objectives.

Returns:List of Objectives
Return type:ObjectiveWrapper list
simpleMarshal()
class omero.gateway._LaserWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway._LightSourceWrapper

omero_model_LaserI class wrapper extends LightSourceWrapper.

OMERO_CLASS = 'Laser'
getLaserMedium()

Gets the laser medium type for this Laser (enum value)

Returns:Laser medium type
Return type:EnumerationWrapper
getPump()

Gets the pump (Light Source) for this Laser

Returns:Pump (Light Source)
Return type:LightSourceWrapper
class omero.gateway._LightEmittingDiodeWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway._LightSourceWrapper

omero_model_LightEmittingDiodeI class wrapper extends LightSourceWrapper.

OMERO_CLASS = 'LightEmittingDiode'
class omero.gateway._LightPathWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

base Light Source class wrapper, extends BlitzObjectWrapper.

OMERO_CLASS = 'LightPath'
_attrs = ('dichroic|DichroicWrapper', '()emissionFilters|', '()excitationFilters|')
getEmissionFilters()

Returns list of emission FilterWrapper

getExcitationFilters()

Returns list of excitation FilterWrapper. Ordered collections can contain nulls

class omero.gateway._LightSettingsWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

base Light Source class wrapper, extends BlitzObjectWrapper.

OMERO_CLASS = 'LightSettings'
_attrs = ('attenuation', 'wavelength', 'microbeamManipulation', 'version')
getLightSource()
class omero.gateway._LightSourceWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

base Light Source class wrapper, extends BlitzObjectWrapper.

_attrs = ('manufacturer', 'model', 'power', 'serialNumber', '#type;lightSourceType', 'version')
getLightSourceType()

Gets the Light Source type for this light source (enum value)

Returns:Light Source type
Return type:EnumerationWrapper
class omero.gateway._LogicalChannelWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_LogicalChannelI class wrapper extends BlitzObjectWrapper. Specifies a number of _attrs for the channel metadata.

_attrs = ('name', 'pinHoleSize', '#illumination', 'contrastMethod', 'excitationWave', 'emissionWave', 'fluor', 'ndFilter', 'otf', 'detectorSettings|DetectorSettingsWrapper', 'lightSourceSettings|LightSettingsWrapper', 'filterSet|FilterSetWrapper', 'samplesPerPixel', '#photometricInterpretation', 'mode', 'pockelCellSetting', '()lightPath|', 'version')
getLightPath()

Make sure we have the channel fully loaded, then return LightPathWrapper

class omero.gateway._MicroscopeWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_MicroscopeI class wrapper extends BlitzObjectWrapper.

OMERO_CLASS = 'Microscope'
_attrs = ('manufacturer', 'model', 'serialNumber', '#type;microscopeType', 'version')
getMicroscopeType()

Returns the ‘type’ of microscope this is.

Returns:Microscope type.
Return type:EnumerationWrapper
class omero.gateway._OTFWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_OTFI class wrapper extends BlitzObjectWrapper.

OMERO_CLASS = 'OTF'
_attrs = ('sizeX', 'sizeY', 'opticalAxisAveragedpixelsType', 'path', 'filterSet|FilterSetWrapper', 'objective|ObjectiveWrapper', 'version')
class omero.gateway._ObjectiveSettingsWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_ObjectiveSettingsI class wrapper extends BlitzObjectWrapper.

OMERO_CLASS = 'ObjectiveSettings'
_attrs = ('correctionCollar', '#medium', 'refractiveIndex', 'objective|ObjectiveWrapper', 'version')
getMedium()

Gets the Medium type that these settings refer to (enum value)

Returns:Medium
Return type:EnumerationWrapper
getObjective()

Gets the Objective that these settings refer to

Returns:Objective
Return type:ObjectiveWrapper
class omero.gateway._ObjectiveWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_ObjectiveI class wrapper extends BlitzObjectWrapper.

OMERO_CLASS = 'Objective'
_attrs = ('manufacturer', 'model', 'serialNumber', 'nominalMagnification', 'calibratedMagnification', 'lensNA', '#immersion', '#correction', 'workingDistance', 'iris', 'version')
getCorrection()

The type of Correction for this objective (enum value)

Returns:Correction type, or None
Return type:EnumerationWrapper
getImmersion()

The type of immersion for this objective (enum value)

Returns:Immersion type, or None
Return type:EnumerationWrapper
getIris()

The type of Iris for this objective (enum value)

Returns:Iris type
Return type:EnumerationWrapper
class omero.gateway._OriginalFileWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper, omero.gateway.OmeroRestrictionWrapper

omero_model_OriginalFileI class wrapper extends BlitzObjectWrapper.

OMERO_CLASS = 'OriginalFile'
getFileInChunks(buf=2621440)

Returns a generator yielding chunks of the file data.

Returns:Data from file in chunks
Return type:Generator
class omero.gateway._PixelsWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_PixelsI class wrapper extends BlitzObjectWrapper.

OMERO_CLASS = 'Pixels'
_prepareRawPixelsStore()

Creates RawPixelsStore and sets the id etc

copyPlaneInfo(theC=None, theT=None, theZ=None)

Loads plane infos and returns sequence of omero.model.PlaneInfo objects wrapped in BlitzObjectWrappers ordered by planeInfo.deltaT. Set of plane infos can be filtered by C, T or Z

Parameters:
  • theC (int or None) – Filter plane infos by Channel index
  • theT (int or None) – Filter plane infos by Time index
  • theZ – Filter plane infos by Z index
Returns:

Generator of PlaneInfo wrapped in BlitzObjectWrappers

getPixelsType()

This simply wraps the omero.model.PixelsType object in a BlitzObjectWrapper. Shouldn’t be needed when this is done automatically.

It has the methods getValue() and getBitSize().

getPlane(theZ=0, theC=0, theT=0)

Gets the specified plane as a 2D numpy array by calling getPlanes() If a range of planes are required, getPlanes() is approximately 30% faster.

getPlanes(zctList)

Returns generator of numpy 2D planes from this set of pixels for a list of Z, C, T indexes.

Parameters:zctList – A list of indexes: [(z,c,t), ]
getTile(theZ=0, theC=0, theT=0, tile=None)

Gets the specified plane as a 2D numpy array by calling getTiles() If a range of tile are required, getTiles() is approximately 30% faster.

getTiles(zctTileList)

Returns generator of numpy 2D planes from this set of pixels for a list of (Z, C, T, tile) where tile is (x, y, width, height) or None if you want the whole plane.

Parameters:zctrList – A list of indexes: [(z,c,t, region), ]
class omero.gateway._PlaneInfoWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_PlaneInfo class wrapper extends BlitzObjectWrapper.

OMERO_CLASS = 'PlaneInfo'
getDeltaT(units=None)

Gets the PlaneInfo deltaT with units support If units is True, return omero.model.TimeI If units specifies a different unit E.g. “MILLISECOND”, we convert

Parameters:units (True or unit string, e.g. “S”) – Option to include units in tuple
Returns:DeltaT value or omero.model.TimeI
getExposureTime(units=None)

Gets the PlaneInfo ExposureTime with units support If units is True, return omero.model.TimeI If units specifies a different unit E.g. “MILLISECOND”, we convert

Parameters:units (True or unit string) – Option to include units in tuple
Returns:ExposureTime value or omero.model.TimeI
class omero.gateway._PlateAcquisitionWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

OMERO_CLASS = 'PlateAcquisition'
classmethod _getQueryString(opts=None)

Extend base query to handle filtering of PlateAcquisitions by Plate. Returns a tuple of (query, clauses, params). Supported opts: ‘plate’: <plate_id> to filter by Plate

Parameters:opts – Dictionary of optional parameters.
Returns:Tuple of string, list, ParametersI
getEndTime()

Get the EndTime as a datetime object or None if not set.

getName()
getStartTime()

Get the StartTime as a datetime object or None if not set.

listParents(withlinks=False)

Because PlateAcquisitions are direct children of plates, with no links in between, a special listParents is needed

name
class omero.gateway._PlateWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper, omero.gateway.OmeroRestrictionWrapper

omero_model_PlateI class wrapper extends BlitzObjectWrapper.

CHILD_WRAPPER_CLASS = 'WellWrapper'
OMERO_CLASS = 'Plate'
PARENT_WRAPPER_CLASS = 'ScreenWrapper'
classmethod _getQueryString(opts=None)

Custom query to load Screen with Plate.

Also handles filtering of Plates by Screens. Returns a tuple of (query, clauses, params). Supported opts: ‘screen’: <screen_id> to filter by Screen

‘well’: <well_id> to filter by Well ‘orphaned’: <bool>. Filter by ‘not in Screen’
Parameters:opts – Dictionary of optional parameters.
Returns:Tuple of string, list, ParametersI
_listChildren(**kwargs)

Lists Wells in this plate, not sorted. Saves wells to _childcache map, where key is (row, column).

Return type:list of omero.model.WellI objects
Returns:child objects.
_loadPlateAcquisitions()
countChildren()
countPlateAcquisitions()
exportOmeTiff()

Make sure full project export doesn’t pick up wellsample images TODO: do we want to support this at all?

getColumnLabels()

Returns a list of labels for the columns on this plate. E.g. [1, 2, 3...] or [‘A’, ‘B’, ‘C’...] etc

getGridSize()

Iterates all wells on plate to retrieve grid size as {‘rows’: rSize, ‘columns’:cSize} dict.

Return type:dict of {‘rows’: rSize, ‘columns’:cSize}
getNumberOfFields(*args, **kwargs)
getRowLabels()

Returns a list of labels for the rows on this plate. E.g. [1, 2, 3...] or [‘A’, ‘B’, ‘C’...] etc

getWellGrid(index=0)

Returns a grid of WellWrapper objects, indexed by [row][col].

Return type:2D array of WellWrapper. Empty well positions are None
listPlateAcquisitions()
setGridSizeConstraints(row, col)

Makes sure the grid side count is the exact power of two of row and col arguments, keeping their ratio, that fits the existing well count.

class omero.gateway._ProjectWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_ProjectI class wrapper extends BlitzObjectWrapper.

CHILD_WRAPPER_CLASS = 'DatasetWrapper'
OMERO_CLASS = 'Project'
PARENT_WRAPPER_CLASS = None
classmethod _getQueryString(opts=None)

Extend base query to handle filtering of Projects by Datasets. Returns a tuple of (query, clauses, params). Supported opts: ‘dataset’: <dataset_id> to filter by Dataset

Parameters:opts – Dictionary of optional parameters.
Returns:Tuple of string, list, ParametersI
class omero.gateway._RoiWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_ExperimenterI class wrapper extends BlitzObjectWrapper.

CHILD_WRAPPER_CLASS = 'ShapeWrapper'
OMERO_CLASS = 'Roi'
classmethod _getQueryString(opts=None)

Extend base query to handle loading of Shapes. Returns a tuple of (query, clauses, params). Supported opts: ‘load_shapes’: boolean.

‘image’: <image_id> to filter by Image
Parameters:opts – Dictionary of optional parameters.
Returns:Tuple of string, list, ParametersI
class omero.gateway._ScreenWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_ScreenI class wrapper extends BlitzObjectWrapper.

CHILD_WRAPPER_CLASS = 'PlateWrapper'
OMERO_CLASS = 'Screen'
PARENT_WRAPPER_CLASS = None
classmethod _getQueryString(opts=None)

Extend base query to handle filtering of Screens by Plate. Returns a tuple of (query, clauses, params). Supported opts: ‘plate’: <plate_id> to filter by Plate

Parameters:opts – Dictionary of optional parameters.
Returns:Tuple of string, list, ParametersI
class omero.gateway._ShapeWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_ShapeI class wrapper extends BlitzObjectWrapper.

OMERO_CLASS = 'Shape'
class omero.gateway._TransmittanceRangeWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_TransmittanceRangeI class wrapper extends BlitzObjectWrapper.

OMERO_CLASS = 'TransmittanceRange'
_attrs = ('cutIn', 'cutOut', 'cutInTolerance', 'cutOutTolerance', 'transmittance', 'version')
class omero.gateway._WellSampleWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper

omero_model_WellSampleI class wrapper extends BlitzObjectWrapper.

CHILD_WRAPPER_CLASS = 'ImageWrapper'

Direct parent is Well. No Link between Well and WellSample.

OMERO_CLASS = 'WellSample'
PARENT_WRAPPER_CLASS = 'WellWrapper'
getImage()

Gets the Image for this well sample.

Returns:The Image
Return type:ImageWrapper
getPlateAcquisition()

Gets the PlateAcquisition for this well sample, or None

Returns:The PlateAcquisition
Return type:PlateAcquisitionWrapper or None
image()

Gets the Image for this well sample.

Returns:The Image
Return type:ImageWrapper
listParents(withlinks=False)

Because wellsamples are direct children of wells, with no links in between, a special listParents is needed

class omero.gateway._WellWrapper(conn=None, obj=None, cache=None, **kwargs)

Bases: omero.gateway.BlitzObjectWrapper, omero.gateway.OmeroRestrictionWrapper

omero_model_WellI class wrapper extends BlitzObjectWrapper.

CHILD_WRAPPER_CLASS = 'WellSampleWrapper'
OMERO_CLASS = 'Well'
PARENT_WRAPPER_CLASS = 'PlateWrapper'
classmethod _getQueryString(opts=None)

Extend base query to handle filtering of Wells by Plate. Returns a tuple of (query, clauses, params). Supported opts: ‘plate’: <plate_id> to filter by Plate

‘load_images’: <bool> to load WellSamples and Images ‘load_pixels’: <bool> to load Image Pixels ‘load_channels’: <bool> to load Pixels and Channels
Parameters:opts – Dictionary of optional parameters.
Returns:Tuple of string, list, ParametersI
_listChildren(**kwargs)
countWellSample()

Return the number of well samples loaded

Returns:well sample count
Return type:Int
getImage(index=None)

Return the image at the specified well sample index. If index is omitted, the currently selected index is used instead (self.index) and if that is not defined, the first one (index 0) is returned.

Parameters:index (integer) – the well sample index
Returns:The Image
Return type:ImageWrapper
getScreens()

returns the screens that link to plates that link to this well

getWellPos()

Gets the Well’s label according to the row and column naming convention on the Plate. E.g. ‘A1’

getWellSample(index=None)

Return the well sample at the specified index. If index is omitted, the currently selected index is used instead (self.index) and if that is not defined, the first one (index 0) is returned.

Parameters:index (integer) – the well sample index
Returns:The Well Sample
Return type:WellSampleWrapper
isWellSample()

Return True if well samples exist (loaded)

Returns:True if well samples loaded
Return type:Boolean
listParents(withlinks=False)

Because wells are direct children of plates, with no links in between, a special listParents is needed

selectedWellSample()

Return the well sample at the current index (0 if not set)

Returns:The Well Sample wrapper
Return type:WellSampleWrapper
simpleMarshal(xtra=None, parents=False)

Marshals the Well ID, label and Plate ID with simple Marshal of the first image in the Well.

omero.gateway._letterGridLabel(i)

Convert number to letter label. E.g. 0 -> ‘A’ and 100 -> ‘CW’

omero.gateway.add_plate_filter(clauses, params, opts)

Helper for adding ‘plate’ to filtering clauses and parameters.

omero.gateway.assert_pixels(func)

Function decorator to make sure that pixels are loaded before call

Parameters:func (Function) – Function
Returns:Decorated function
Return type:Function
class omero.gateway.assert_re(onPrepareFailureReturnNone=True, ignoreExceptions=None)

Bases: object

Function decorator to make sure that rendering engine is prepared before call. Is configurable by various options.

omero.gateway.fileread(fin, fsize, bufsize)

Reads everything from fin, in chunks of bufsize.

Parameters:
  • fin (file) – filelike readable object
  • fsize (int) – total number of bytes to read
  • fsize – size of each chunk of data read from fin
Return type:

string

Returns:

string buffer holding the contents read from the file

omero.gateway.fileread_gen(fin, fsize, bufsize)

Generator helper function that yields chunks of the file of size fsize.

Parameters:
  • fin (file) – filelike readable object
  • fsize (int) – total number of bytes to read
  • fsize – size of each chunk of data read from fin that gets yielded
Return type:

generator

Returns:

generator of string buffers of size up to bufsize read from fin

omero.gateway.getAnnotationLinkTableName(objecttype)

Get the name of the *AnnotationLink table for the given objecttype

omero.gateway.getChannelsQuery()

Helper for building Query for Images or Wells & Images

omero.gateway.getPixelsQuery(imageName)

Helper for building Query for Images or Wells & Images

omero.gateway.omero_type(val)
Converts rtypes from static factory methods:
  • StringType to rstring
  • UnicodeType to rstring
  • BooleanType to rbool
  • IntType to rint
  • LongType to rlong

else return the argument itself

Parameters:val – value
Return type:omero.rtype
Returns:matched RType or value
omero.gateway.refreshWrappers()

this needs to be called by modules that extend the base wrappers

omero.gateway.splitHTMLColor(color)

splits an hex stream of characters into an array of bytes in format (R,G,B,A). - abc -> (0xAA, 0xBB, 0xCC, 0xFF) - abcd -> (0xAA, 0xBB, 0xCC, 0xDD) - abbccd -> (0xAB, 0xBC, 0xCD, 0xFF) - abbccdde -> (0xAB, 0xBC, 0xCD, 0xDE)

Parameters:color – Characters to split.
Returns:rgba
Return type:list of Ints