_registration_utils
Utils functions for registration
add_zero_translation_columns(ad_table)
¶
Add three zero-filled columns (translation_{x,y,z}
) to an AnnData table.
Source code in fractal_tasks_core/tasks/_registration_utils.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
apply_registration_to_single_ROI_table(roi_table, max_df, min_df)
¶
Applies the registration to a ROI table
Calculates the new position as: p = position + max(shift, 0) - own_shift Calculates the new len as: l = len - max(shift, 0) + min(shift, 0)
PARAMETER | DESCRIPTION |
---|---|
roi_table |
AnnData table which contains a Fractal ROI table. Rows are ROIs
TYPE:
|
max_df |
Max translation shift in z, y, x for each ROI. Rows are ROIs, columns are translation_z, translation_y, translation_x
TYPE:
|
min_df |
Min translation shift in z, y, x for each ROI. Rows are ROIs, columns are translation_z, translation_y, translation_x
TYPE:
|
Returns: ROI table where all ROIs are registered to the smallest common area across all acquisitions.
Source code in fractal_tasks_core/tasks/_registration_utils.py
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 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 |
|
calculate_physical_shifts(shifts, level, coarsening_xy, full_res_pxl_sizes_zyx)
¶
Calculates shifts in physical units based on pixel shifts
PARAMETER | DESCRIPTION |
---|---|
shifts |
array of shifts, zyx or yx
TYPE:
|
level |
resolution level
TYPE:
|
coarsening_xy |
coarsening factor between levels
TYPE:
|
full_res_pxl_sizes_zyx |
pixel sizes in physical units as zyx |
RETURNS | DESCRIPTION |
---|---|
list[float]
|
shifts in physical units as zyx |
Source code in fractal_tasks_core/tasks/_registration_utils.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 |
|
chi2_shift_out(img_ref, img_cycle_x)
¶
Helper function to get the output of chi2_shift into the same format as phase_cross_correlation. Calculates the shift between two images using the chi2_shift method.
PARAMETER | DESCRIPTION |
---|---|
img_ref |
First image.
TYPE:
|
img_cycle_x |
Second image.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[ndarray]
|
List containing numpy array of shift in y and x direction. |
Source code in fractal_tasks_core/tasks/_registration_utils.py
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 |
|
get_ROI_table_with_translation(ROI_table, new_shifts)
¶
Adds translation columns to a ROI table
PARAMETER | DESCRIPTION |
---|---|
ROI_table |
Fractal ROI table
TYPE:
|
new_shifts |
zyx list of shifts |
RETURNS | DESCRIPTION |
---|---|
AnnData
|
Fractal ROI table with 3 additional columns for calculated translations |
Source code in fractal_tasks_core/tasks/_registration_utils.py
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 |
|
is_3D(dask_array)
¶
Check if a dask array is 3D.
Treats singelton Z dimensions as 2D images. (1, 2000, 2000) => False (10, 2000, 2000) => True
PARAMETER | DESCRIPTION |
---|---|
dask_array |
Input array to be checked
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
bool
|
bool on whether the array is 3D |
Source code in fractal_tasks_core/tasks/_registration_utils.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
|