From a61a260f470337db6dec9e91910ebfe478fcc784 Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Fri, 5 Apr 2019 18:26:30 +0200
Subject: [PATCH] Make create_and_save() return a bool

---
 src/imcflibs/imagej/projections.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/imcflibs/imagej/projections.py b/src/imcflibs/imagej/projections.py
index ab0ecf9..6313875 100644
--- a/src/imcflibs/imagej/projections.py
+++ b/src/imcflibs/imagej/projections.py
@@ -66,10 +66,20 @@ def create_and_save(imp, projections, path, filename, export_format):
         The original file name to derive the results name from.
     export_format : str
         The suffix to be given to Bio-Formats, determining the storage format.
+
+    Returns
+    -------
+    bool
+        True in case projections were created, False otherwise (e.g. if the
+        given ImagePlus is not a Z-stack).
     """
+    if not projections:
+        log.debug("No projection type requested, skipping...")
+        return False
+
     if imp.getDimensions()[3] < 2:
         log.error("ImagePlus is not a z-stack, not creating any projections!")
-        return
+        return False
 
     command = {
         'Average': 'avg',
@@ -85,3 +95,5 @@ def create_and_save(imp, projections, path, filename, export_format):
                                export_format,
                                overwrite=True)
         proj.close()
+
+    return True
-- 
GitLab