Mercurial > repos > bgruening > cp_measure_texture
comparison measure_texture.xml @ 0:0f751bb492de draft
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 6d73056a625002d0275b5a9a90a9fae329ce47f1"
author | bgruening |
---|---|
date | Thu, 26 Mar 2020 16:30:56 -0400 |
parents | |
children | 8f3f8c94626f |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:0f751bb492de |
---|---|
1 <tool id="cp_measure_texture" name="MeasureTexture" version="@CP_VERSION@"> | |
2 <description>measures the degree and nature of textures within images and objects to quantify their roughness and smoothness</description> | |
3 | |
4 <macros> | |
5 <import>macros.xml</import> | |
6 <xml name="measureImgObj"> | |
7 <repeat name="rpt_obj_to_measure" title="Add another object"> | |
8 <param name="obj_to_measure" label="Select objects to measure" type="text" /> | |
9 </repeat> | |
10 </xml> | |
11 </macros> | |
12 | |
13 <expand macro="py_requirements"/> | |
14 <expand macro="cmd_modules" /> | |
15 | |
16 <configfiles> | |
17 <inputs name="inputs" /> | |
18 <configfile name="script_file"> | |
19 import json | |
20 import sys | |
21 import os | |
22 | |
23 FOURSPACES=@SPACES@ | |
24 | |
25 input_json_path = sys.argv[1] | |
26 input_pipeline= sys.argv[2] | |
27 | |
28 params = json.load(open(input_json_path, "r")) | |
29 | |
30 def writemi(): | |
31 _str = "\nMeasureTexture:[module_num:%d|svn_version:\\'Unknown\\'|variable_revision_number:5|show_window:False|notes:\\x5B\\'PARAMS\\x3A\\', \\'- Texture scale\'\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" % new_count | |
32 | |
33 img_count = len(params['rpt_image_to_measure']) | |
34 obj_count = len(params['con_img_obj']['rpt_obj_to_measure']) | |
35 scale_count = len(params['rpt_scale_to_measure']) | |
36 | |
37 img_obj = params['con_img_obj']['img_obj'] | |
38 | |
39 _str += FOURSPACES + "Hidden:%d\n" % img_count | |
40 _str += FOURSPACES + "Hidden:%d\n" % obj_count | |
41 _str += FOURSPACES + "Hidden:%d\n" % scale_count | |
42 | |
43 for img in params['rpt_image_to_measure']: | |
44 _str += FOURSPACES + "Select an image to measure:%s\n" % img['image_to_measure'] | |
45 | |
46 if img_obj == "Images": | |
47 _str += FOURSPACES + "Select objects to measure:None\n" | |
48 else: | |
49 for obj in params['con_img_obj']['rpt_obj_to_measure']: | |
50 _str += FOURSPACES + "Select objects to measure:%s\n" % obj['obj_to_measure'] | |
51 | |
52 for scale in params['rpt_scale_to_measure']: | |
53 _str += FOURSPACES + "Texture scale to measure:%s\n" % str(scale['scale_to_measure']) | |
54 | |
55 _str += FOURSPACES + "Measure images or objects?:%s\n" % params['con_img_obj']['img_obj'] | |
56 | |
57 return _str | |
58 | |
59 | |
60 with open(input_pipeline) as fin: | |
61 lines = fin.readlines() | |
62 | |
63 k, v = lines[4].strip().split(':') | |
64 | |
65 module_count = int(v) | |
66 new_count = module_count + 1 | |
67 lines[4] = k + ":%d\n" % new_count | |
68 | |
69 with open("output", "w") as f: | |
70 f.writelines(lines) | |
71 f.write(writemi()) | |
72 | |
73 f.close() | |
74 </configfile> | |
75 </configfiles> | |
76 | |
77 <inputs> | |
78 | |
79 <expand macro="input_pipeline_macro" /> | |
80 <repeat name="rpt_image_to_measure" title="Add another image"> | |
81 <param name="image_to_measure" label="Select an image to measure" type="text" > | |
82 <expand macro="text_validator" /> | |
83 </param> | |
84 </repeat> | |
85 | |
86 <conditional name="con_img_obj"> | |
87 <param name="img_obj" label="Measure images or objects?" type="select"> | |
88 <option value="Images">Images</option> | |
89 <option value="Objects">Objects</option> | |
90 <option value="Both">Both</option> | |
91 </param> | |
92 <when value="Objects"> | |
93 <expand macro="measureImgObj" /> | |
94 </when> | |
95 <when value="Both"> | |
96 <expand macro="measureImgObj" /> | |
97 </when> | |
98 <when value="Images" /> | |
99 </conditional> | |
100 <repeat name="rpt_scale_to_measure" title="Add another scale"> | |
101 <param name="scale_to_measure" label="Texture scale to measure" type="integer" value="3" min="0" /> | |
102 </repeat> | |
103 </inputs> | |
104 | |
105 <outputs> | |
106 <expand macro="output_pipeline_macro" /> | |
107 </outputs> | |
108 | |
109 <tests> | |
110 <test> | |
111 <expand macro="test_input_pipeline_param" /> | |
112 <repeat name="rpt_image_to_measure"> | |
113 <param name="image_to_measure" value="DNA" /> | |
114 </repeat> | |
115 <conditional name="con_img_obj"> | |
116 <param name="img_obj" value="Objects" /> | |
117 <repeat name="rpt_obj_to_measure"> | |
118 <param name="obj_to_measure" value="Nuclei" /> | |
119 </repeat> | |
120 </conditional> | |
121 | |
122 <repeat name="rpt_scale_to_measure"> | |
123 <param name="scale_to_measure" value="3" /> | |
124 </repeat> | |
125 | |
126 <expand macro="test_out_file" file="measure_texture.txt" /> | |
127 </test> | |
128 </tests> | |
129 | |
130 <expand macro="help" module="MeasureObjectSizeShape" /> | |
131 <expand macro="citations" /> | |
132 </tool> |