omero/tiles.py
OmeroPy tile helpers
create_full_tile_list(z_indexes, channels, timepoints, width, height, tile_size, weave=False)
Creates a list of all tiles for given dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z_indexes | list[int] | list containing z_indexes to gather | required |
channels | list[int] | list containing channels to gather | required |
timepoints | list[int] | list containing timepoints to gather | required |
width | int | width of full image in pixels | required |
height | int | height of full image in pixels | required |
tile_size | tuple[int, int] | | required |
weave | Interlace tiles from each channel vs default seperate channels. | False |
Returns:
| Type | Description |
|---|---|
list | list of (z,c,t,(x,y,w,h)) tiles for use in getTiles |
Examples:
>>> createFullTileList((0),(0,2),(0),1000,1000,10,10)
list[
(0,0,0,(0,0,10,10)), (0,0,0,(10,0,10,10))...
(0,2,0,(0,0,10,10)), (0,2,0,(10,0,10,10))...
]
Default will gather each channel separately.
>>> createFullTileList((0),(0,2),(0),1000,1000,10,10, weave=True)
list[
(0,0,0,(0,0,10,10)), (0,2,0,(0,0,10,10)),
(0,0,0,(10,0,10,10)), (0,2,0,(10,0,10,10))...
]
Setting weave True will mix the channels together. Used for writing RGB images
Source code in lavlab/omero/tiles.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
create_tile_list_2d(z, c, t, size_x, size_y, tile_size)
Creates a list of tile coords for a given 2D plane (z,c,t)
Notes
Tiles are outputed as (z,c,t,(x,y,w,h)) as this is the expected format by omero python bindings. This may cause confusion as numpy uses rows,cols (y,x) instead of x,y.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z | int | z index | required |
c | int | channel | required |
t | int | timepoint | required |
size_x | int | width of full image in pixels | required |
size_y | int | height of full image in pixels | required |
tile_size | tuple[int, int] | size of tile to gather (x,y) | required |
Returns:
| Type | Description |
|---|---|
list | list of (z,c,t,(x,y,w,h)) tiles for use in getTiles |
Source code in lavlab/omero/tiles.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
create_tile_list_from_image(img, rgb=False, include_z=True, include_t=True)
Generates a list of tiles from an omero.model.Image object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
img | ImageWrapper | Omero Image object from conn.getObjects(). | required |
rgb | Puts tile channels next to each other. | False | |
include_z | get tiles for z indexes | True | |
include_t | get tiles for timepoints | True |
Returns:
| Type | Description |
|---|---|
list | List of (z,c,t,(x,y,w,h)) tiles for use in getTiles. |
Source code in lavlab/omero/tiles.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
get_tiles(img, tiles, res_lvl=None, rps_bypass=True, conn=None)
Pull tiles from omero faster using a ThreadPoolExecutor!
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
img | Image | Omero image. | required |
tiles | list of tuple[int, int, int, tuple[int, int, int, int]] | List of tiles to pull. | required |
res_lvl | int | Resolution level to pull, defaults to None. | None |
rps_bypass | bool | Passthrough to rps bypass option, defaults to True. | True |
conn | BlitzGateway | Omero blitz gateway if not using omero image object, defaults to None. | None |
Yields:
| Type | Description |
|---|---|
tuple[ndarray, tuple[int, int, int, tuple[int, int, int, int]]] | Tile and coords. |
Source code in lavlab/omero/tiles.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |