acia.segm.omero.storer#
Classes for OMERO storage interaction
- acia.segm.omero.storer.create_roi(updateService, img, shapes)[source]#
Helper function to create the roi object updateService: omero update Service img: omero image object (not the id) shapes: list of omero.model shapes
returns: RoI object
- acia.segm.omero.storer.create_roi_fast(updateService, img, shapes)[source]#
Helper function to create the roi object (without waiting) updateService: omero update Service img: omero image object (not the id) shapes: list of omero.model shapes
- class acia.segm.omero.storer.OmeroRoIStorer[source]#
Bases:
objectStores and loads overlay results in the roi format (readable by ImageJ)
- static store(overlay, imageId, username, password, serverUrl, port=4064, secure=True, force=False, conn=None)[source]#
Stores overlay results in OMERO. Uses existing connection if available.
overlay: the overlay to store imageId: omero id of the image sequence username: omero username password: omero password serverUrl: omero web address port: omero port (default: 4064) conn: existing OMERO connection or None. (default: None)
- static load(imageId, username, password, serverUrl, port=4064, secure=True, roiId=None, conn=None)[source]#
Loads overlay from omero. Only considers polygons.
imageId: omero id of the image sequence username: omero username password: omero password serverUrl: omero web address port: omero port (default: 4064)
- class acia.segm.omero.storer.IngoreWithWrapper[source]#
Bases:
objectWrapper to ignore context and do not exit after leaving. Is used for not starting/ending omero connections all the time!
- class acia.segm.omero.storer.OmeroSource[source]#
Bases:
BlitzConnBase Class for omero image information. Bundles functionality for image and RoIs.
- __init__(imageId, username=None, password=None, serverUrl=None, port=4064, secure=True, conn=None, readonly=True)[source]#
- Parameters:
imageId (float) – omero image id
username (str, optional) – omero username. Not needed when conn is provided. Defaults to None.
password (str, optional) – omero password. Not needed when conn is provided. Defaults to None.
serverUrl (str, optional) – omero url. Not needed when conn is provided. Defaults to None.
port (int, optional) – omero port. Not needed when conn is provided. Defaults to 4064.
secure (bool, optional) – Whether to choose secure connection. Defaults to True.
conn ([type], optional) – Existing omero connection. Defaults to None.
- property rawPixelSize: tuple[omero.model.LengthI, omero.model.LengthI]#
Return the pixel size in omero objects
- Returns:
Tuple[LengthI,LengthI] – x and y pixel size in omero objects
- property pixelSize: tuple[float, float]#
Return the pixel size in micron
- Returns:
Tuple[float,float] – x and y pixel size in micron
- class acia.segm.omero.storer.OmeroSequenceSource[source]#
Bases:
ImageSequenceSource,OmeroSource,JupyterVisualizationMixinUses omero server as a source for images
- __init__(imageId, username=None, password=None, serverUrl=None, port=4064, channels=None, z=0, imageQuality=1.0, secure=True, colorList=None, range=None, conn=None, frame_interval=None, timepoints=None, pixel_size=None)[source]#
imageId: id of the image sequence username: omero username password: omero password serverUrl: omero server url port: omero port channels: list of image channels to activate (e.g. include fluorescence channels) z: focus plane imageQuality: quality of the rendered images (1.0=no compression, 0.0=super compression) base_channel: id of the phase contrast channel (visualized over all rgb channels) frame_interval/timepoints: imaging time calibration (pint); see ImageSequenceSource. pixel_size: pixel size (pint); defaults to the OMERO server metadata when omitted.
- property pixel_size#
User-set pixel size (pint), else the OMERO server metadata
(x, y).
- class acia.segm.omero.storer.OmeroRawSource[source]#
Bases:
ImageSequenceSource,OmeroSource,JupyterVisualizationMixinRaw OMERO source: Allows to easily access raw that is, e.g. 16-bit data of your OMERO images
- __init__(imageId, username=None, password=None, serverUrl=None, port=4064, secure=True, conn=None, channels=None)[source]#
- property pixel_size#
User-set pixel size (pint), else the OMERO server metadata
(x, y).
- class acia.segm.omero.storer.OmeroRoISource[source]#
Bases:
OmeroSource,RoISourceSource for OMERO RoIs beloging to an OMERO image sequence
- __init__(imageId, username, password, serverUrl, port=4064, secure=True, roiSelector=<function OmeroRoISource.<lambda>>, range=None, scale=None, conn=None)[source]#
- Parameters:
imageId (float) – omero image id
username (str, optional) – omero username. Not needed when conn is provided. Defaults to None.
password (str, optional) – omero password. Not needed when conn is provided. Defaults to None.
serverUrl (str, optional) – omero url. Not needed when conn is provided. Defaults to None.
port (int, optional) – omero port. Not needed when conn is provided. Defaults to 4064.
secure (bool, optional) – Whether to choose secure connection. Defaults to True.
conn ([type], optional) – Existing omero connection. Defaults to None.
- acia.segm.omero.storer.upload_file(omero_type, omero_id, file_path, conn, mime_type='text/plain', namespace=None)[source]#
Upload a file attachement for an OMERO object (Image, Datase, Project)
- Parameters:
omero_type (str) – Image, Dataset or Project
omero_id (int) – id of the omero object
file_path (Path) – file path of the file to upload
conn (BlitzGateway) – connection to OMERO
mime_type (str, optional) – mime type of the uploaded data. Defaults to “text/plain”.
namespace (str, optional) – OMERO namespace of the uploaded file
- Returns:
_type_ – created annotation object
- acia.segm.omero.storer.download_file_from_object(omero_type, omero_id, file_name, output_path, conn, append_filename=False)[source]#
Download a file annotation with a given name from an OMERO object
- Parameters:
omero_type (str) – Image, Dataset or Project
omero_id (int) – unique id of the OMERO object
file_name (str) – the name of the file attachment to download
output_path (Path) – output path to save the file
conn (_type_) – OMERO connection
append_filename (bool, optional) – If true the filename is appended to the output path. Defaults to False.
- Raises:
ValueError – _description_
- acia.segm.omero.storer.download_file_from_annotation(ann, output_path, append_filename=False)[source]#
Download OMERO file attachment
- Parameters:
ann (_type_) – OMERO annotation object
output_path (Path) – path to write the file to
append_filename (bool, optional) – If True treats output_path as a folder and appends the OMERO file name. Defaults to False.
- acia.segm.omero.storer.delete_file_annotation(annotation_id, conn)[source]#
Delete an OMERO file attachement
- Parameters:
annotation_id (int) – id of the annotation object
conn (BlitzGateway) – OMERO connection
- acia.segm.omero.storer.list_file_annotations(omero_type, omero_id, conn)[source]#
List all file annotations of an OMERO object
- acia.segm.omero.storer.replace_file_annotation(omero_type, omero_id, file_path, conn, mime_type='text/plain')[source]#
Replace an OMERO file by a new version.
Deletes existing file attachements on OMERO with the same name and uploads the new file.
- Parameters:
- Returns:
_type_ – new annotation object of the uploaded file