Skip to content

Rename variable in projection task #944

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# 1.5.0

* Tasks:
* Refactor `projection` task to use the new `ngio` API (\#937, \#943).
* Refactor `projection` task to use the new `ngio` API (\#937, \#943, \#944).
* Refactor `copy_ome_zarr_plate` init task to support the upcoming flexibility.
* Rely on `fractal-task-tools` for `run_fractal_task` wrapper (\#923).
* Mark some existing tasks as _converter_ tasks(\#923).
Expand Down
4 changes: 2 additions & 2 deletions fractal_tasks_core/__FRACTAL_MANIFEST__.json
Original file line number Diff line number Diff line change
Expand Up @@ -676,9 +676,9 @@
"title": "Method",
"description": "Choose which method to use for intensity projection along the Z axis. mip is the default and performs a maximum intensity projection. minip performs a minimum intensity projection, meanip a mean intensity projection and sumip a sum intensity projection."
},
"overwrite_images": {
"overwrite": {
"default": false,
"title": "Overwrite Images",
"title": "Overwrite",
"type": "boolean",
"description": "If `True`, overwrite the MIP images if they are already present in the new OME-Zarr Plate."
},
Expand Down
8 changes: 4 additions & 4 deletions fractal_tasks_core/tasks/copy_ome_zarr_hcs_plate.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def copy_ome_zarr_hcs_plate(
zarr_dir: str,
method: DaskProjectionMethod = DaskProjectionMethod.MIP,
# Advanced parameters
overwrite_images: bool = False,
overwrite: bool = False,
re_initialize_plate: bool = False,
) -> dict[str, Any]:
"""
Expand Down Expand Up @@ -122,7 +122,7 @@ def copy_ome_zarr_hcs_plate(
Z axis. mip is the default and performs a maximum intensity
projection. minip performs a minimum intensity projection, meanip
a mean intensity projection and sumip a sum intensity projection.
overwrite_images: If `True`, overwrite the MIP images if they are
overwrite: If `True`, overwrite the MIP images if they are
already present in the new OME-Zarr Plate.
re_initialize_plate: If `True`, re-initialize the plate, deleting all
existing wells and images. If `False`, the task will only
Expand Down Expand Up @@ -184,10 +184,10 @@ def copy_ome_zarr_hcs_plate(
proj_image_path = f"{row}/{column}/{image_path}"

if proj_image_path in proj_plate_images_paths:
if not overwrite_images:
if not overwrite:
raise NgioFileExistsError(
f"Image {proj_image_path} already exists in "
f"{proj_plate_url}. Set `overwrite_images=True` "
f"{proj_plate_url}. Set `overwrite=True` "
"to overwrite it."
)
logger.info(
Expand Down
4 changes: 2 additions & 2 deletions tests/tasks/test_import_ome_zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def test_import_ome_zarr_plate(tmp_path, zenodo_zarr):
parallelization_list = copy_ome_zarr_hcs_plate(
zarr_urls=zarr_urls,
zarr_dir="tmp_out",
overwrite_images=True,
overwrite=True,
re_initialize_plate=True,
)["parallelization_list"]
debug(parallelization_list)
Expand Down Expand Up @@ -248,7 +248,7 @@ def test_import_ome_zarr_plate_no_ROI_tables(tmp_path, zenodo_zarr):
parallelization_list = copy_ome_zarr_hcs_plate(
zarr_urls=zarr_urls,
zarr_dir="tmp_out",
overwrite_images=True,
overwrite=True,
re_initialize_plate=True,
)["parallelization_list"]
debug(parallelization_list)
Expand Down
2 changes: 1 addition & 1 deletion tests/tasks/test_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def test_multiplexing_registration(
parallelization_list = copy_ome_zarr_hcs_plate(
zarr_urls=zarr_urls_3D,
zarr_dir=zarr_dir,
overwrite_images=True,
overwrite=True,
re_initialize_plate=True,
)["parallelization_list"]
debug(parallelization_list)
Expand Down
6 changes: 3 additions & 3 deletions tests/tasks/test_unit_copy_hcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_MIP(
parallelization_list = copy_ome_zarr_hcs_plate(
zarr_urls=zarr_urls,
zarr_dir="tmp_out",
overwrite_images=True,
overwrite=True,
re_initialize_plate=True,
)["parallelization_list"]
debug(parallelization_list)
Expand All @@ -65,7 +65,7 @@ def test_MIP(
parallelization_list_2 = copy_ome_zarr_hcs_plate(
zarr_urls=zarr_urls,
zarr_dir="tmp_out",
overwrite_images=True,
overwrite=True,
re_initialize_plate=True,
)["parallelization_list"]
assert parallelization_list_2 == parallelization_list
Expand All @@ -75,7 +75,7 @@ def test_MIP(
_ = copy_ome_zarr_hcs_plate(
zarr_urls=zarr_urls,
zarr_dir="tmp_out",
overwrite_images=False,
overwrite=False,
re_initialize_plate=False,
)

Expand Down
8 changes: 4 additions & 4 deletions tests/tasks/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def test_MIP(
parallelization_list = copy_ome_zarr_hcs_plate(
zarr_urls=zarr_urls,
zarr_dir=str(zarr_path),
overwrite_images=True,
overwrite=True,
re_initialize_plate=True,
)["parallelization_list"]
debug(parallelization_list)
Expand All @@ -330,7 +330,7 @@ def test_MIP(
parallelization_list_2 = copy_ome_zarr_hcs_plate(
zarr_urls=zarr_urls,
zarr_dir=str(zarr_path),
overwrite_images=True,
overwrite=True,
re_initialize_plate=True,
)["parallelization_list"]
assert parallelization_list_2 == parallelization_list
Expand Down Expand Up @@ -416,7 +416,7 @@ def test_projection_methods(
zarr_urls=zarr_urls,
zarr_dir=str(zarr_path),
method=method,
overwrite_images=True,
overwrite=True,
re_initialize_plate=True,
)["parallelization_list"]

Expand Down Expand Up @@ -499,7 +499,7 @@ def test_MIP_subset_of_images(
parallelization_list = copy_ome_zarr_hcs_plate(
zarr_urls=zarr_urls,
zarr_dir=str(zarr_dir),
overwrite_images=True,
overwrite=True,
re_initialize_plate=True,
)["parallelization_list"]
debug(parallelization_list)
Expand Down
2 changes: 1 addition & 1 deletion tests/tasks/test_workflows_multiplexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def test_multiplexing_MIP(
parallelization_list = copy_ome_zarr_hcs_plate(
zarr_urls=zarr_urls,
zarr_dir=str(zarr_dir),
overwrite_images=True,
overwrite=True,
re_initialize_plate=True,
)["parallelization_list"]
debug(parallelization_list)
Expand Down
2 changes: 1 addition & 1 deletion tests/tasks_v2/test_projection_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_mip_task(cardiomyocyte_tiny_path: Path, tmp_path: Path) -> None:
parallel_list = copy_ome_zarr_hcs_plate(
zarr_urls=[image_url],
zarr_dir=str(tmp_path / "tmp_out"),
overwrite_images=True,
overwrite=True,
re_initialize_plate=True,
)

Expand Down
20 changes: 10 additions & 10 deletions tests/tasks_v2/test_unit_copy_ome_hcs_plate.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ def test_flexibility_copy_hcs(tmp_path: Path):
parallel_list_1 = copy_ome_zarr_hcs_plate(
zarr_urls=[zarr_urls[0]],
zarr_dir=subset_dir,
overwrite_images=True,
overwrite=True,
re_initialize_plate=True,
)
# Subset 2
_ = copy_ome_zarr_hcs_plate(
zarr_urls=[zarr_urls[1]],
zarr_dir=subset_dir,
overwrite_images=False,
overwrite=False,
re_initialize_plate=False,
)

Expand All @@ -82,7 +82,7 @@ def test_flexibility_copy_hcs(tmp_path: Path):
parallel_list_all = copy_ome_zarr_hcs_plate(
zarr_urls=zarr_urls,
zarr_dir=all_dir,
overwrite_images=True,
overwrite=True,
re_initialize_plate=True,
)
zarr_url = parallel_list_all["parallelization_list"][0]["zarr_url"]
Expand All @@ -100,7 +100,7 @@ def test_fail_overwrite(tmp_path: Path):
copy_ome_zarr_hcs_plate(
zarr_urls=zarr_urls,
zarr_dir=str(tmp_path),
overwrite_images=False,
overwrite=False,
re_initialize_plate=False,
)

Expand All @@ -109,15 +109,15 @@ def test_fail_overwrite(tmp_path: Path):
copy_ome_zarr_hcs_plate(
zarr_urls=zarr_urls,
zarr_dir=str(tmp_path),
overwrite_images=False,
overwrite=False,
re_initialize_plate=True,
)

with pytest.raises(FileExistsError):
copy_ome_zarr_hcs_plate(
zarr_urls=zarr_urls,
zarr_dir=str(tmp_path),
overwrite_images=False,
overwrite=False,
re_initialize_plate=False,
)

Expand All @@ -130,7 +130,7 @@ def test_new_plate_name(tmp_path: Path):
zarr_urls=[zarr_urls[0]],
zarr_dir=str(tmp_path),
method=method,
overwrite_images=False,
overwrite=False,
re_initialize_plate=False,
)

Expand All @@ -148,7 +148,7 @@ def test_fail_not_plate_url():
copy_ome_zarr_hcs_plate(
zarr_urls=["/tmp/plate.zarr"],
zarr_dir="/tmp",
overwrite_images=False,
overwrite=False,
re_initialize_plate=False,
)

Expand All @@ -161,7 +161,7 @@ def test_reinit_true(tmp_path: Path):
parallel_list_1 = copy_ome_zarr_hcs_plate(
zarr_urls=[zarr_urls[0]],
zarr_dir=str(tmp_path),
overwrite_images=True,
overwrite=True,
re_initialize_plate=True,
)

Expand All @@ -173,7 +173,7 @@ def test_reinit_true(tmp_path: Path):
parallel_list_2 = copy_ome_zarr_hcs_plate(
zarr_urls=[zarr_urls[1]],
zarr_dir=str(tmp_path),
overwrite_images=False,
overwrite=False,
re_initialize_plate=True,
)

Expand Down