Repository 'binary2labelimage'
hg clone https://toolshed.g2.bx.psu.edu/repos/thomaswollmann/binary2labelimage

Changeset 0:668f8dabb346 (2017-02-11)
Next changeset 1:f772af27a6de (2017-02-12)
Commit message:
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/\binary2labelimage commit 77f1ea5beca40d8b5851fe366e84c32d5df5d6f8
added:
binary2label.py
binary2label.xml
test-data/galaxyIcon_noText.tif
test-data/label.tif
b
diff -r 000000000000 -r 668f8dabb346 binary2label.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/binary2label.py Sat Feb 11 17:28:57 2017 -0500
b
@@ -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
b
diff -r 000000000000 -r 668f8dabb346 binary2label.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/binary2label.xml Sat Feb 11 17:28:57 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>
b
diff -r 000000000000 -r 668f8dabb346 test-data/galaxyIcon_noText.tif
b
Binary file test-data/galaxyIcon_noText.tif has changed
b
diff -r 000000000000 -r 668f8dabb346 test-data/label.tif
b
Binary file test-data/label.tif has changed