From 0ba95284b30289ae3bc37719627c47037a5d96a1 Mon Sep 17 00:00:00 2001
From: Christopher Rhodes <christopher.rhodes@embl.de>
Date: Thu, 5 Oct 2023 17:28:06 +0200
Subject: [PATCH] Allow parameterization of 3D patch projection

---
 extensions/chaeo/products.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/extensions/chaeo/products.py b/extensions/chaeo/products.py
index dd9334a7..e7a12e76 100644
--- a/extensions/chaeo/products.py
+++ b/extensions/chaeo/products.py
@@ -37,6 +37,7 @@ def export_patches_from_zstack(
         pad_to: int = 256,
         make_3d: bool = False,
         prefix='patch',
+        projector=lambda x: np.max(x, axis=3, keepdims=True),
         **kwargs
 ):
     assert stack.chroma == 1, 'Expecting monochromatic image data'
@@ -51,7 +52,7 @@ def export_patches_from_zstack(
         if make_3d:
             patch = stack.data[sl]
         else:
-            patch = np.max(stack.data[sl], axis=3, keepdims=True)
+            patch = projector(stack.data[sl])
 
         assert len(patch.shape) == 4
         assert patch.shape[2] == stack.chroma
-- 
GitLab