_projection_utils
Utility functions and models for intensity projection tasks.
DaskProjectionMethod
¶
Bases: Enum
Registration method selection.
Choose which method to use for intensity projection along the Z axis.
| ATTRIBUTE | DESCRIPTION |
|---|---|
MIP |
Maximum intensity projection
|
MINIP |
Minimum intensity projection
|
MEANIP |
Mean intensity projection
|
SUMIP |
Sum intensity projection
|
Source code in fractal_tasks_core/_projection_utils.py
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 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
abbreviation: str
property
¶
Get the abbreviation of the projection method.
| RETURNS | DESCRIPTION |
|---|---|
str
|
The abbreviation of the projection method.
TYPE:
|
apply(dask_array, axis=0)
¶
Apply the selected projection method to the given Dask array.
| PARAMETER | DESCRIPTION |
|---|---|
dask_array |
The Dask array to project.
TYPE:
|
axis |
The axis along which to apply the projection.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Array
|
dask.array.Array: The resulting Dask array after applying the projection. |
Source code in fractal_tasks_core/_projection_utils.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
InitArgsMIP
¶
Bases: BaseModel
Init Args for MIP task.
| ATTRIBUTE | DESCRIPTION |
|---|---|
origin_url |
Path to the zarr_url with the 3D data
TYPE:
|
method |
Projection method to be used. See
TYPE:
|
overwrite |
If
TYPE:
|
new_plate_name |
Name of the new OME-Zarr HCS plate
TYPE:
|
Source code in fractal_tasks_core/_projection_utils.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 | |
_compute_new_shape(source_image)
¶
Compute the new shape of the image after the projection.
The new shape is the same as the original one, except for the z-axis, which is set to 1.
| RETURNS | DESCRIPTION |
|---|---|
tuple[int, ...]
|
|
int
|
|
Source code in fractal_tasks_core/_projection_utils.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | |
max_wrapper(dask_array, axis=0)
¶
Perform a da.max on the dask_array.
| PARAMETER | DESCRIPTION |
|---|---|
dask_array |
The input Dask array.
TYPE:
|
axis |
The axis along which to max the array. Defaults to 0.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Array
|
dask.array.Array: The result of the max |
Source code in fractal_tasks_core/_projection_utils.py
79 80 81 82 83 84 85 86 87 88 89 90 | |
mean_wrapper(dask_array, axis=0)
¶
Perform a da.mean on the dask_array & cast it to its original dtype.
Without casting, the result can change dtype to e.g. float64
| PARAMETER | DESCRIPTION |
|---|---|
dask_array |
The input Dask array.
TYPE:
|
axis |
The axis along which to mean the array. Defaults to 0.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Array
|
dask.array.Array: The result of the mean, cast back to the original dtype. |
Source code in fractal_tasks_core/_projection_utils.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
min_wrapper(dask_array, axis=0)
¶
Perform a da.min on the dask_array.
| PARAMETER | DESCRIPTION |
|---|---|
dask_array |
The input Dask array.
TYPE:
|
axis |
The axis along which to min the array. Defaults to 0.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Array
|
dask.array.Array: The result of the min |
Source code in fractal_tasks_core/_projection_utils.py
93 94 95 96 97 98 99 100 101 102 103 104 | |
projection_core(*, input_zarr_url, output_zarr_url, method=DaskProjectionMethod.MIP, overwrite=False, attributes=None)
¶
Perform intensity projection along Z axis with a chosen method.
Note: this task stores the output in a new zarr file.
| PARAMETER | DESCRIPTION |
|---|---|
input_zarr_url |
Path or url to the individual OME-Zarr image to be processed.
TYPE:
|
output_zarr_url |
Path or url to the output OME-Zarr image.
TYPE:
|
method |
Projection method to be used. See
TYPE:
|
overwrite |
If
TYPE:
|
attributes |
Additional attributes to be added to the output image. |
Source code in fractal_tasks_core/_projection_utils.py
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 265 266 267 268 269 270 271 | |
safe_sum(dask_array, axis=0)
¶
Perform a safe sum on a Dask array to avoid overflow.
Clips the result of da.sum & casts it to its original dtype. Dask.array already correctly handles promotion to uin32 or uint64 when necessary internally, but we want to ensure we clip the result.
| PARAMETER | DESCRIPTION |
|---|---|
dask_array |
The input Dask array.
TYPE:
|
axis |
The axis along which to sum the array. Defaults to 0.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Array
|
dask.array.Array: The result of the sum, safely clipped and cast back to the original dtype. |
Source code in fractal_tasks_core/_projection_utils.py
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 | |