Mercurial > repos > imgteam > count_objects
comparison count_objects.py @ 1:664232d2a3f7 draft
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/count_objects/ commit 3d389fdec0db29cf6fbd783c0501455bf624fa90"
| author | imgteam |
|---|---|
| date | Wed, 18 Dec 2019 05:01:56 -0500 |
| parents | 895a29ebd0c7 |
| children | 5bf8eb50b280 |
comparison
equal
deleted
inserted
replaced
| 0:895a29ebd0c7 | 1:664232d2a3f7 |
|---|---|
| 2 | 2 |
| 3 import argparse | 3 import argparse |
| 4 import numpy as np | 4 import numpy as np |
| 5 import os | 5 import os |
| 6 import skimage.io | 6 import skimage.io |
| 7 from skimage.measure import regionprops | 7 from skimage.measure import regionprops |
| 8 | 8 |
| 9 parser = argparse.ArgumentParser(description='Count Objects') | 9 parser = argparse.ArgumentParser(description='Count Objects') |
| 10 parser.add_argument('input_file', type=argparse.FileType('r'), | 10 parser.add_argument('input_file', type=argparse.FileType('r'), |
| 11 help='Label input file') | 11 help='Label input file') |
| 12 parser.add_argument('output_file', type=argparse.FileType('w'), | 12 parser.add_argument('output_file', type=argparse.FileType('w'), |
| 13 help='Tabular output file') | 13 help='Tabular output file') |
| 14 args = parser.parse_args() | 14 args = parser.parse_args() |
| 15 | 15 |
| 16 img_raw = skimage.io.imread(args.input_file.name) | 16 img_raw = skimage.io.imread(args.input_file.name) |
| 17 res = len(regionprops(img_raw)) | 17 res = len(regionprops(img_raw)) |
| 18 | 18 |
| 19 text_file = open(args.output_file.name, "w") | 19 text_file = open(args.output_file.name, "w") |
