compute_registration_consensus
Applies the multiplexing translation to all ROI tables.
_apply_consensus_to_roi(roi, consensus_roi)
¶
Calculate the shifted and cropped ROI for the consensus region.
Given a ROI and the consensus ROI across acquisitions, computes the region that needs to be applied to the original ROI. The position is computed as: consensus_roi.pos - own_translation which equals: base_pos + max_translation - own_translation The size is taken directly from the consensus_roi (same for all acquisitions).
Source code in fractal_tasks_core/compute_registration_consensus.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
_apply_consensus_to_roi_table(roi_table, consensus_rois)
¶
Calculate the shifted and cropped ROI table for the consensus region.
Given a roi_table and the consensus_rois across acquisitions, computes the roi_table that needs to be applied to get the consensus region.
Source code in fractal_tasks_core/compute_registration_consensus.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
_find_roi_consensus(rois)
¶
Find the consensus ROI contained in all acquisitions.
The consensus ROI is calculated by finding the max translation in positive direction and the min translation in negative direction across acquisitions for each roi, and applying this shift to the original ROIs to find the consensus region.
| PARAMETER | DESCRIPTION |
|---|---|
rois |
List of ROIs across acquisitions with the same name that need to be registered to each other. They need to contain the pre-calculated shifts as "translation_z", "translation_y", "translation_x" in their metadata.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Roi
|
Consensus ROI whose position is |
Roi
|
size is reduced by |
Roi
|
The position encodes the max-shift offset so that _shift_roi can derive |
Roi
|
each acquisition's aligned position as |
Source code in fractal_tasks_core/compute_registration_consensus.py
79 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 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
_get_roi_translation(roi, dim)
¶
Return the translation for dim from a ROI's extra fields.
Defaults to 0.0 when the field is absent (e.g. reference acquisition whose table has no pre-computed shifts).
Source code in fractal_tasks_core/compute_registration_consensus.py
58 59 60 61 62 63 64 | |
_validate_if_translation_exists(tables)
¶
Check that at least one table contains pre-calculated translation fields.
The reference acquisition's table intentionally has no translations (Task 1 only runs on non-reference acquisitions), so we require at least one table — not all tables — to carry the fields. If none do, Task 1 has not been run yet.
Source code in fractal_tasks_core/compute_registration_consensus.py
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 | |
compute_registration_consensus(*, zarr_url, init_args, input_roi_table='FOV_ROI_table', registered_roi_table='{input_roi_table}_registered')
¶
Applies pre-calculated registration to ROI tables.
Adjusts the ROI tables for each acquisition so that the resulting ROIs cover only the region visible in all acquisitions after registration.
| PARAMETER | DESCRIPTION |
|---|---|
zarr_url |
Path or url to the individual OME-Zarr image to be processed. Refers to the zarr_url of the reference acquisition. (standard argument for Fractal tasks, managed by Fractal server).
TYPE:
|
init_args |
Initialization arguments provided by
|
input_roi_table |
Name of the ROI table used as input for the "Calculate Registration (image-based)" task, which contains the pre-calculated translations.
TYPE:
|
registered_roi_table |
Name template for the registered ROI table. May contain the placeholder "{input_roi_table}", which is replaced by the value of "input_roi_table".
TYPE:
|
Source code in fractal_tasks_core/compute_registration_consensus.py
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 219 220 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 | |