# HG changeset patch # User imgteam # Date 1549739588 18000 # Node ID 1cde6ba34356fc2a60c14688f1bc1b6a8552d1c5 planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/binary2labelimage/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581 diff -r 000000000000 -r 1cde6ba34356 binary2label.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/binary2label.py Sat Feb 09 14:13:08 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 diff -r 000000000000 -r 1cde6ba34356 binary2label.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/binary2label.xml Sat Feb 09 14:13:08 2019 -0500 @@ -0,0 +1,31 @@ + + Converts Binary to Label Image + + scikit-image + + + + + + + + + + + + + + + + + + **What it does** + + This tool assigns every object an own grey value. + + + 10.1016/j.jbiotec.2017.07.019 + + diff -r 000000000000 -r 1cde6ba34356 test-data/galaxyIcon_noText.tif Binary file test-data/galaxyIcon_noText.tif has changed diff -r 000000000000 -r 1cde6ba34356 test-data/label.tif Binary file test-data/label.tif has changed