# HG changeset patch # User thomaswollmann # Date 1547670660 18000 # Node ID 832336936bc5a98e39cfb9851996134e79b8a014 planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/count_objects/ commit d93e1dd276027cfc3fb518236110395a23d96f66 diff -r 000000000000 -r 832336936bc5 count_objects.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/count_objects.py Wed Jan 16 15:31:00 2019 -0500 @@ -0,0 +1,21 @@ +#!/usr/bin/python + +import argparse +import numpy as np +import os +import skimage.io +from skimage.measure import regionprops + +parser = argparse.ArgumentParser(description='Count Objects') +parser.add_argument('input_file', type=argparse.FileType('r'), + help='Label input file') +parser.add_argument('output_file', type=argparse.FileType('w'), + help='Tabular output file') +args = parser.parse_args() + +img_raw = skimage.io.imread(args.input_file.name) +res = len(regionprops(img_raw)) + +text_file = open(args.output_file.name, "w") +text_file.write("objects\n%s" % res) +text_file.close() diff -r 000000000000 -r 832336936bc5 count_objects.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/count_objects.xml Wed Jan 16 15:31:00 2019 -0500 @@ -0,0 +1,31 @@ + + + Count Objects + + scikit-image + numpy + + + + + + + + + + + + + + + + + + This tool counts objects in a labeled image. + + + 10.1016/j.jbiotec.2017.07.019 + + diff -r 000000000000 -r 832336936bc5 test-data/input.tiff Binary file test-data/input.tiff has changed diff -r 000000000000 -r 832336936bc5 test-data/table.csv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/table.csv Wed Jan 16 15:31:00 2019 -0500 @@ -0,0 +1,2 @@ +objects +11 \ No newline at end of file