changeset 1:fc85eb253163 draft

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/colocalization_viz/ commit 1453917dfaf4c0922aec82c400015ff7e13ab737
author imgteam
date Mon, 22 Jul 2019 07:08:46 -0400
parents 9ddb11b272ee
children c73332d5c3bb
files colocalization_viz.py colocalization_viz.xml test-data/out.png
diffstat 3 files changed, 22 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- 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)
--- 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 @@
-<tool id="ip_colocalization" name="Colocalization" version="0.0.6">
+<tool id="ip_colocalization" name="Colocalization" version="0.0.8">
     <description>of two segmentation maps</description>
     <requirements>
         <requirement type="package" version="0.14.2">scikit-image</requirement>
         <requirement type="package" version="1.15.4">numpy</requirement>
+        <requirement type="package" version="5.3.0">pillow</requirement>
+        <requirement type="package" version="0.15.1">tifffile</requirement>
     </requirements>
     <command detect_errors="aggressive">
     <![CDATA[
         python '$__tool_directory__/colocalization_viz.py' '$input_mask1' '$input_mask2' ./out.png
-    ]]>
+    ]]> 
     </command>
     <inputs>
         <param name="input_mask1" type="data" format="tiff" label="Mask1 Source File" />
Binary file test-data/out.png has changed