Skip to content

Commit

Permalink
pre-commit fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzocerrone committed Nov 15, 2024
1 parent 802bdb8 commit 3da52c8
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions fractal_tasks_core/tasks/projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,33 @@
Task for 3D->2D maximum-intensity projection.
"""
from __future__ import annotations
from typing import Any, TYPE_CHECKING

from typing import Any
from typing import TYPE_CHECKING

import dask.array as da
from ngio import NgffImage

from ngio.utils import ngio_logger
from pydantic import validate_call

from fractal_tasks_core.tasks.io_models import InitArgsMIP
from fractal_tasks_core.tasks.projection_utils import DaskProjectionMethod
from ngio.utils import ngio_logger

if TYPE_CHECKING:
from ngio.core import Image

Check notice on line 29 in fractal_tasks_core/tasks/projection.py

View workflow job for this annotation

GitHub Actions / Coverage

Missing coverage

Missing coverage on line 29


def _compute_new_shape(source_image: Image) -> tuple[int]:
""" 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.
"""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.
"""
on_disk_shape = source_image.on_disk_shape
ngio_logger.info(f"Source {on_disk_shape=}")

on_disk_z_index = source_image.dataset.on_disk_axes_names.index("z")

dest_on_disk_shape = list(on_disk_shape)
dest_on_disk_shape[on_disk_z_index] = 1
ngio_logger.info(f"Destination {dest_on_disk_shape=}")
Expand Down Expand Up @@ -96,8 +98,6 @@ def projection(

# Process the image
z_axis_index = orginal_image.find_axis("z")
assert z_axis_index is not None # This should never happen since we checked for 3D images above

source_dask = orginal_image.get_array(
mode="dask", preserve_dimensions=True
)
Expand All @@ -114,7 +114,7 @@ def projection(
mip_table = new_ngff_image.tables.new(
roi_table, table_type="roi_table", overwrite=True
)

roi_list = []
for roi in table.rois:
roi.z_length = roi.z + 1
Expand Down Expand Up @@ -143,4 +143,4 @@ def projection(
run_fractal_task(
task_function=projection,
logger_name=ngio_logger.name,
)
)

0 comments on commit 3da52c8

Please sign in to comment.