changeset 0:4f07ac917459 draft

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/\binary2labelimage commit 77f1ea5beca40d8b5851fe366e84c32d5df5d6f8
author thomaswollmann
date Sat, 11 Feb 2017 17:28:38 -0500
parents
children 94566c0758fa
files binary2label.py binary2label.xml test-data/galaxyIcon_noText.tif test-data/label.tif
diffstat 4 files changed, 47 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/binary2label.py	Sat Feb 11 17:28:38 2017 -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 11 17:28:38 2017 -0500
@@ -0,0 +1,29 @@
+<tool id="binary2labelimage" name="Binary 2 Label" version="0.1">
+  <description>Converts Binary to Label Image</description>
+  <requirements>
+    <requirement type="package" version="0.12.3" >scikit-image</requirement>
+    <requirement type="package" version="4.0.0">pillow</requirement>
+    <requirement type="package" version="1.12">numpy</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>This tool assigns every object an own grey value.</help>
+  <citations>
+      <citation type="doi">10.7717/peerj.453</citation>
+  </citations>
+</tool>
Binary file test-data/galaxyIcon_noText.tif has changed
Binary file test-data/label.tif has changed