From 99d17fbf63cef8038b27120bfb5165b3dba26456 Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Tue, 12 Feb 2019 18:51:16 +0100
Subject: [PATCH] Add 'imagej.misc' module

---
 src/imcflibs/imagej/misc.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 src/imcflibs/imagej/misc.py

diff --git a/src/imcflibs/imagej/misc.py b/src/imcflibs/imagej/misc.py
new file mode 100644
index 0000000..07851fc
--- /dev/null
+++ b/src/imcflibs/imagej/misc.py
@@ -0,0 +1,15 @@
+"""Miscellaneous ImageJ related functions, mostly convenience wrappers."""
+
+from ij import IJ  # pylint: disable-msg=E0401
+
+def show_status(logger, msg):
+    """Wrapper to update the ImageJ status bar and the log simultaneously."""
+    logger.info(msg)
+    IJ.showStatus(msg)
+
+
+def show_progress(logger, cur, final):
+    """Wrapper to update the progress bar and issue a log message."""
+    # ij.IJ.showProgress is adding 1 to the value given as first parameter...
+    logger.info("Progress: %s / %s (%s)" % (cur+1, final, (1.0+cur)/final))
+    IJ.showProgress(cur, final)
-- 
GitLab