Skip to content
Snippets Groups Projects
Commit ab1d6ed7 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Allow model file to be '-' or 'None' to disable shading correction

parent 25b8746f
Branches
Tags
No related merge requests found
...@@ -116,15 +116,23 @@ def process_folder(path, suffix, outpath, model_file, fmt): ...@@ -116,15 +116,23 @@ def process_folder(path, suffix, outpath, model_file, fmt):
The output folder where results will be stored. Existing files will be The output folder where results will be stored. Existing files will be
overwritten. overwritten.
model_file : str model_file : str
The full path to a normalized 32-bit shading model image. The full path to a normalized 32-bit shading model image. If set to '-'
or 'NONE', no shading correction will be applied.
fmt : str fmt : str
The file format suffix for storing the results. The file format suffix for storing the results.
""" """
imp = ij.IJ.openImage(model_file) if model_file in ["-", "NONE"]:
model = None
else:
model = ij.IJ.openImage(model_file)
model.show() # required, otherwise the IJ.run() call ignores the model
matching_files = listdir_matching(path, suffix) matching_files = listdir_matching(path, suffix)
log.info("Running shading correction and projections on %s files...",
len(matching_files))
imp.show() # required, otherwise the IJ.run() call will ignore the imp
for orig_file in matching_files: for orig_file in matching_files:
in_file = os.path.join(path, orig_file) in_file = os.path.join(path, orig_file)
correct_and_project(in_file, outpath, imp, 'ALL', fmt) correct_and_project(in_file, outpath, model, 'ALL', fmt)
imp.close() if model:
model.close()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment