projection_utils
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 intensityp projection
|
MEANIP |
Mean intensity projection
|
SUMIP |
Sum intensityp projection
|
Source code in fractal_tasks_core/tasks/projection_utils.py
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 125 126 127 128 129 130 131 132 133 134 135 136 |
|
apply(dask_array, axis=0, **kwargs)
¶
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:
|
**kwargs |
Additional keyword arguments to pass to the projection method. |
RETURNS | DESCRIPTION |
---|---|
Array
|
dask.array.Array: The resulting Dask array after applying the projection. |
Example
array = da.random.random((1000, 1000), chunks=(100, 100)) method = DaskProjectionMethod.MAX result = method.apply(array, axis=0) computed_result = result.compute() print(computed_result)
Source code in fractal_tasks_core/tasks/projection_utils.py
101 102 103 104 105 106 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 |
|
mean_wrapper(dask_array, axis=0, **kwargs)
¶
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:
|
**kwargs |
Additional keyword arguments passed to da.mean. |
RETURNS | DESCRIPTION |
---|---|
Array
|
dask.array.Array: The result of the mean, cast back to the original dtype. |
Source code in fractal_tasks_core/tasks/projection_utils.py
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 78 79 80 |
|
safe_sum(dask_array, axis=0, **kwargs)
¶
Perform a safe sum on a Dask array to avoid overflow, by clipping the result of da.sum & casting 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:
|
**kwargs |
Additional keyword arguments passed to da.sum. |
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/tasks/projection_utils.py
9 10 11 12 13 14 15 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 |
|