From 477833d1cb3938b6c06ec52eb807c4558ba7bc51 Mon Sep 17 00:00:00 2001
From: Andrey Aristov <aaristov@pasteur.fr>
Date: Fri, 3 Jun 2022 18:13:10 +0200
Subject: [PATCH] make saving tif optional

---
 src/droplet_growth/register.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/droplet_growth/register.py b/src/droplet_growth/register.py
index bc36ead..a3d9b63 100644
--- a/src/droplet_growth/register.py
+++ b/src/droplet_growth/register.py
@@ -44,7 +44,6 @@ def align_stack(data_or_path, template16, mask2, plot=False, path_to_save=None,
         print(path, stack.shape)
     else:
         assert data_or_path.ndim == 3 and data_or_path.shape[0] == 2
-        assert path_to_save is not None, "Please provide the path to save the data"
         stack = data_or_path
 
     print(f'Aligned stack will be saved to {path_to_save}')
@@ -89,7 +88,8 @@ def align_stack(data_or_path, template16, mask2, plot=False, path_to_save=None,
 
     aligned_stack = np.stack((aligned_bf, aligned_tritc, mask2)).astype('uint16')
 
-    imwrite(path_to_save, aligned_stack, imagej=True, metadata=META_ALIGNED)
+    if path_to_save is not None:
+        imwrite(path_to_save, aligned_stack, imagej=True, metadata=META_ALIGNED)
     print(f'Saved aligned stack {path_to_save}')
     return aligned_stack, tvec
 
-- 
GitLab