Mercurial > repos > imgteam > count_objects
view count_objects.py @ 2:5bf8eb50b280 draft
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/count_objects/ commit 3c2a4fed433e518fcd0bc8d4deffcc5c2346b2b5
author | imgteam |
---|---|
date | Sat, 08 Jul 2023 01:32:11 +0000 |
parents | 664232d2a3f7 |
children |
line wrap: on
line source
#!/usr/bin/python import argparse 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()