projection utils
Utility functions and models for intensity projection tasks.
| CLASS | DESCRIPTION |
|---|---|
DaskProjectionMethod |
Registration method selection. |
InitArgsMIP |
Init Args for MIP task. |
| FUNCTION | DESCRIPTION |
|---|---|
max_wrapper |
Perform a da.max on the dask_array. |
mean_wrapper |
Perform a da.mean on the dask_array & cast it to its original dtype. |
min_wrapper |
Perform a da.min on the dask_array. |
projection_core |
Perform intensity projection along Z axis with a chosen method. |
safe_sum |
Perform a safe sum on a Dask array to avoid overflow. |
Classes¶
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
|
| METHOD | DESCRIPTION |
|---|---|
apply |
Apply the selected projection method to the given Dask array. |
Source code in fractal_tasks_core/_projection_utils.py
Attributes¶
abbreviation
property
¶
Get the abbreviation of the projection method.
| RETURNS | DESCRIPTION |
|---|---|
str
|
The abbreviation of the projection method.
TYPE:
|
Methods:¶
apply(dask_array, axis=0)
¶
Apply the selected projection method to the given Dask array.
| PARAMETER | DESCRIPTION |
|---|---|
|
The Dask array to project.
TYPE:
|
|
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
InitArgsMIP
pydantic-model
¶
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:
|
Fields:
-
origin_url(str) -
method(DaskProjectionMethod) -
overwrite(bool) -
new_plate_name(str)
Source code in fractal_tasks_core/_projection_utils.py
Functions:¶
_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
max_wrapper(dask_array, axis=0)
¶
Perform a da.max on the dask_array.
| PARAMETER | DESCRIPTION |
|---|---|
|
The input Dask array.
TYPE:
|
|
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
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 |
|---|---|
|
The input Dask array.
TYPE:
|
|
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
min_wrapper(dask_array, axis=0)
¶
Perform a da.min on the dask_array.
| PARAMETER | DESCRIPTION |
|---|---|
|
The input Dask array.
TYPE:
|
|
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
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 |
|---|---|
|
Path or url to the individual OME-Zarr image to be processed.
TYPE:
|
|
Path or url to the output OME-Zarr image.
TYPE:
|
|
Projection method to be used. See
TYPE:
|
|
If
TYPE:
|
|
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 |
|---|---|
|
The input Dask array.
TYPE:
|
|
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. |