comparison 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
comparison
equal deleted inserted replaced
1:664232d2a3f7 2:5bf8eb50b280
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 import argparse 3 import argparse
4 import numpy as np 4
5 import os
6 import skimage.io 5 import skimage.io
7 from skimage.measure import regionprops 6 from skimage.measure import regionprops
8 7
9 parser = argparse.ArgumentParser(description='Count Objects') 8 parser = argparse.ArgumentParser(description='Count Objects')
10 parser.add_argument('input_file', type=argparse.FileType('r'), 9 parser.add_argument('input_file', type=argparse.FileType('r'),
11 help='Label input file') 10 help='Label input file')
12 parser.add_argument('output_file', type=argparse.FileType('w'), 11 parser.add_argument('output_file', type=argparse.FileType('w'),
13 help='Tabular output file') 12 help='Tabular output file')
14 args = parser.parse_args() 13 args = parser.parse_args()
15 14
16 img_raw = skimage.io.imread(args.input_file.name) 15 img_raw = skimage.io.imread(args.input_file.name)
17 res = len(regionprops(img_raw)) 16 res = len(regionprops(img_raw))
18 17
19 text_file = open(args.output_file.name, "w") 18 text_file = open(args.output_file.name, "w")