From de79ed3bdab3b5472c3b008a281b31522ce2a4a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jord=C3=A3o=20Bragantini?= Date: Wed, 11 Oct 2023 20:38:21 +0200 Subject: [PATCH] Added option to not check copied data (#192) --- iohub/cli/cli.py | 20 ++++++++++++++++++-- tests/cli/test_cli.py | 7 ++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/iohub/cli/cli.py b/iohub/cli/cli.py index 729c73ad..befdeb3d 100644 --- a/iohub/cli/cli.py +++ b/iohub/cli/cli.py @@ -90,7 +90,23 @@ def info(files, verbose): help="Zarr chunk size given as 'XY', 'XYZ', or a tuple of chunk " "dimensions. If 'XYZ', chunk size will be limited to 500 MB.", ) -def convert(input, output, format, scale_voxels, grid_layout, chunks): +@click.option( + "--check-image/--no-check-image", + "-chk/-no-chk", + required=False, + is_flag=True, + default=True, + help="Checks copied image data with original data.", +) +def convert( + input, + output, + format, + scale_voxels, + grid_layout, + chunks, + check_image, +): """Converts Micro-Manager TIFF datasets to OME-Zarr""" converter = TIFFConverter( input_dir=input, @@ -100,4 +116,4 @@ def convert(input, output, format, scale_voxels, grid_layout, chunks): grid_layout=grid_layout, chunks=chunks, ) - converter.run() + converter.run(check_image=check_image) diff --git a/tests/cli/test_cli.py b/tests/cli/test_cli.py index 9830b898..1d1fa150 100644 --- a/tests/cli/test_cli.py +++ b/tests/cli/test_cli.py @@ -90,20 +90,21 @@ def test_cli_info_ome_zarr(setup_test_data, setup_hcs_ref, verbose): assert "scale (um)" in result_pos.output -@given(f=st.booleans(), g=st.booleans(), s=st.booleans()) +@given(f=st.booleans(), g=st.booleans(), s=st.booleans(), chk=st.booleans()) @settings( suppress_health_check=[HealthCheck.function_scoped_fixture], deadline=20000 ) def test_cli_convert_ome_tiff( - setup_test_data, setup_mm2gamma_ome_tiffs, f, g, s + setup_test_data, setup_mm2gamma_ome_tiffs, f, g, s, chk, ): _, _, input_dir = setup_mm2gamma_ome_tiffs runner = CliRunner() f = "-f ometiff" if f else "" g = "-g" if g else "" + chk = "--check-image" if chk else "--no-check-image" with TemporaryDirectory() as tmp_dir: output_dir = os.path.join(tmp_dir, "converted.zarr") - cmd = ["convert", "-i", input_dir, "-o", output_dir, "-s", s] + cmd = ["convert", "-i", input_dir, "-o", output_dir, "-s", s, chk] if f: cmd += ["-f", "ometiff"] if g: