# HG changeset patch # User imgteam # Date 1727087174 0 # Node ID eb173a1fabc4ebfe74c661a5103bbd97519fef0b # Parent f42d21fe65d8769c12762208c77f731dd96cb5af planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 574caf027453f080a7f86f80eae9775ed1c8afa0 diff -r f42d21fe65d8 -r eb173a1fabc4 creators.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creators.xml Mon Sep 23 10:26:14 2024 +0000 @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r f42d21fe65d8 -r eb173a1fabc4 overlay_images.py --- a/overlay_images.py Thu Aug 10 07:29:24 2023 +0000 +++ b/overlay_images.py Mon Sep 23 10:26:14 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]: @@ -33,15 +34,17 @@ img = np.squeeze(img) assert img.ndim == 2 or (img.ndim == 3 and img.shape[-1] in (3, 4)) if str(img.dtype).startswith('float'): - img = np.round(img * 255).astype('uint8') - elif img.dtype == 'uint16': - img = img // 256 - elif img.dtype != 'uint8': + img = np.round(img * 255).astype(np.uint8) + elif img.dtype == np.uint16: + img = (img // 256).astype(np.uint8) + elif img.dtype != np.uint8: raise ValueError(f'unknown dtype: {img.dtype}') if img.ndim == 2: - return np.dstack([img] * 3).copy() + result = np.dstack([img] * 3).copy() else: - return img[:, :, :3].copy() + result = img[:, :, :3].copy() + assert result.dtype == np.uint8, result.dtype + return result def coloc_vis(in_red_fn, in_green_fn, out_fn): @@ -59,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: @@ -70,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') diff -r f42d21fe65d8 -r eb173a1fabc4 overlay_images.xml --- a/overlay_images.xml Thu Aug 10 07:29:24 2023 +0000 +++ b/overlay_images.xml Mon Sep 23 10:26:14 2024 +0000 @@ -1,15 +1,38 @@ - - for visualization + + + + creators.xml + tests.xml + 0.0.4 + 4 + + + + + + + operation_3443 + + + galaxy_image_analysis + scikit-image matplotlib tifffile - numpy + numpy + pillow + giatools - + - - + + - - + + - - - + + + - - + + @@ -48,45 +71,70 @@ - + + method_option['method'] != 'seg_contour' + + + method_option['method'] == 'seg_contour' + - + - + - + - + - - + + - + - - + + + + + + + + + + - + + + + + + + + + - - **What it does** + + This tool overlays two image to visualize *linear image blending*, *colocalization*, or *segmentation contours* + over an intensity image. For *image blending* and *colocalization*, the input images must be single-channel 2-D + images. For *segmentation contours*, the intensity must be a 2-D single-channel or 2-D RGB image. + + ]]> 10.1016/j.jbiotec.2017.07.019 diff -r f42d21fe65d8 -r eb173a1fabc4 test-data/sample1.tif Binary file test-data/sample1.tif has changed diff -r f42d21fe65d8 -r eb173a1fabc4 test-data/sample1_uint16.tif Binary file test-data/sample1_uint16.tif has changed diff -r f42d21fe65d8 -r eb173a1fabc4 test-data/sample1_uint8.tif Binary file test-data/sample1_uint8.tif has changed diff -r f42d21fe65d8 -r eb173a1fabc4 test-data/sample1_uint8_rgb.png Binary file test-data/sample1_uint8_rgb.png has changed diff -r f42d21fe65d8 -r eb173a1fabc4 test-data/test3.png Binary file test-data/test3.png has changed diff -r f42d21fe65d8 -r eb173a1fabc4 test-data/test3.tif Binary file test-data/test3.tif has changed diff -r f42d21fe65d8 -r eb173a1fabc4 test-data/test4.png Binary file test-data/test4.png has changed diff -r f42d21fe65d8 -r eb173a1fabc4 test-data/test4.tif Binary file test-data/test4.tif has changed diff -r f42d21fe65d8 -r eb173a1fabc4 test-data/test5.png Binary file test-data/test5.png has changed diff -r f42d21fe65d8 -r eb173a1fabc4 tests.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests.xml Mon Sep 23 10:26:14 2024 +0000 @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +