From fed8217335e44b00780048e4c25025595ac2a7da Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Tue, 2 Apr 2019 22:07:33 +0200 Subject: [PATCH] Fix bug correct_and_project() when model is None --- src/imcflibs/imagej/shading.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/imcflibs/imagej/shading.py b/src/imcflibs/imagej/shading.py index 6eda795..bd66e18 100644 --- a/src/imcflibs/imagej/shading.py +++ b/src/imcflibs/imagej/shading.py @@ -89,8 +89,10 @@ def correct_and_project(filename, path, model, proj, fmt): imps = bioformats.import_image(filename, split_c=True) if model is not None: log.debug("Applying shading correction on [%s]...", filename) - imps = apply_model(imps, model) - bioformats.export_using_orig_name(imps, path, filename, "", fmt, True) + imp = apply_model(imps, model) + bioformats.export_using_orig_name(imp, path, filename, "", fmt, True) + # imps needs to be updated with the new (=merged) stack: + imps = [imp] if proj == 'None': projs = [] @@ -98,10 +100,10 @@ def correct_and_project(filename, path, model, proj, fmt): projs = ['Average', 'Maximum'] else: projs = [proj] - projections.create_and_save(imps, projs, path, filename, fmt) + for imp in imps: + projections.create_and_save(imp, projs, path, filename, fmt) + imp.close() - # imps.show() - imps.close() log.debug("Done processing [%s].", os.path.basename(filename)) -- GitLab