From b45897242f81a10e2346b27c1802696ab601d4a2 Mon Sep 17 00:00:00 2001 From: Alex Barbera Date: Tue, 7 Oct 2025 15:29:03 -0400 Subject: [PATCH 1/3] Added individual options for output files --- main.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 9f4009a..0c2c6ca 100755 --- a/main.py +++ b/main.py @@ -159,12 +159,32 @@ def get_args(): default=1e4, help="Relative weight of the l0 norm cost in the Fourier domain for autotuning.", ) + optional.add_argument( + "--output-flatfield", + dest="output_flatfield", + required=False, + default=None, + help="Filename for flatfield output. If empty will default to {input filename}. A sufix will be added to differenciate between flatfield and darkfield." + ) + optional.add_argument( + "--output-darkfield", + dest="output_darkfield", + required=False, + default=None, + help="Filename for darkfield output. If empty will default to {input filename}. A sufix will be added to differenciate between flatfield and darkfield." + ) arg = parser.parse_args() # Convert input and output to Pathlib arg.input = Path(arg.input) arg.output_folder = Path(arg.output_folder) + + if arg.output_flatfield is None: + arg.output_flatfield = splitext(args.input.name)[0] + + if arg.output_darkfield is None: + arg.output_darkfield = splitext(args.input.name)[0] return arg @@ -254,8 +274,8 @@ def main(args): darkfields = np.moveaxis(np.array(darkfields), 0, -1) # Get output file names, splitext gets the file name without the extension - flatfield_path = args.output_folder / f"{splitext(args.input.name)[0]}-ffp.tiff" - darkfield_path = args.output_folder / f"{splitext(args.input.name)[0]}-dfp.tiff" + flatfield_path = args.output_folder / f"{args.output_flatfield}-ffp.tiff" + darkfield_path = args.output_folder / f"{args.output_darkfield}-dfp.tiff" # Save flatfields and darkfields imsave(flatfield_path, flatfields, check_contrast=False) @@ -265,6 +285,8 @@ def main(args): if __name__ == "__main__": # Import arguments args = get_args() + + print(args) # Run main and check time main(args) From 2274642659d4b921f8204eba3c25ef2e635fd415 Mon Sep 17 00:00:00 2001 From: Alex Barbera Date: Mon, 3 Nov 2025 14:11:21 -0500 Subject: [PATCH 2/3] fallback to original structure --- main.py | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/main.py b/main.py index 0c2c6ca..ee95624 100755 --- a/main.py +++ b/main.py @@ -160,18 +160,18 @@ def get_args(): help="Relative weight of the l0 norm cost in the Fourier domain for autotuning.", ) optional.add_argument( - "--output-flatfield", - dest="output_flatfield", - required=False, - default=None, - help="Filename for flatfield output. If empty will default to {input filename}. A sufix will be added to differenciate between flatfield and darkfield." + "--output-flatfield", + dest="output_flatfield", + required=False, + default=None, + help="Filename for flatfield output. If empty will default to {input filename}. A sufix will be added to differenciate between flatfield and darkfield.", ) optional.add_argument( - "--output-darkfield", - dest="output_darkfield", - required=False, - default=None, - help="Filename for darkfield output. If empty will default to {input filename}. A sufix will be added to differenciate between flatfield and darkfield." + "--output-darkfield", + dest="output_darkfield", + required=False, + default=None, + help="Filename for darkfield output. If empty will default to {input filename}. A sufix will be added to differenciate between flatfield and darkfield.", ) arg = parser.parse_args() @@ -179,12 +179,12 @@ def get_args(): # Convert input and output to Pathlib arg.input = Path(arg.input) arg.output_folder = Path(arg.output_folder) - + if arg.output_flatfield is None: - arg.output_flatfield = splitext(args.input.name)[0] - + arg.output_flatfield = splitext(arg.input.name)[0] + if arg.output_darkfield is None: - arg.output_darkfield = splitext(args.input.name)[0] + arg.output_darkfield = splitext(arg.input.name)[0] return arg @@ -285,8 +285,6 @@ def main(args): if __name__ == "__main__": # Import arguments args = get_args() - - print(args) # Run main and check time main(args) From d9dc9f7793b42250d37c56083544f115873f5a7d Mon Sep 17 00:00:00 2001 From: Alex Barbera Date: Mon, 3 Nov 2025 16:15:15 -0500 Subject: [PATCH 3/3] Changed Dockerfile so it runs --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5195445..1b72abc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,12 +12,12 @@ ENV PATH=/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin: # Installing necessary packages # Installing basicpy and other pip packages -RUN pip --no-cache-dir install basicpy==1.2.0 bioformats_jar 'scikit-image>=0.21.0' +RUN pip --no-cache-dir install basicpy==1.2.0 bioformats_jar 'scikit-image>=0.21.0' 'hyperactive<5' # Pre-fetch bioformats jars to a world-readable location. # Force TLS 1.2 to work around a Java bug in the JDK version in this container. RUN env JAVA_TOOL_OPTIONS='-Dhttps.protocols=TLSv1.2' \ - python -c 'import bfio; bfio.start()' \ + python -c 'import bioformats_jar; bioformats_jar.get_loci()' \ && mv /root/.jgo /root/.m2 /tmp \ && chmod -R a+rwX /tmp/.jgo /tmp/.m2 ENV HOME=/tmp