# HG changeset patch # User imgteam # Date 1549739799 18000 # Node ID 784d5cf56c82c2e144bc57e5dd6c9371e2badfcc planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/count_objects/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581 diff -r 000000000000 -r 784d5cf56c82 count_objects.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/count_objects.py Sat Feb 09 14:16:39 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 784d5cf56c82 count_objects.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/count_objects.xml Sat Feb 09 14:16:39 2019 -0500 @@ -0,0 +1,32 @@ + + in labled images + + scikit-image + numpy + + + + + + + + + + + + + + + + + + **What it does** + + This tool counts objects in a labeled image. + + + 10.1016/j.jbiotec.2017.07.019 + + diff -r 000000000000 -r 784d5cf56c82 test-data/input.tiff Binary file test-data/input.tiff has changed diff -r 000000000000 -r 784d5cf56c82 test-data/table.tsv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/table.tsv Sat Feb 09 14:16:39 2019 -0500 @@ -0,0 +1,2 @@ +objects +11 \ No newline at end of file