Mercurial > repos > thomaswollmann > count_objects
changeset 0:f02a2d0f407c draft default tip
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/count_objects/ commit d93e1dd276027cfc3fb518236110395a23d96f66
author | thomaswollmann |
---|---|
date | Wed, 16 Jan 2019 15:34:44 -0500 |
parents | |
children | |
files | count_objects.py count_objects.xml test-data/input.tiff test-data/table.csv |
diffstat | 4 files changed, 54 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/count_objects.py Wed Jan 16 15:34:44 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()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/count_objects.xml Wed Jan 16 15:34:44 2019 -0500 @@ -0,0 +1,31 @@ +<?xml version="1.0"?> +<tool name="Count Objects" id="ip_count_objects" version="0.0.4"> + <description>Count Objects</description> + <requirements> + <requirement type="package" version="0.14.0">scikit-image</requirement> + <requirement type="package" version="1.15.4">numpy</requirement> + </requirements> + <command> + <![CDATA[ + python '$__tool_directory__/count_objects.py' '$input' '$output' + ]]> + </command> + <inputs> + <param name="input" type="data" format="tiff" label="Source file" /> + </inputs> + <outputs> + <data format="tabular" name="output" /> + </outputs> + <tests> + <test> + <param name="input" value="input.tiff"/> + <output name="output" value="table.csv" ftype="tabular"/> + </test> + </tests> + <help> + This tool counts objects in a labeled image. + </help> + <citations> + <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation> + </citations> +</tool>