changeset 0:b97a362ff321 draft

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/binary2labelimage/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
author imgteam
date Sat, 09 Feb 2019 14:30:31 -0500
parents
children 6c92ac9ce868
files binary2label.py binary2label.xml test-data/galaxyIcon_noText.tif test-data/label.tif
diffstat 4 files changed, 49 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/binary2label.py	Sat Feb 09 14:30:31 2019 -0500
@@ -0,0 +1,18 @@
+import argparse
+import sys
+import skimage.io
+from skimage.measure import label
+import numpy as np
+import warnings
+from PIL import Image
+
+parser = argparse.ArgumentParser()
+parser.add_argument('input_file', type=argparse.FileType('r'), default=sys.stdin, help='input file')
+parser.add_argument('out_file', type=argparse.FileType('w'), default=sys.stdin, help='out file (TIFF)')
+args = parser.parse_args()
+
+img_in = skimage.io.imread(args.input_file.name) > 0
+res = label(img_in).astype(np.int32)
+
+res = Image.fromarray(res)
+res.save(args.out_file.name, "tiff")
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/binary2label.xml	Sat Feb 09 14:30:31 2019 -0500
@@ -0,0 +1,31 @@
+<tool id="ip_binary_to_labelimage" name="Binary 2 Label" version="0.2">
+    <description>Converts Binary to Label Image</description>
+    <requirements>
+        <requirement type="package" version="0.12.3">scikit-image</requirement>
+    </requirements>
+    <command>
+        <![CDATA[
+        python '$__tool_directory__/binary2label.py' '$input' '$output'
+        ]]>
+    </command>
+    <inputs>
+        <param name="input" type="data" format="tiff,png,jpg,bmp" label="Binary Image File"/>
+    </inputs>
+    <outputs>
+        <data format="tiff" name="output"/>
+    </outputs>
+    <tests>
+        <test>
+            <param name="input" value="galaxyIcon_noText.tif" />
+            <output name="output" value="label.tif" ftype="tiff" />
+        </test>
+    </tests>
+    <help>
+    **What it does**
+
+    This tool assigns every object an own grey value.
+    </help>
+    <citations>
+        <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation>
+    </citations>
+</tool>
Binary file test-data/galaxyIcon_noText.tif has changed
Binary file test-data/label.tif has changed