|
1 |
| -from omero.gateway import BlitzGateway |
2 |
| -from omero.gateway import BlitzObjectWrapper |
3 |
| -from omero.model import ExternalInfoI, ImageI |
4 |
| -from omero.rtypes import rstring, rlong |
5 |
| -from omero_sys_ParametersI import ParametersI |
6 |
| -from omero.model import Image |
7 |
| -from omero.model import Plate |
8 |
| -from omero.model import Screen |
9 |
| -from omero.model import Dataset |
10 |
| -from omero.model import Project |
11 | 1 | import re
|
12 | 2 |
|
| 3 | +from omero.gateway import BlitzGateway, BlitzObjectWrapper |
| 4 | +from omero.model import Dataset, ExternalInfoI, Image, ImageI, Plate, Project, Screen |
| 5 | +from omero.rtypes import rlong, rstring |
| 6 | +from omero_sys_ParametersI import ParametersI |
13 | 7 |
|
14 | 8 | # Regex to match well positions (eg. A1)
|
15 | 9 | WELL_POS_RE = re.compile(r"(?P<row>\D+)(?P<col>\d+)")
|
@@ -65,7 +59,9 @@ def _lookup(conn: BlitzGateway, type: str, oid: int) -> BlitzObjectWrapper:
|
65 | 59 | return obj
|
66 | 60 |
|
67 | 61 |
|
68 |
| -def get_images(conn: BlitzGateway, object) -> tuple[BlitzObjectWrapper, str | None, int | None]: |
| 62 | +def get_images( |
| 63 | + conn: BlitzGateway, object |
| 64 | +) -> tuple[BlitzObjectWrapper, str | None, int | None]: |
69 | 65 | """
|
70 | 66 | Generator that yields images from any OMERO container object.
|
71 | 67 |
|
@@ -117,30 +113,30 @@ def get_images(conn: BlitzGateway, object) -> tuple[BlitzObjectWrapper, str | No
|
117 | 113 | def set_external_info(conn: BlitzGateway, img: ImageI, well: str, idx: int) -> ImageI:
|
118 | 114 | """
|
119 | 115 | Set external info for an image to enable omero zarr pixel buffer handling.
|
120 |
| - |
| 116 | +
|
121 | 117 | This function configures an image for use with the omero-zarr-pixel-buffer by:
|
122 | 118 | 1. Retrieving the original file path
|
123 | 119 | 2. Converting it to point to the 5d multiscale image directory
|
124 | 120 | 3. Setting up the external info with the path and metadata
|
125 |
| - |
| 121 | +
|
126 | 122 | For plate-based images (with wells), the path structure follows:
|
127 | 123 | /<base_path>/<row>/<column>/<field index>
|
128 |
| - |
| 124 | +
|
129 | 125 | For regular images:
|
130 | 126 | /<base_path>/0
|
131 |
| - |
| 127 | +
|
132 | 128 | Args:
|
133 | 129 | conn (BlitzGateway): Active OMERO gateway connection
|
134 | 130 | img (ImageI): OMERO image object to modify
|
135 | 131 | well (str): Well position (e.g., 'A1', 'B2') for plate-based images, or None
|
136 | 132 | idx (int): Well sample / field index for plate-based images, or None
|
137 |
| - |
| 133 | +
|
138 | 134 | Returns:
|
139 | 135 | ImageI: Modified image object with updated external info
|
140 |
| - |
| 136 | +
|
141 | 137 | Raises:
|
142 | 138 | ValueError: If the image path is not an OME-Zarr format or if well position is invalid
|
143 |
| - |
| 139 | +
|
144 | 140 | Note:
|
145 | 141 | The external info is configured with entity type 'com.glencoesoftware.ngff:multiscales'
|
146 | 142 | and entity ID 3, which are required by the omero-zarr-pixel-buffer.
|
|
0 commit comments