Module to encapsulate operations concerned with displaying the contents of a plate as a grid.
Retrieve annotations for object specified by object type and identifier, optionally traversing object model graph.
This url will download the Original Image File(s) archived at import time. If it’s a single file, this will be downloaded directly. For multiple files, they are assembled into a zip file on the fly, and this is downloaded.
Copy the rendering settings from one image to a list of images, specified in request by ‘fromid’ and list of ‘toids’. See L{views.copy_image_rdef_json}
json method: returns details of specified Dataset. See L{views.datasetDetail_json}. Returns E.g {“description”: “”, “type”: “Dataset”, “id”: 901, “name”: “example”}
- webgateway/dataset/<did>/detail params are:
- did: Dataset ID
Returns html page displaying full image viewer and image details, rendering settings etc. See L{views.full_viewer}.
- webgateway/img_detail/<iid>/ params are:
- iid: Image ID.
Gets rendering definition from the ‘session’ if saved. Returns json dict of ‘c’, ‘m’, ‘z’, ‘t’.
This url will retrieve all rendering definitions for a given image (id)
gets all the ROIs for an Image as json. Image-ID is request: imageId=123 [{‘id’:123, ‘shapes’:[{‘type’:’Rectangle’, ‘theZ’:5, ‘theT’:0, ‘x’:250,
‘y’:100, ‘width’:10 ‘height’:45} ]
gets a Shape as json. ROI-ID, Shape-ID is request: roiId=123 and shapeId=123 {‘type’:’Rectangle’, ‘theZ’:5, ‘theT’:0, ‘x’:250, ‘y’:100, ‘width’:10, ‘height’:45}
Gets a histogram of 256 columns (grey levels) for the chosen channel of an image. A single plane is specified by ?theT=1&theZ=2.
json method: returns details of specified Image. See L{views.imageData_json}. Returns E.g {“description”: “”, “type”: “Dataset”, “id”: 901, “name”: “example”}
webgateway/imgData/<iid>/<key> params are:
did: Dataset ID
- key: Optional key of selected attributes to return. E.g. meta,
pixel_range, rdefs, split_channel, size etc
json method: returns list of Datasets belonging to specified Project. See L{views.listDatasets_json}. Returns E.g list of {“child_count”: 4, “description”: “”, “type”: “Dataset”, “id”: 901,
“name”: “example”}
- webgateway/proj/<pid>/children params are:
- pid: Project ID
json method: returning list of all lookup tables available for rendering engine. E.g. list of {path: “/luts/”, size: 800, id: 37, name: “cool.lut”},
json method: returning list of all projects available to current user. See L{views.listProjects_json} . List of E.g. {“description”: “”, “id”: 651, “name”: “spim”}
json method: returns list of IDs for images that have channels compatible with the specified image, such that rendering settings can be copied from the image to those returned. Images are selected from the same project that the specified image is in.
- webgateway/compatImgRDef/<iid>/ params are:
- iid: Image ID.
Query bulk annotations table attached to an object specified by object type and identifier, optionally traversing object model graph.
This makes the settings.OPEN_WITH configuration available via json
Get a json dict of original file paths. ‘repo’ is a list of path/name strings for original files in managed repo ‘client’ is a list of paths for original files on the client when imported
json method: returns details of specified Project. See L{views.projectDetail_json}. Returns E.g {“description”: “”, “type”: “Project”, “id”: 651, “name”: “spim”}
- webgateway/proj/<pid>/detail params are:
- pid: Project ID
Returns a bird’s eye view JPEG of the OMERO Image. See L{views.render_birds_eye_view}. Uses current rendering settings. Params in render_birds_eye_view/<iid>/ are:
iid: Image ID
- size: Maximum size of the longest side of the resulting bird’s eye
view.
Returns a gif graph of pixel values for a column of an image plane. See L{views.render_col_plot}. Channels can be turned on/off using request. E.g. c=-1,2,-3,-4 Params in render_col_plot/<iid>/<z>/<t>/<x>/<w> are:
- iid: Image ID
- z: Z index
- t: T index
- x: X position of pixel column
- w: Optional line width of plot
Returns a jpeg of the OMERO image. See L{views.render_image}. Rendering settings can be specified in the request parameters. See L{views.getImgDetailsFromReq} for details. Params in render_image/<iid>/<z>/<t>/ are:
- iid: Image ID
- z: Z index
- t: T index
Returns a jpeg of the OMERO image, rendering only a region specified in query string as region=x,y,width,height. E.g. region=0,512,256,256 See L{views.render_image_region}. Rendering settings can be specified in the request parameters. Params in render_image/<iid>/<z>/<t>/ are:
- iid: Image ID
- z: Z index
- t: T index
Generates a movie file from the image, spanning Z or T frames. See L{views.render_movie} Returns the file or redirects to temp file location. Params in render_movie/<iid>/<axis>/<pos> are:
- iid: Image ID
- axis: ‘z’ or ‘t’ dimension that movie plays
- pos: The T index (for ‘z’ movie) or Z index (for ‘t’ movie)
Generates an OME-TIFF of an Image (or zip for multiple OME-TIFFs) and returns the file or redirects to a temp file location. See L{views.render_ome_tiff} Params in render_ome_tiff/<ctx>/<cid> are:
- ctx: The container context. ‘p’ for Project, ‘d’ for Dataset or ‘i’
Returns a thumbnail jpeg of the OMERO ROI. See L{views.render_roi_thumbnail}. Uses current rendering settings.
Returns a gif graph of pixel values for a row of an image plane. See L{views.render_row_plot}. Channels can be turned on/off using request. E.g. c=-1,2,-3,-4 Params in render_row_plot/<iid>/<z>/<t>/<y>/<w> are:
- iid: Image ID
- z: Z index
- t: T index
- y: Y position of pixel row
- w: Optional line width of plot
Returns a mask for the specified shape
Returns a thumbnail jpeg of the OMERO Shape. See L{views.render_shape_thumbnail}. Uses current rendering settings.
Returns a jpeg of OMERO Image with channels split into different panes in a grid. See L{views.render_split_channel}. Rendering settings can be specified in the request parameters (as above). Params in render_split_channel/<iid>/<z>/<t> are:
- iid: Image ID
- z: Z index
- t: T index
Returns a thumbnail jpeg of the OMERO Image, optionally scaled to max-width and max-height. See L{views.render_thumbnail}. Uses current rendering settings. Query string can be used to specify Z or T section. E.g. ?z=10. Params in render_thumbnail/<iid>/<w>/<h> are:
- iid: Image ID
- w: Optional max width
- h: Optional max height
Apply the owner’s rendering settings to the specified objects. Objects defined in request by E.g. totype=dataset&toids=1&toids=2
Reset the images within specified objects to their rendering settings at import time” Objects defined in request by E.g. totype=dataset&toids=1&toids=2
Saves rendering definition (from request parameters) on the image. See L{views.save_image_rdef_json}. For rendering parameters, see L{views.getImgDetailsFromReq} for details. Returns ‘true’ if worked OK.
- webgateway/saveImgRDef/<iid>/ params are:
- iid: Image ID.
Query a table specified by fileid
Returns a main prefix
Returns a thumbnail base64 encoded of the OMERO Images, optionally scaled to max-width and max-height. See L{views.render_thumbnail}. Uses current rendering settings. Query string can be used to specify Z or T section. E.g. ?z=10. Params in render_thumbnail/<iid>/<w>/<h> are:
- iid: Image ID
- w: Optional max width
- h: Optional max height
Returns a set of thumbnail base64 encoded of the OMERO Images, optionally scaled to max-longest-side. Image ids are specified in query string as list, e.g. id=1&id=2.
json method: returns list of Images belonging to specified Dataset. See L{views.listImages_json}. Returns E.g list of {“description”: “”, “author”: “Will Moore”, “date”: 1291325060.0,
“thumb_url”: “/webgateway/render_thumbnail/4701/”, “type”: “Image”, “id”: 4701, “name”: “spim.png”}
webgateway/dataset/<did>/children params are: - did: Dataset ID
request variables: - thumbUrlPrefix: view key whose reverse url is to be used as prefix for
thumb_url instead of default webgateway.views.render_thumbnail
- tiled: if set with anything other than an empty string will add
information on whether each image is tiled on this server
json method: returns list of Images belonging to specified Well. See L{views.listWellImages_json}. Returns E.g list of {“description”: “”, “author”: “Will Moore”, “date”: 1291325060.0,
“thumb_url”: “/webgateway/render_thumbnail/4701/”, “type”: “Image”, “id”: 4701, “name”: “spim.png”}
- webgateway/well/<did>/children params are:
- did: Well ID
json method: returns search results. All parameters in request. See L{views.search_json}
Admin method to switch to the specified user, identified by username: <user> Returns ‘true’ if switch went OK.
Retrieves parameters from the request. If the parameters are not present an empty list is returned
This does not catch exceptions as it makes sense to throw exceptions if the arguments provided do not pass basic type validation
Util function to download original files from a list of images and arrange them within a temp file, such that there are no name clashes and multi-image filesets are kept distict. Handles archived files from OMERO 4 images and fileset files for OMERO 5 images.
@param images: Images as source of original files. @type List of ImageWrappers @param temp: Directory for creating Zip file @param zipName: Name of zip
Bases: file
Class extends file to facilitate creation and deletion of lock file.
tries to delete the lock file and close the file
Bases: object
Caching base class - extended by L{FileCache} for file-based caching. Methods of this base class return None or False providing a no-caching implementation if needed
Bases: omeroweb.webgateway.webgateway_cache.CacheBase
Implements file-based caching within the directory specified in constructor.
Verifies if a specific cache entry (provided as absolute file path) is expired. If expired, it gets deleted and method returns false. If not expired, returns True.
If fname is a file object, fpos will advance size_of_double bytes.
@param fname: File path or file object @rtype Boolean @return True if entry is valid, False if expired
Creates a directory for the root dir of the cache.
Tries to delete the data at the specified absolute file path
@param fname: File name of data to delete
Disk Usage count on the filesystem the cache is based at
@rtype: int @return: the current usage, in KB
Checks whether the cache is full, either because we have exceeded max number of entries or the cache space is full.
@return: True if cache is full @rtype: Boolean
Returns the number of files in the cache @rtype: int
Uses the key to construct an absolute path to the cache data. @param key: Cache key @return: Path @rtype: String
Returns the number of files in the cache @rtype: int
Iterate the whole cache structure searching and cleaning expired entries. this method may be expensive, so only call it when really necessary.
Adds data to cache, returning False if already cached. Otherwise delegating to L{set}
@param key: Unique key for cache @param value: Value to cache - must be String @param timeout: Optional timeout - otherwise use default @param invalidateGroup: Not used?
Attempt to delete the cache data referenced by key @param key: Cache key
Gets data from cache
@param key: cache key @param default: default value to return @return: cache data or default if timout has passed
Returns true if the cache has the specified key @param key: Key to look for. @rtype: Boolean
Adds data to cache, overwriting if already cached.
@param key: Unique key for cache @param value: Value to cache - must be String @param timeout: Optional timeout - otherwise use default @param invalidateGroup: Not used?
Deletes everything in the cache
Bases: object
Caching class for webgateway.
Calls cache.delete(key)
Calls cache.set(key, obj)
Returns a key for caching the Image, based on parameters above, including rendering settings specified in the http request.
@param client_base: server_id for cache key @param img: L{omero.gateway.ImageWrapper} for ID @param obj: Data to cache @param size: Size used for cache key. Tuple
Creates a cache key for storing json data based on params above.
@param r: http request - not used @param client_base: server_id @param obj: ObjectWrapper @param ctx: Additional string for cache key @return: Cache key @rtype: String
Generates a string key for caching the thumbnail, based on the above parameters
@param r: not used @param client_base: server-id, forms stem of the key @param user_id: OMERO user ID to partition caching upon @param iid: image ID @param size: size of the thumbnail - tuple. E.g. (100,)
Updates the timeout, max_entries and max_size (if specified) for the given cache
@param cache: Cache or caches to update. @type cache: L{CacheBase} or list of caches
Clears all the caches.
Clears data from the json cache using ‘contents’ as context
@param r: http request - not used @param client_base: server_id for cache key @param ds: ObjectWrapper for cache key @rtype: True
Clears image data from cache using default rendering settings (r=None) T and Z indexes ( = 0). TODO: Doesn’t clear any data stored WITH r, t, or z specified in cache key? Also clears thumbnail (but not thumbs with size specified) and json data for this image.
@param r: http request for cache key @param client_base: server_id for cache key @param user_id: OMERO user ID to partition caching upon @param img: ImageWrapper for cache key @param obj: Data to cache @param rtype: True
TODO: document WAS: Only handles Dataset obj, calling L{clearDatasetContents}
Clears thumbnail from cache.
@param r: for cache key - Not used? @param client_base: server_id for cache key @param user_id: OMERO user ID to partition caching upon @param iid: image ID for cache key @param size: Size used for cache key. Tuple @return: True
handle events coming our way from blitz.onEventLogs.
Because all processes will be listening to the same events, we use a simple file lock mechanism to make sure the first process to get the event will be the one handling things from then on.
@param client_base: TODO: docs! @param events:
Gets data from the json cache using ‘contents’ as context
@param r: http request - not used @param client_base: server_id for cache key @param ds: ObjectWrapper for cache key @rtype: String or None
Gets image data from cache.
@param r: http request for cache key @param client_base: server_id for cache key @param img: ImageWrapper for cache key @param z: Z index for cache key @param t: T index for cache key @param ctx: Additional string for cache key @return: Image data @rtype: String
Gets data from the json cache
@param r: http request - not used @param client_base: server_id for cache key @param obj: ObjectWrapper for cache key @param ctx: context string used for cache key @rtype: String or None
Calls L{getImage} with ‘-ometiff’ context @rtype: String
Calls L{getImage} with ‘-sc’ context @rtype: String
Gets thumbnail from cache.
@param r: for cache key - Not used? @param client_base: server_id for cache key @param user_id: OMERO user ID to partition caching upon @param iid: image ID for cache key @param size: Size used for cache key. Tuple @return: Cached data or None @rtype: String
Handle one event from blitz.onEventLogs.
Meant to be overridden, this implementation just logs.
@param client_base: TODO: docs! @param e:
Invalidates all caches for this particular object
@param client_base: The server_id @param user_id: OMERO user ID to partition caching upon @param obj: The object wrapper. E.g.
L{omero.gateway.ImageWrapper}
Adds data to the json cache using ‘contents’ as context
@param r: http request - not used @param client_base: server_id for cache key @param ds: ObjectWrapper for cache key @param data: Data to cache @rtype: True
Puts image data into cache.
@param r: http request for cache key @param client_base: server_id for cache key @param img: ImageWrapper for cache key @param z: Z index for cache key @param t: T index for cache key @param obj: Data to cache @param ctx: Additional string for cache key
Adds data to the json cache
@param r: http request - not used @param client_base: server_id for cache key @param obj: ObjectWrapper for cache key @param data: Data to cache @param ctx: context string used for cache key @rtype: True
Calls L{setImage} with ‘-ometiff’ context
Calls L{setImage} with ‘-sc’ context
Puts thumbnail into cache.
@param r: for cache key - Not used? @param client_base: server_id for cache key @param user_id: OMERO user ID to partition caching upon @param iid: image ID for cache key @param obj: Data to cache @param size: Size used for cache key. Tuple
simple lock mechanisn to avoid multiple processes on the same cache to step on each other’s toes.
@rtype: boolean @return: True if we created a lockfile or already had it. False
otherwise.
Bases: object
Class for handling creation of temporary files
Tries to delete all the temp files that have expired their cache timeout.
Tries to create the directories required for the temp file base dir
Creates a new directory if needed, see L{newdir} and checks whether this contains a file ‘name’. If not, a file lock is created for this location and returned.
@param name: Name of file we want to create. @param key: The new dir name @return: Tuple of (abs path to new directory, relative path
key/name, L{AutoFileLock} or True if exists)
Creates a new directory using key as the dir name, and adds a timestamp file with its creation time. If key is not specified, use a unique key based on timestamp.
@param key: The new dir name @return: Tuple of (path to new directory, key used)