From 7b910b678e4d9f96c7d299e3f3709034e2ed801b Mon Sep 17 00:00:00 2001
From: Harry Carey <38996929+PolarBean@users.noreply.github.com>
Date: Wed, 10 Apr 2024 13:06:59 +0200
Subject: [PATCH] add invert function

---
 scripts/Tiling_script.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/Tiling_script.py b/scripts/Tiling_script.py
index fd12fff..c3c65f4 100644
--- a/scripts/Tiling_script.py
+++ b/scripts/Tiling_script.py
@@ -12,8 +12,10 @@ img = tiff.imread(path_to_file)
 shape = img.shape
 #Get the chunk size
 chunk_size = 512
+#invert the image if neccessary
+img = np.invert(img)
 #crop the image and save each chunk
 for i in range(0, shape[0], chunk_size):
     for j in range(0, shape[1], chunk_size):
         chunk = img[i:i+chunk_size, j:j+chunk_size]
-        tiff.imsave("{}/chunk_{}_{}.tif".format(image_outdir,i, j), chunk)
\ No newline at end of file
+        tiff.imsave("{}/chunk_{}_{}.tif".format(image_outdir,i, j), chunk)
-- 
GitLab