1313Task for 3D->2D maximum-intensity projection.
1414"""
1515from __future__ import annotations
16- from typing import Any , TYPE_CHECKING
16+
17+ from typing import Any
18+ from typing import TYPE_CHECKING
1719
1820import dask .array as da
1921from ngio import NgffImage
20-
22+ from ngio . utils import ngio_logger
2123from pydantic import validate_call
2224
2325from fractal_tasks_core .tasks .io_models import InitArgsMIP
2426from fractal_tasks_core .tasks .projection_utils import DaskProjectionMethod
25- from ngio .utils import ngio_logger
2627
2728if TYPE_CHECKING :
2829 from ngio .core import Image
2930
3031
3132def _compute_new_shape (source_image : Image ) -> tuple [int ]:
32- """ Compute the new shape of the image after the projection.
33-
34- The new shape is the same as the original one, except for the z-axis, which is set to 1.
33+ """Compute the new shape of the image after the projection.
34+
35+ The new shape is the same as the original one,
36+ except for the z-axis, which is set to 1.
3537 """
3638 on_disk_shape = source_image .on_disk_shape
3739 ngio_logger .info (f"Source { on_disk_shape = } " )
3840
3941 on_disk_z_index = source_image .dataset .on_disk_axes_names .index ("z" )
40-
42+
4143 dest_on_disk_shape = list (on_disk_shape )
4244 dest_on_disk_shape [on_disk_z_index ] = 1
4345 ngio_logger .info (f"Destination { dest_on_disk_shape = } " )
@@ -96,8 +98,6 @@ def projection(
9698
9799 # Process the image
98100 z_axis_index = orginal_image .find_axis ("z" )
99- assert z_axis_index is not None # This should never happen since we checked for 3D images above
100-
101101 source_dask = orginal_image .get_array (
102102 mode = "dask" , preserve_dimensions = True
103103 )
@@ -114,7 +114,7 @@ def projection(
114114 mip_table = new_ngff_image .tables .new (
115115 roi_table , table_type = "roi_table" , overwrite = True
116116 )
117-
117+
118118 roi_list = []
119119 for roi in table .rois :
120120 roi .z_length = roi .z + 1
@@ -143,4 +143,4 @@ def projection(
143143 run_fractal_task (
144144 task_function = projection ,
145145 logger_name = ngio_logger .name ,
146- )
146+ )
0 commit comments