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

Changeset 0:b97a362ff321 (2019-02-09)
Next changeset 1:6c92ac9ce868 (2019-07-22)
Commit message:
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/binary2labelimage/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
added:
binary2label.py
binary2label.xml
test-data/galaxyIcon_noText.tif
test-data/label.tif
b
diff -r 000000000000 -r b97a362ff321 binary2label.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/binary2label.py Sat Feb 09 14:30:31 2019 -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 b97a362ff321 binary2label.xml
--- /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>
b
diff -r 000000000000 -r b97a362ff321 test-data/galaxyIcon_noText.tif
b
Binary file test-data/galaxyIcon_noText.tif has changed
b
diff -r 000000000000 -r b97a362ff321 test-data/label.tif
b
Binary file test-data/label.tif has changed