Package omero :: Package gateway :: Class _BlitzGateway
[hide private]
[frames] | no frames]

Class _BlitzGateway

source code


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

Instance Methods [hide private]
 
__init__(self, 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)
Create the connection wrapper.
source code
 
createServiceOptsDict(self) source code
 
setDefaultOmeroGroup(self, defaultOmeroGroup) source code
 
setDefaultOmeroUser(self, defaultOmeroUser) source code
 
getDefaultOmeroGroup(self) source code
 
getDefaultOmeroUser(self) source code
 
getMaxPlaneSize(self)
Returns the maximum plane size the server will allow for an image to not be considered big i.e.
source code
 
isAnonymous(self)
Returns the anonymous flag
source code
 
getProperty(self, k)
Returns named property of the wrapped omero.client
source code
 
clone(self)
Returns a new instance of this class, with all matching properties.
source code
 
setIdentity(self, username, passwd, _internal=False)
Saves the username and password for later use, creating session etc
source code
 
suConn(self, username, group=None, ttl=60000)
If current user isAdmin, return new connection owned by 'username'
source code
 
keepAlive(self)
Keeps service alive.
source code
 
seppuku(self, softclose=False)
Terminates connection with killSession().
source code
 
_createProxies(self)
Creates proxies to the server services.
source code
 
setSecure(self, secure=True)
Switches between SSL and insecure (faster) connections to Blitz.
source code
 
isSecure(self)
Returns 'True' if the underlying omero.clients.BaseClient is connected using SSL
source code
 
_getSessionId(self) source code
 
_createSession(self)
Creates a new session for the principal given in the constructor.
source code
 
_closeSession(self)
Close session.
source code
 
_resetOmeroClient(self)
Creates new omero.client object using self.host or self.ice_config (if host is None) Also tries to setAgent for the client
source code
 
connect(self, sUuid=None)
Creates or retrieves connection for the given sessionUuid.
source code
 
getLastError(self)
Returns error if thrown by _BlitzGateway.connect connect.
source code
 
isConnected(self)
Returns last status of connection.
source code
 
getEventContext(self)
Returns omero_System_ice.EventContext.
source code
 
getUserId(self)
Returns current experimenter id
source code
 
setUserId(self, uid)
Sets current experimenter id
source code
 
getUser(self)
Returns current Experimenter.
source code
 
getAdministrators(self)
Returns Experimenters with administration privileges.
source code
 
getGroupFromContext(self)
Returns current omero_model_ExperimenterGroupI.
source code
 
isAdmin(self)
Checks if a user has administration privileges.
source code
 
isLeader(self, gid=None)
Is the current group (or a specified group) led by the current user?
source code
 
canBeAdmin(self)
Checks if a user is in system group, i.e.
source code
 
canWrite(self, obj)
Checks if a user has write privileges to the given object.
source code
 
canOwnerWrite(self, obj)
Returns isUserWrite() from the object's permissions
source code
 
getSession(self)
Returns the existing session, or creates a new one if needed
source code
 
setGroupNameForSession(self, group)
Looks up the group by name, then delegates to setGroupForSession, returning the result
source code
 
setGroupForSession(self, groupid)
Sets the security context of this connection to the specified group
source code
 
revertGroupForSession(self)
Switches the group to the previous group
source code
 
getAdminService(self)
Gets reference to the admin service from ProxyObjectWrapper.
source code
 
getQueryService(self)
Gets reference to the query service from ProxyObjectWrapper.
source code
 
getContainerService(self)
Gets reference to the container service from ProxyObjectWrapper.
source code
 
getPixelsService(self)
Gets reference to the pixels service from ProxyObjectWrapper.
source code
 
getMetadataService(self)
Gets reference to the metadata service from ProxyObjectWrapper.
source code
 
getRoiService(self)
Gets ROI service.
source code
 
getScriptService(self)
Gets script service.
source code
 
createRawFileStore(self)
Creates a new raw file store.
source code
 
getRepositoryInfoService(self)
Gets reference to the repository info service from ProxyObjectWrapper.
source code
 
getShareService(self)
Gets reference to the share service from ProxyObjectWrapper.
source code
 
getSharedResources(self)
Gets reference to the sharedresources from ProxyObjectWrapper.
source code
 
getTimelineService(self)
Gets reference to the timeline service from ProxyObjectWrapper.
source code
 
getTypesService(self)
Gets reference to the types service from ProxyObjectWrapper.
source code
 
getConfigService(self)
Gets reference to the config service from ProxyObjectWrapper.
source code
 
createRenderingEngine(self)
Creates a new rendering engine.
source code
 
getRenderingSettingsService(self)
Gets reference to the rendering settings service from ProxyObjectWrapper.
source code
 
createRawPixelsStore(self)
Creates a new raw pixels store.
source code
 
createThumbnailStore(self)
Gets a reference to the thumbnail store on this connection object or creates a new one if none exists.
source code
 
createSearchService(self)
Gets a reference to the searching service on this connection object or creates a new one if none exists.
source code
 
getUpdateService(self)
Gets reference to the update service from ProxyObjectWrapper.
source code
 
getDeleteService(self)
Gets reference to the delete service from ProxyObjectWrapper.
source code
 
getSessionService(self)
Gets reference to the session service from ProxyObjectWrapper.
source code
 
createExporter(self)
New instance of non cached Exporter, wrapped in ProxyObjectWrapper.
source code
 
listProjects(self, eid=None)
List every Project controlled by the security system.
source code
 
listScreens(self, eid=None)
List every Screens controlled by the security system.
source code
 
listOrphans(self, obj_type, eid=None, params=None)
List orphaned Datasets, Images, Plates controlled by the security system, Optionally filter by experimenter 'eid'
source code
 
listGroups(self)
Look up all experimenters and related groups.
source code
 
getDefaultGroup(self, eid)
Retrieve the default group for the given user id.
source code
 
getOtherGroups(self, eid)
Fetch all groups of which the given user is a member.
source code
 
getGroupsLeaderOf(self)
Look up Groups where current user is a leader of.
source code
 
getGroupsMemberOf(self)
Look up Groups where current user is a member of (except "user" group).
source code
 
createGroup(self, name, owner_Ids=None, member_Ids=None, perms=None, description=None)
Creates a new ExperimenterGroup.
source code
 
findExperimenters(self, start='')
Return a generator for all Experimenters whose omeName starts with 'start'.
source code
 
containedExperimenters(self, gid)
Fetch all users contained in this group.
source code
 
listColleagues(self)
Look up users who are a member of the current user active group.
source code
 
groupSummary(self, gid=None, exclude_self=False)
Returns lists of 'leaders' and 'members' of the specified group (default is current group) as a dict with those keys.
source code
 
listStaffs(self)
Look up users who are members of groups lead by the current user.
source code
 
listOwnedGroups(self)
Looks up owned groups for the logged user.
source code
 
getFreeSpace(self)
Returns the free or available space on this file system including nested subdirectories.
source code
 
getFilesetFilesInfo(self, 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'
source code
 
getArchivedFilesInfo(self, imageIds)
Gets summary of Original Files that are archived from OMERO 4 imports Returns a dict of files 'count' and sum of 'size'
source code
 
timelineListImages(self, tfrom=None, tto=None, limit=10, only_owned=True)
List images based on their creation times.
source code
 
getObject(self, obj_type, oid=None, params=None, attributes=None)
Retrieve single Object by type E.g.
source code
 
getObjects(self, obj_type, ids=None, params=None, attributes=None, respect_order=False)
Retrieve Objects by type E.g.
source code
 
buildQuery(self, obj_type, ids=None, params=None, attributes=None)
Prepares a query for iQuery.
source code
 
listFileAnnotations(self, eid=None, toInclude=[], toExclude=[])
Lists FileAnnotations created by users, filtering by namespaces if specified.
source code
 
getAnnotationLinks(self, parent_type, parent_ids=None, ann_ids=None, ns=None, params=None)
Retrieve Annotation Links by parent_type E.g.
source code
 
listOrphanedAnnotations(self, 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.
source code
 
createImageFromNumpySeq(self, 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.
source code
 
applySettingsToSet(self, fromid, to_type, toids)
Applies the rendering settings from one image to others.
source code
 
setChannelNames(self, data_type, ids, nameDict, channelCount=None)
Sets and saves new names for channels of specified Images.
source code
 
createOriginalFileFromFileObj(self, fo, path, name, fileSize, mimetype=None, ns=None)
Creates a OriginalFileWrapper from a local file.
source code
 
createOriginalFileFromLocalFile(self, localPath, origFilePathAndName=None, mimetype=None, ns=None)
Creates a OriginalFileWrapper from a local file.
source code
 
createFileAnnfromLocalFile(self, localPath, origFilePathAndName=None, mimetype=None, ns=None, desc=None)
Class method to create a FileAnnotationWrapper from a local file.
source code
 
getObjectsByAnnotations(self, obj_type, annids)
Retrieve objects linked to the given annotation IDs controlled by the security system.
source code
 
getEnumerationEntries(self, klass)
Get all enumerations by class
source code
 
getEnumeration(self, klass, string)
Get enumeration by class and value
source code
 
getEnumerationById(self, klass, eid)
Get enumeration by class and ID
source code
 
getOriginalEnumerations(self)
Gets original enumerations.
source code
 
getEnumerations(self)
Gets list of enumeration types
source code
 
getEnumerationsWithEntries(self)
Get enumeration types, with lists of Enum entries
source code
 
deleteEnumeration(self, obj)
Deletes an enumeration object
source code
 
createEnumeration(self, obj)
Create an enumeration with given object
source code
 
resetEnumerations(self, klass)
Resets the enumerations by type
source code
 
updateEnumerations(self, new_entries)
Updates enumerations with new entries
source code
 
deleteObjectDirect(self, obj)
Directly Delete object (removes row from database).
source code
 
getAvailableDeleteCommands(self)
Retrieves the current set of delete commands with type (graph spec) and options filled.
source code
 
deleteObjects(self, graph_spec, obj_ids, deleteAnns=False, deleteChildren=False)
Generic method for deleting using the delete queue.
source code
 
_waitOnCmd(self, handle, loops=10, ms=500, failonerror=True, failontimeout=False, closehandle=False) source code
 
chmodGroup(self, group_Id, permissions)
Change the permissions of a particluar Group.
source code
 
chgrpObjects(self, graph_spec, obj_ids, group_id, container_id=None)
Change the Group for a specified objects using queue.
source code
 
searchObjects(self, 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
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  ICE_CONFIG = None
ICE_CONFIG - Defines the path to the Ice configuration
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, 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)
(Constructor)

source code 

Create the connection wrapper. Does not attempt to connect at this stage Initialises the omero.client

:param username: User name. :type username: String :param passwd: Password. :type passwd: String :param client_obj: omero.client :param group: name of group to try to connect to :type group: String :param clone: If True, overwrite anonymous with False :type clone: Boolean :param try_super: Try to log on as super user ('system' group) :type try_super: Boolean :param host: Omero server host. :type host: String :param port: Omero server port. :type port: Integer :param extra_config: Dictionary of extra configuration :type extra_config: Dict :param secure: Initial underlying omero.client connection type (True=SSL/False=insecure) :type secure: Boolean :param anonymous: :type anonymous: Boolean :param useragent: Log which python clients use this connection. E.g. 'OMERO.webadmin' :type useragent: String

Overrides: object.__init__

getMaxPlaneSize(self)

source code 

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.

:return: tuple holding (max_plane_width, max_plane_height) as set on the server :rtype: Tuple

isAnonymous(self)

source code 

Returns the anonymous flag

:return: Anonymous :rtype: Boolean

getProperty(self, k)

source code 

Returns named property of the wrapped omero.client

:return: named client property

clone(self)

source code 

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

:return: Clone of this connection wrapper :rtype: _BlitzGateway

setIdentity(self, username, passwd, _internal=False)

source code 

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

:param username: User name. :type username: String :param passwd: Password. :type passwd: String :param _internal: If False, set _anonymous = False :type _internal: Booelan

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

source code 

If current user isAdmin, return new connection owned by 'username'

:param username: Username for new connection :type username: String :param group: If specified, try to log in to this group :type group: String :param ttl: Timeout for new session :type ttl: Int :return: Clone of this connection, with username's new Session :rtype: _BlitzGateway or None if not admin or username unknown

keepAlive(self)

source code 

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

:return: True if connection alive. :rtype: Boolean

seppuku(self, softclose=False)

source code 

Terminates connection with killSession(). If softclose is False, the session is really terminate disregarding its connection refcount.

:param softclose: Boolean

_createProxies(self)

source code 

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.

setSecure(self, secure=True)

source code 

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

:param secure: If False, use an insecure connection :type secure: Boolean

_createSession(self)

source code 

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

connect(self, sUuid=None)

source code 

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

:param sUuid: omero_model_SessionI :return: Boolean

getLastError(self)

source code 

Returns error if thrown by _BlitzGateway.connect connect.

:return: String

isConnected(self)

source code 

Returns last status of connection.

:return: Boolean

getEventContext(self)

source code 

Returns omero_System_ice.EventContext. It containes:

   shareId, sessionId, sessionUuid, userId, userName,
   groupId, groupName, isAdmin, isReadOnly,
   eventId, eventType, eventType,
   memberOfGroups, leaderOfGroups

Also saves context to self._ctx

:return: Event Context from admin service. :rtype: omero.sys.EventContext

getUserId(self)

source code 

Returns current experimenter id

:return: Current Experimenter id :rtype: long

getUser(self)

source code 

Returns current Experimenter.

:return: Current Experimenter :rtype: ExperimenterWrapper

getAdministrators(self)

source code 

Returns Experimenters with administration privileges.

:return: Current Experimenter :return: Generator of BlitzObjectWrapper subclasses

getGroupFromContext(self)

source code 

Returns current omero_model_ExperimenterGroupI.

:return: omero.model.ExperimenterGroupI

isAdmin(self)

source code 

Checks if a user has administration privileges.

:return: Boolean

isLeader(self, gid=None)

source code 

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

:return: True if user leads the current group :rtype: Boolean

canBeAdmin(self)

source code 

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

:return: Boolean

canWrite(self, obj)

source code 

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

:param obj: Given object :return: Boolean

canOwnerWrite(self, obj)

source code 

Returns isUserWrite() from the object's permissions

:param obj: Given object :return: True if the objects's permissions allow owner to write

getSession(self)

source code 

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

:return: The session from session service :rtype: omero.model.session

setGroupNameForSession(self, group)

source code 

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

:param group: Group name :type group: String :return: True if group set successfully :rtype: Boolean

setGroupForSession(self, groupid)

source code 

Sets the security context of this connection to the specified group

:param groupid: The ID of the group to switch to :type groupid: Long :rtype: Boolean :return: True if the group was switched successfully

getAdminService(self)

source code 

Gets reference to the admin service from ProxyObjectWrapper.

:return: omero.gateway.ProxyObjectWrapper

getQueryService(self)

source code 

Gets reference to the query service from ProxyObjectWrapper.

:return: omero.gateway.ProxyObjectWrapper

getContainerService(self)

source code 

Gets reference to the container service from ProxyObjectWrapper.

:return: omero.gateway.ProxyObjectWrapper

getPixelsService(self)

source code 

Gets reference to the pixels service from ProxyObjectWrapper.

:return: omero.gateway.ProxyObjectWrapper

getMetadataService(self)

source code 

Gets reference to the metadata service from ProxyObjectWrapper.

:return: omero.gateway.ProxyObjectWrapper

getRoiService(self)

source code 

Gets ROI service.

:return: omero.gateway.ProxyObjectWrapper

getScriptService(self)

source code 

Gets script service.

:return: omero.gateway.ProxyObjectWrapper

createRawFileStore(self)

source code 

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.

:return: omero.gateway.ProxyObjectWrapper

getRepositoryInfoService(self)

source code 

Gets reference to the repository info service from ProxyObjectWrapper.

:return: omero.gateway.ProxyObjectWrapper

getShareService(self)

source code 

Gets reference to the share service from ProxyObjectWrapper.

:return: omero.gateway.ProxyObjectWrapper

getSharedResources(self)

source code 

Gets reference to the sharedresources from ProxyObjectWrapper.

:return: omero.gateway.ProxyObjectWrapper

getTimelineService(self)

source code 

Gets reference to the timeline service from ProxyObjectWrapper.

:return: omero.gateway.ProxyObjectWrapper

getTypesService(self)

source code 

Gets reference to the types service from ProxyObjectWrapper.

:return: omero.gateway.ProxyObjectWrapper

getConfigService(self)

source code 

Gets reference to the config service from ProxyObjectWrapper.

:return: omero.gateway.ProxyObjectWrapper

createRenderingEngine(self)

source code 

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.

:return: omero.gateway.ProxyObjectWrapper

getRenderingSettingsService(self)

source code 

Gets reference to the rendering settings service from ProxyObjectWrapper.

:return: omero.gateway.ProxyObjectWrapper

createRawPixelsStore(self)

source code 

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.

:return: omero.gateway.ProxyObjectWrapper

createThumbnailStore(self)

source code 

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

:rtype: omero.gateway.ProxyObjectWrapper :return: The proxy wrapper of the thumbnail store

createSearchService(self)

source code 

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

:return: omero.gateway.ProxyObjectWrapper

getUpdateService(self)

source code 

Gets reference to the update service from ProxyObjectWrapper.

:return: omero.gateway.ProxyObjectWrapper

getDeleteService(self)

source code 

Gets reference to the delete service from ProxyObjectWrapper.

:return: omero.gateway.ProxyObjectWrapper

getSessionService(self)

source code 

Gets reference to the session service from ProxyObjectWrapper.

:return: omero.gateway.ProxyObjectWrapper

createExporter(self)

source code 

New instance of non cached Exporter, wrapped in ProxyObjectWrapper.

:return: omero.gateway.ProxyObjectWrapper

listProjects(self, eid=None)

source code 

List every Project controlled by the security system.

:param eid: Filters Projects by owner ID :rtype: ProjectWrapper list

listScreens(self, eid=None)

source code 

List every Screens controlled by the security system.

:param eid: Filters Screens by owner ID :rtype: ProjectWrapper list

listOrphans(self, obj_type, eid=None, params=None)

source code 

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

:param obj_type: 'Dataset', 'Image', 'Plate' :param eid: experimenter id :type eid: Long :param params: omero.sys.ParametersI, can be used for pagination, filtering etc. :param attributes: Map of key-value pairs to filter results by. Key must be attribute of obj_type. E.g. 'name', 'ns' :return: Generator yielding Datasets :rtype: DatasetWrapper generator

listGroups(self)

source code 

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

:return: All experimenters :rtype: ExperimenterWrapper generator

getDefaultGroup(self, eid)

source code 

Retrieve the default group for the given user id.

:param eid: Experimenter ID :type eid: Long :return: The default group for user :rtype: ExperimenterGroupWrapper

getOtherGroups(self, eid)

source code 

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

:param eid: Experimenter ID :type eid: Long :return: Generator of groups for user :rtype: ExperimenterGroupWrapper generator

getGroupsLeaderOf(self)

source code 

Look up Groups where current user is a leader of.

:return: Groups that current user leads :rtype: ExperimenterGroupWrapper generator

getGroupsMemberOf(self)

source code 

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

:return: Current users groups :rtype: ExperimenterGroupWrapper generator

createGroup(self, name, owner_Ids=None, member_Ids=None, perms=None, description=None)

source code 

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

:param name: New group name :param owner_Ids: Option to add existing Experimenters as group owners :param member_Ids: Option to add existing Experimenters as group members :param perms: New group permissions. E.g. 'rw----' (private), 'rwr---'(read-only), 'rwrw--' :param description: Group description

findExperimenters(self, start='')

source code 

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

:param start: omeName must start with these letters :type start: String :return: Generator of experimenters :rtype: ExperimenterWrapper generator

containedExperimenters(self, gid)

source code 

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

:param gid: Group ID :type gid: Long :return: Generator of experimenters :rtype: ExperimenterWrapper generator

listColleagues(self)

source code 

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

:return: Generator of Experimenters or None :rtype: ExperimenterWrapper generator

groupSummary(self, gid=None, exclude_self=False)

source code 

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

:return: {'leaders': list ExperimenterWrapper, 'colleagues': list ExperimenterWrapper} :rtype: dict

listStaffs(self)

source code 

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

:return: Members of groups lead by current user :rtype: ExperimenterWrapper generator

listOwnedGroups(self)

source code 

Looks up owned groups for the logged user.

:return: Groups owned by current user :rtype: ExperimenterGroupWrapper generator

getFreeSpace(self)

source code 

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

:return: Free space in bytes :rtype: Int

getFilesetFilesInfo(self, imageIds)

source code 

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'

:param imageIds: Image IDs list :return: Dict of files 'count' and 'size'

getArchivedFilesInfo(self, imageIds)

source code 

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

:param imageIds: Image IDs list :return: Dict of files 'count' and 'size'

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

source code 

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

:param tfrom: milliseconds since the epoch for start date :param tto: milliseconds since the epoch for end date :param limit: maximum number of results :param only_owned: Only owned by the logged user. Boolean. :return: Generator yielding _ImageWrapper :rtype: ImageWrapper generator

getObject(self, obj_type, oid=None, params=None, attributes=None)

source code 

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.

:param obj_type: Object type. E.g. "Project" see above :type obj_type: String :param ids: object IDs :type ids: List of Long :param params: omero.sys.Parameters, can be used for pagination, filtering etc. :param attributes: Map of key-value pairs to filter results by. Key must be attribute of obj_type. E.g. 'name', 'ns' :return:

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

source code 

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}

:param obj_type: Object type. E.g. "Project" see above :type obj_type: String :param ids: object IDs :type ids: List of Long :param params: omero.sys.Parameters, can be used for pagination, filtering etc. :param attributes: Map of key-value pairs to filter results by. Key must be attribute of obj_type. E.g. 'name', 'ns' :param respect_order: Returned items will be ordered according to the order of ids :return: Generator of BlitzObjectWrapper subclasses

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

source code 

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.

:param obj_type: Object type. E.g. "Project" see above :type obj_type: String :param ids: object IDs :type ids: List of Long :param params: omero.sys.Parameters, can be used for pagination, filtering etc. :param attributes: Map of key-value pairs to filter results by. Key must be attribute of obj_type. E.g. 'name', 'ns' :return: (query, params, wrapper)

listFileAnnotations(self, eid=None, toInclude=[], toExclude=[])

source code 

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.

:param eid: Filter results by this owner Id :param toInclude: Only return annotations with these namespaces. List of strings. :param toExclude: Don't return annotations with these namespaces. List of strings. :return: Generator of FileAnnotationWrappers - with files loaded.

getAnnotationLinks(self, parent_type, parent_ids=None, ann_ids=None, ns=None, params=None)

source code 

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()

:param obj_type: Object type. E.g. "Project" see above :type obj_type: String :param ids: object IDs :type ids: List of Long :return: Generator yielding wrapped objects.

listOrphanedAnnotations(self, parent_type, parent_ids, eid=None, ns=None, anntype=None, addedByMe=True)

source code 

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

:param parent_type: E.g. 'Dataset', 'Image' etc. :param parent_ids: IDs of the parent. :param eid: Optional filter by Annotation owner :param ns: Filter by annotation namespace :param anntype: Optional specify 'Text', 'Tag', 'File', 'Long', 'Boolean' :return: Generator yielding AnnotationWrappers :rtype: AnnotationWrapper generator

createImageFromNumpySeq(self, zctPlanes, imageName, sizeZ=1, sizeC=1, sizeT=1, description=None, dataset=None, sourceImageId=None, channelList=None)

source code 

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)

:param session          An OMERO service factory or equivalent with getQueryService() etc.
:param zctPlanes        A generator of numpy 2D arrays, corresponding to Z-planes of new image.
:param imageName        Name of new image
:param description      Description for the new image
:param dataset          If specified, put the image in this dataset. omero.model.Dataset object
:param sourceImageId    If specified, copy this image with metadata, then add pixel data
:param channelList      Copies metadata from these channels in source image (if specified). E.g. [0,2]
:return The new OMERO image: omero.model.ImageI

applySettingsToSet(self, fromid, to_type, toids)

source code 

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

:param fromid:      ID of Image to copy settings from.
:param toids:       List of Image IDs to apply setting to.
:param to_type:     toids refers to Images by default, but can refer to
                        Project, Dataset, Image, Plate, Screen, Pixels

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

source code 

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.

:param data_type: 'Image', 'Dataset', 'Plate' :param ids: Image, Dataset or Plate IDs :param nameDict: A dict of index:'name' ** 1-based ** E.g. {1:"DAPI", 2:"GFP"} :param channelCount: If specified, only rename images with this number of channels :return: {'imageCount':totalImages, 'updateCount':updateCount}

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

source code 

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

:param conn: Blitz connection :param fo: The file object :param path: The file path :param name: The file name :param fileSize: The file size :param mimetype: The mimetype of the file. String. E.g. 'text/plain' :param ns: The file namespace :return: New OriginalFileWrapper

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

source code 

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

:param conn: Blitz connection :param localPath: Location to find the local file to upload :param origFilePathAndName: Provides the 'path' and 'name' of the OriginalFile. If None, use localPath :param mimetype: The mimetype of the file. String. E.g. 'text/plain' :param ns: The namespace of the file. :return: New OriginalFileWrapper

createFileAnnfromLocalFile(self, localPath, origFilePathAndName=None, mimetype=None, ns=None, desc=None)

source code 

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

:param conn: Blitz connection :param localPath: Location to find the local file to upload :param origFilePathAndName: Provides the 'path' and 'name' of the OriginalFile. If None, use localPath :param mimetype: The mimetype of the file. String. E.g. 'text/plain' :param ns: The namespace of the file. :param desc: A description for the file annotation. :return: New FileAnnotationWrapper

getObjectsByAnnotations(self, obj_type, annids)

source code 

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

:param annids: Annotation IDs :type annids: Long :return: Generator yielding Objects :rtype: BlitzObjectWrapper generator

getEnumerationEntries(self, klass)

source code 

Get all enumerations by class

:param klass: Class :type klass: Class or string :return: Generator of Enumerations :rtype: EnumerationWrapper generator

getEnumeration(self, klass, string)

source code 

Get enumeration by class and value

:param klass: Class :type klass: Class or string :param string: Enum value :type string: String :return: Enumeration or None :rtype: EnumerationWrapper

getEnumerationById(self, klass, eid)

source code 

Get enumeration by class and ID

:param klass: Class :type klass: Class or string :param eid: Enum ID :type eid: Long :return: Enumeration or None :rtype: EnumerationWrapper

getOriginalEnumerations(self)

source code 

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

:return: Original enums :rtype: Dict of <string: EnumerationWrapper list >

getEnumerations(self)

source code 

Gets list of enumeration types

:return: List of enum types :rtype: List of Strings

getEnumerationsWithEntries(self)

source code 

Get enumeration types, with lists of Enum entries

:return: Dictionary of type: entries :rtype: Dict of <string: EnumerationWrapper list >

deleteEnumeration(self, obj)

source code 

Deletes an enumeration object

:param obj: Enumeration object :type obj: omero.model.IObject

createEnumeration(self, obj)

source code 

Create an enumeration with given object

:param obj: Object :type obj: omero.model.IObject

resetEnumerations(self, klass)

source code 

Resets the enumerations by type

:param klass: Type of enum to reset :type klass: String

updateEnumerations(self, new_entries)

source code 

Updates enumerations with new entries

:param new_entries: List of objects :type new_entries: List of omero.model.IObject

deleteObjectDirect(self, obj)

source code 

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

:param obj: Object to delete :type obj: IObject

getAvailableDeleteCommands(self)

source code 

Retrieves the current set of delete commands with type (graph spec) and options filled. :return: Exhaustive list of available delete commands. :rtype: omero.api.delete.DeleteCommand

deleteObjects(self, graph_spec, obj_ids, deleteAnns=False, deleteChildren=False)

source code 

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

:param graph_spec:      String to indicate the object type or graph
                        specification. Examples include:
                         * 'Project'
                         * 'Dataset'
                         * 'Image'
                         * 'Screen'
                         * 'Plate'
                         * 'Well'
                         * 'Annotation'
                         * '/OriginalFile'
                         * '/Image+Only'
                         * '/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.
:param obj_ids:         List of IDs for the objects to delete
:param deleteAnns:      If true, delete linked Tag, Term and File
                        annotations
:param deleteChildren:  If true, delete children. E.g. Delete Project
                        AND it's Datasets & Images.
:return:                Delete handle
:rtype:                 L{omero.api.delete.DeleteHandle}

chmodGroup(self, group_Id, permissions)

source code 

Change the permissions of a particluar 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()

chgrpObjects(self, graph_spec, obj_ids, group_id, container_id=None)

source code 

Change the Group for a specified objects using queue.

:param 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 convenience
:param obj_ids:         IDs for the objects to move.
:param group_id:        The group to move the data to.

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

source code 

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

:param obj_types: E.g. ["Dataset", "Image"] :param text: The text to search for :param created: omero.rtime list or tuple (start, stop) :param useAcquisitionDate if True, then use Image.acquisitionDate rather than import date for queries. :return: List of Object wrappers. E.g. ImageWrapper