utils
Helper functions for operations on Zarr attributes and OME-NGFF metadata.
_find_omengff_acquisition(image_zarr_path)
¶
Discover the acquisition index based on OME-NGFF metadata.
Given the path to a zarr image folder (e.g. /path/plate.zarr/B/03/0
),
extract the acquisition index from the .zattrs
file of the parent
folder (i.e. at the well level), or return None
if acquisition is not
specified.
Notes:
- For non-multiplexing datasets, acquisition is not a required
information in the metadata. If it is not there, this function
returns
None
. - This function fails if we use an image that does not belong to an OME-NGFF well.
PARAMETER | DESCRIPTION |
---|---|
image_zarr_path |
Full path to an OME-NGFF image folder.
TYPE:
|
Source code in fractal_tasks_core/utils.py
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 141 142 143 144 145 146 147 148 149 |
|
_get_table_path_dict(zarr_url)
¶
Compile dictionary of (table name, table path) key/value pairs.
PARAMETER | DESCRIPTION |
---|---|
zarr_url |
Path or url to the individual OME-Zarr image to be processed.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
dict[str, str]
|
Dictionary with table names as keys and table paths as values. If
|
Source code in fractal_tasks_core/utils.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
|
_split_well_path_image_path(zarr_url)
¶
Returns path to well folder for HCS OME-Zarr zarr_url
.
Source code in fractal_tasks_core/utils.py
241 242 243 244 245 246 247 248 |
|
create_well_acquisition_dict(zarr_urls)
¶
Parses zarr_urls & groups them by HCS wells & acquisition
Generates a dict with keys a unique description of the acquisition
(e.g. plate + well for HCS plates). The values are dictionaries. The keys
of the secondary dictionary are the acqusitions, its values the zarr_url
for a given acquisition.
PARAMETER | DESCRIPTION |
---|---|
zarr_urls |
List of zarr_urls |
RETURNS | DESCRIPTION |
---|---|
dict[str, dict[int, str]]
|
image_groups |
Source code in fractal_tasks_core/utils.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
|
get_parameters_from_metadata(*, keys, metadata, image_zarr_path)
¶
Flexibly extract parameters from metadata dictionary
This covers both parameters which are acquisition-specific (if the image belongs to an OME-NGFF array and its acquisition is specified) or simply available in the dictionary. The two cases are handled as:
metadata[acquisition]["some_parameter"] # acquisition available
metadata["some_parameter"] # acquisition not available
PARAMETER | DESCRIPTION |
---|---|
keys |
list of required parameters. |
metadata |
metadata dictionary. |
image_zarr_path |
full path to image, e.g.
TYPE:
|
Source code in fractal_tasks_core/utils.py
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 |
|
rescale_datasets(*, datasets, coarsening_xy, reference_level, remove_channel_axis=False)
¶
Given a set of datasets (as per OME-NGFF specs), update their "scale" transformations in the YX directions by including a prefactor (coarsening_xy**reference_level).
PARAMETER | DESCRIPTION |
---|---|
datasets |
list of datasets (as per OME-NGFF specs). |
coarsening_xy |
linear coarsening factor between subsequent levels.
TYPE:
|
reference_level |
TBD
TYPE:
|
remove_channel_axis |
If
TYPE:
|
Source code in fractal_tasks_core/utils.py
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 |
|