diff overlay_images.py @ 6:2495f8b2aefd draft

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit c86a1b93cb7732f7331a981d13465653cc1a2790
author imgteam
date Wed, 24 Apr 2024 08:12:55 +0000
parents 37662cbf44b8
children
line wrap: on
line diff
--- a/overlay_images.py	Thu Apr 04 15:25:58 2024 +0000
+++ b/overlay_images.py	Wed Apr 24 08:12:55 2024 +0000
@@ -7,6 +7,7 @@
 
 import argparse
 
+import giatools.io
 import matplotlib.colors
 import matplotlib.pyplot as plt
 import numpy as np
@@ -18,7 +19,7 @@
 
 
 def read_im_gray(fn):
-    img = skimage.io.imread(fn)
+    img = giatools.io.imread(fn)
     nDims = len(img.shape)
     assert nDims in [2, 3], 'this tool only supports single 2D images'
     if nDims == 3 and img.shape[-1] in [3, 4]:
@@ -61,8 +62,8 @@
 
 
 def blending(im1_fn, im2_fn, out_fn, alpha=0.5):
-    im1 = skimage.io.imread(im1_fn)
-    im2 = skimage.io.imread(im2_fn)
+    im1 = giatools.io.imread(im1_fn)
+    im2 = giatools.io.imread(im2_fn)
     assert im1.shape == im2.shape, 'Two images should have the same dimension'
     out_im = (1 - alpha) * im1 + alpha * im2
     if len(im1.shape) > 3:
@@ -72,8 +73,8 @@
 
 
 def seg_contour(im1_fn, im2_fn, out_fn, linewidth, color='#ff0000', show_label=False, label_color='#ffff00'):
-    img = skimage.io.imread(im1_fn)
-    labels = skimage.io.imread(im2_fn)
+    img = giatools.io.imread(im1_fn)
+    labels = giatools.io.imread(im2_fn)
 
     result = get_rgb8_copy(img)
     cp = ContourPaint(labels, linewidth, where='center')