# HG changeset patch # User imgteam # Date 1563793726 14400 # Node ID fc85eb25316309fe988530c3a3f976c0bbe91503 # Parent 9ddb11b272ee42dfcdba686fcfe7b62035e084ee planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/colocalization_viz/ commit 1453917dfaf4c0922aec82c400015ff7e13ab737 diff -r 9ddb11b272ee -r fc85eb253163 colocalization_viz.py --- a/colocalization_viz.py Sat Feb 09 14:32:01 2019 -0500 +++ b/colocalization_viz.py Mon Jul 22 07:08:46 2019 -0400 @@ -1,25 +1,31 @@ import skimage.io import skimage.color +from skimage import img_as_uint +from skimage.exposure import equalize_adapthist import numpy as np -import os +import argparse import sys -import warnings -#TODO make importable by python script -args = sys.argv - +# TODO make importable by python script def readImg(path): img = skimage.io.imread(path) + if len(img.shape) > 2: img = skimage.color.rgb2gray(img) - img = np.expand_dims(img > 0, 3) + img = equalize_adapthist(img, clip_limit=0.03) + img = img_as_uint(img) + img = np.reshape(img, [img.shape[0], img.shape[1], 1]) return img -im1 = readImg(args[1]) -im2 = readImg(args[2]) -res = np.concatenate((im1, im2, np.zeros_like(im1)), axis=2) * 1.0 -with warnings.catch_warnings(): - warnings.simplefilter("ignore") - skimage.io.imsave(args[3], res) +parser = argparse.ArgumentParser() +parser.add_argument('input_file1', type=argparse.FileType('r'), default=sys.stdin, help='input file (red)') +parser.add_argument('input_file2', type=argparse.FileType('r'), default=sys.stdin, help='input file (green)') +parser.add_argument('out_file', type=argparse.FileType('w'), default=sys.stdin, help='out file (TIFF)') +args = parser.parse_args() + +im1 = readImg(args.input_file1.name) +im2 = readImg(args.input_file2.name) +res = np.concatenate((im1, im2, np.zeros_like(im1)), axis=-1) +skimage.io.imsave(args.out_file.name, res) diff -r 9ddb11b272ee -r fc85eb253163 colocalization_viz.xml --- a/colocalization_viz.xml Sat Feb 09 14:32:01 2019 -0500 +++ b/colocalization_viz.xml Mon Jul 22 07:08:46 2019 -0400 @@ -1,13 +1,15 @@ - + of two segmentation maps scikit-image numpy + pillow + tifffile + ]]> diff -r 9ddb11b272ee -r fc85eb253163 test-data/out.png Binary file test-data/out.png has changed