Skip to content

Commit

Permalink
Rename new illumination_correction argument to `illumination_profil…
Browse files Browse the repository at this point in the history
…es_folder` (ref #414)
  • Loading branch information
tcompa committed Jun 15, 2023
1 parent 9a1da58 commit cddea5a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
9 changes: 6 additions & 3 deletions fractal_tasks_core/tasks/illumination_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def illumination_correction(
component: str,
metadata: Dict[str, Any],
# Task-specific arguments
root_path_corr: str,
illumination_profiles_folder: str,
dict_corr: dict[str, str],
background: int = 110,
new_component: Optional[str] = None,
Expand Down Expand Up @@ -143,7 +143,8 @@ def illumination_correction(
downsampling when building the pyramid.
(standard argument for Fractal tasks,
managed by Fractal server)
:param root_path_corr: FIXME -- see issue 414 on fractal-tasks-core
:param illumination_profiles_folder: FIXME -- see issue 414 on
fractal-tasks-core
:param dict_corr: FIXME -- see issue 414 on fractal-tasks-core
:param background: Background value that is subtracted from the image
before the illumination correction is applied. Set it
Expand Down Expand Up @@ -241,7 +242,9 @@ def illumination_correction(
for channel in channels:
wavelength_id = channel.wavelength_id
corrections[wavelength_id] = imread(
(Path(root_path_corr) / dict_corr[wavelength_id]).as_posix()
(
Path(illumination_profiles_folder) / dict_corr[wavelength_id]
).as_posix()
)
if corrections[wavelength_id].shape != (img_size_y, img_size_x):
raise Exception(
Expand Down
3 changes: 2 additions & 1 deletion tests/tasks/test_unit_illumination_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def test_illumination_correction(
"A01_C01": "illum_corr_matrix.png",
"A01_C02": "illum_corr_matrix.png",
}
illumination_profiles_folder = f"{testdata_str}/illumination_correction/"
with open(zarrurl + ".zattrs") as fin:
zattrs = json.load(fin)
num_levels = len(zattrs["multiscales"][0]["datasets"])
Expand Down Expand Up @@ -95,7 +96,7 @@ def patched_correct(*args, **kwargs):
metadata=metadata,
component=component,
overwrite=overwrite,
root_path_corr=f"{testdata_str}/illumination_correction/",
illumination_profiles_folder=illumination_profiles_folder,
dict_corr=illum_params,
background=0,
)
Expand Down
7 changes: 3 additions & 4 deletions tests/tasks/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,8 @@ def test_illumination_correction(
metadata = {}

testdata_str = testdata_path.as_posix()
illum_params = {
"A01_C01": "illum_corr_matrix.png",
}
illum_params = {"A01_C01": "illum_corr_matrix.png"}
illumination_profiles_folder = f"{testdata_str}/illumination_correction/"

# Create zarr structure
metadata_update = create_ome_zarr(
Expand Down Expand Up @@ -351,7 +350,7 @@ def test_illumination_correction(
metadata=metadata,
component=component,
overwrite=True,
root_path_corr=f"{testdata_str}/illumination_correction/",
illumination_profiles_folder=illumination_profiles_folder,
dict_corr=illum_params,
)
print(caplog.text)
Expand Down

0 comments on commit cddea5a

Please sign in to comment.