Mercurial > repos > bgruening > cp_measure_image_area_occupied
view measure_image_area_occupied.xml @ 2:534ed7b8ca34 draft
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 1907942bef43b20edfdbd1d1b5eb1cac3602848b"
author | bgruening |
---|---|
date | Thu, 16 Apr 2020 05:44:16 -0400 |
parents | c75596eadae1 |
children | 7a08edbc790e |
line wrap: on
line source
<tool id="cp_measure_image_area_occupied" name="MeasureImageAreaOccupied" version="@CP_VERSION@"> <description>measure the area in an image occupied by objects</description> <macros> <import>macros.xml</import> </macros> <expand macro="py_requirements"/> <expand macro="cmd_modules" /> <configfiles> <inputs name="inputs" /> <configfile name="script_file"> import json import sys import os FOURSPACES=@SPACES@ input_json_path = sys.argv[1] input_pipeline= sys.argv[2] params = json.load(open(input_json_path, "r")) def writemiao(): _str = "\nMeasureImageAreaOccupied:[module_num:%d|svn_version:\\'Unknown\\'|variable_revision_number:4|show_window:False|notes:\\x5B\\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" % new_count hidden = len(params['rpt_area']) _str += FOURSPACES + "Hidden:%d\n" % hidden for area in params['rpt_area']: _str += FOURSPACES + "Measure the area occupied in a binary image, or in objects?:%s\n" % area['con_area']['objects_or_image'] obj_flag = area['con_area']['objects_or_image'] if obj_flag == "Objects": _str += FOURSPACES + "Select objects to measure:%s\n" % area['con_area']['objects_to_measure'] _str += FOURSPACES + "Select a binary image to measure:None\n" else: _str += FOURSPACES + "Select objects to measure:None\n" _str += FOURSPACES + "Select a binary image to measure:%s\n" % area['con_area']['image_to_measure'] return _str with open(input_pipeline) as fin: lines = fin.readlines() k, v = lines[4].strip().split(':') module_count = int(v) new_count = module_count + 1 lines[4] = k + ":%d\n" % new_count with open("output", "w") as f: f.writelines(lines) f.write(writemiao()) f.close() </configfile> </configfiles> <inputs> <expand macro="input_pipeline_macro" /> <repeat name="rpt_area" title="Add another area"> <conditional name="con_area"> <param name="objects_or_image" label="Measure the area occupied in a binary image, or in objects?" type="select"> <option value="Binary image">Binary image</option> <option value="Objects">Objects</option> </param> <when value="Objects"> <param name="objects_to_measure" label="Select objects to measure" type="text"> <expand macro="text_validator" /> </param> </when> <when value="Binary image"> <param name="image_to_measure" label="Select a binary image to measure" type="text"> <expand macro="text_validator" /> </param> </when> </conditional> </repeat> </inputs> <outputs> <expand macro="output_pipeline_macro" /> </outputs> <tests> <test> <expand macro="test_input_pipeline_param" /> <repeat name="rpt_area"> <conditional name="con_area"> <param name="objects_or_image" value="Objects" /> <param name="objects_to_measure" value="Nuclei" /> </conditional> </repeat> <repeat name="rpt_area"> <conditional name="con_area"> <param name="objects_or_image" value="Objects" /> <param name="objects_to_measure" value="Nucleoli" /> </conditional> </repeat> <expand macro="test_out_file" file="measure_image_area_occupied.txt" /> </test> </tests> <expand macro="help" module="MeasureImageAreaOccupied" /> <expand macro="citations" /> </tool>