Mercurial > repos > imgteam > colocalization_viz
view colocalization_viz.py @ 2:c73332d5c3bb draft
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/colocalization_viz/ commit 3d389fdec0db29cf6fbd783c0501455bf624fa90"
author | imgteam |
---|---|
date | Wed, 18 Dec 2019 05:01:42 -0500 |
parents | fc85eb253163 |
children | 0f8652663a03 |
line wrap: on
line source
import skimage.io import skimage.color from skimage import img_as_uint from skimage.exposure import equalize_adapthist import numpy as np import argparse import sys # 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 = 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 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)