Skip to content
Open
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
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 22 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,33 @@ 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(arg.input.name)[0]

if arg.output_darkfield is None:
arg.output_darkfield = splitext(arg.input.name)[0]

return arg


Expand Down Expand Up @@ -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)
Expand Down
Loading