Mercurial > repos > imgteam > overlay_images
annotate overlay_images.py @ 0:589af0005df5 draft
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
author | imgteam |
---|---|
date | Sat, 26 Feb 2022 15:16:10 +0000 |
parents | |
children | b74693340624 |
rev | line source |
---|---|
0
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
1 """ |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
2 Copyright 2022 Biomedical Computer Vision Group, Heidelberg University. |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
3 |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
4 Distributed under the MIT license. |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
5 See file LICENSE for detail or copy at https://opensource.org/licenses/MIT |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
6 |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
7 """ |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
8 |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
9 import argparse |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
10 |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
11 import matplotlib.pyplot as plt |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
12 import numpy as np |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
13 import skimage.color |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
14 import skimage.io |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
15 import skimage.measure |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
16 import tifffile |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
17 |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
18 |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
19 def read_im_gray(fn): |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
20 img = skimage.io.imread(fn) |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
21 nDims = len(img.shape) |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
22 assert nDims in [2, 3], 'this tool only supports single 2D images' |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
23 if nDims == 3 and img.shape[-1] in [3, 4]: |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
24 img = skimage.color.rgb2gray(img) |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
25 if len(img.shape) == 3: |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
26 return img[:, :, 0] |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
27 else: |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
28 return img |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
29 |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
30 |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
31 def coloc_vis(in_red_fn, in_green_fn, out_fn): |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
32 im1 = read_im_gray(in_red_fn) |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
33 im2 = read_im_gray(in_green_fn) |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
34 assert im1.shape == im2.shape, 'Two images should have the same dimension' |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
35 |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
36 vmin = np.min([np.min(im1), np.min(im2)]) |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
37 scal = 255.0 / (np.max([np.max(im1), np.max(im2)]) - vmin) |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
38 |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
39 out_im = np.zeros(im1.shape + (3,), dtype=np.ubyte) |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
40 out_im[:, :, 0] = (im1 - vmin) * scal |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
41 out_im[:, :, 1] = (im2 - vmin) * scal |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
42 skimage.io.imsave(out_fn, out_im) # output is RGB |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
43 |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
44 |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
45 def blending(im1_fn, im2_fn, out_fn, alpha=0.5): |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
46 im1 = skimage.io.imread(im1_fn) |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
47 im2 = skimage.io.imread(im2_fn) |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
48 assert im1.shape == im2.shape, 'Two images should have the same dimension' |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
49 out_im = (1 - alpha) * im1 + alpha * im2 |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
50 if len(im1.shape) > 3: |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
51 tifffile.imwrite(out_fn, out_im.astype(im1.dtype), imagej=True) |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
52 else: |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
53 skimage.io.imsave(out_fn, out_im.astype(im1.dtype)) # format of output is the same as input |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
54 |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
55 |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
56 def seg_contour(im1_fn, im2_fn, out_fn, linewidth=0.3, color='#ff0000', show_label=False): |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
57 img = skimage.io.imread(im1_fn) |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
58 label = skimage.io.imread(im2_fn) |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
59 |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
60 fig = plt.figure() |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
61 ax = fig.add_axes([0, 0, 1, 1]) |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
62 ax.axis('off') |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
63 if show_label: |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
64 for reg in skimage.measure.regionprops(label): |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
65 ax.text(reg.centroid[1], reg.centroid[0], str(reg.label), color=color) |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
66 |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
67 if len(img.shape) == 2: |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
68 plt.imshow(img, cmap=plt.cm.gray) |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
69 else: |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
70 plt.imshow(img) |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
71 plt.contour(label, linewidths=linewidth, colors=color) |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
72 fig.canvas.print_png(out_fn) # output is RGB |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
73 |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
74 |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
75 if __name__ == "__main__": |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
76 parser = argparse.ArgumentParser(description="Overlay two images") |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
77 parser.add_argument("im1", help="The first image") |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
78 parser.add_argument("im2", help="The second image") |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
79 parser.add_argument("out", help="Output image") |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
80 parser.add_argument('--method', dest='method', default='coloc_vis', help='How to overlay images') |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
81 parser.add_argument('--alpha', dest='alpha', default=0.5, type=float, help='Blending weight') |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
82 parser.add_argument('--thickness', dest='thickness', default=0.3, type=float, help='Contour thickness') |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
83 parser.add_argument('--color', dest='color', default='#FFFF00', help='Contour color') |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
84 parser.add_argument('--show_label', dest='show_label', action='store_true', help='Plot label') |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
85 args = parser.parse_args() |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
86 |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
87 if args.method == 'coloc_vis': |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
88 coloc_vis(args.im1, args.im2, args.out) |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
89 elif args.method == 'blending': |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
90 blending(args.im1, args.im2, args.out, alpha=args.alpha) |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
91 elif args.method == 'seg_contour': |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
92 seg_contour(args.im1, args.im2, args.out, |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
93 linewidth=args.thickness, |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
94 color=args.color, |
589af0005df5
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 736949b5fb325cc7880d0ff0bb13b78115b9f81c"
imgteam
parents:
diff
changeset
|
95 show_label=args.show_label) |