comparison mask_image.xml @ 0:54d7d3450800 draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 6d73056a625002d0275b5a9a90a9fae329ce47f1"
author bgruening
date Thu, 26 Mar 2020 17:47:02 -0400
parents
children baa3e6d4d99d
comparison
equal deleted inserted replaced
-1:000000000000 0:54d7d3450800
1 <tool id="cp_mask_image" name="MaskImage" version="@CP_VERSION@">
2 <description>hides certain portions of an image based on previously identified objects or a binary image</description>
3
4 <macros>
5 <import>macros.xml</import>
6 </macros>
7
8 <expand macro="py_requirements"/>
9 <expand macro="cmd_modules" />
10
11 <configfiles>
12 <inputs name="inputs"/>
13 <configfile name="script_file">
14 import json
15 import sys
16 import os
17
18 FOURSPACES=@SPACES@
19
20 input_json_path = sys.argv[1]
21 input_pipeline= sys.argv[2]
22
23 params = json.load(open(input_json_path, "r"))
24
25 def writemi():
26 _str = "\nMaskImage:[module_num:%d|svn_version:\\'Unknown\\'|variable_revision_number:3|show_window:False|notes:\\x5B\'Keep only nucleoli inside the nuclei\\'\\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" % new_count
27
28 _str += FOURSPACES + "Select the input image:%s\n" % params['input_image']
29 _str += FOURSPACES + "Name the output image:%s\n" % params['name_output_image']
30
31 img_obj = params['con_img_obj']['img_obj']
32
33 _str += FOURSPACES + "Use objects or an image as a mask?:%s\n" % params['con_img_obj']['img_obj']
34
35 if img_obj == "Objects":
36 _str += FOURSPACES + "Select object for mask:%s\n" % params['con_img_obj']['select_obj']
37 _str += FOURSPACES + "Select image for mask:None\n"
38 else:
39 _str += FOURSPACES + "Select object for mask:None\n"
40 _str += FOURSPACES + "Select image for mask:%s\n" % params['con_img_obj']['select_img']
41
42 _str += FOURSPACES + "Invert the mask?:%s\n" % params['invert_mask']
43
44 return _str
45
46 with open(input_pipeline) as fin:
47 lines = fin.readlines()
48
49 k, v = lines[4].strip().split(':')
50
51 module_count = int(v)
52 new_count = module_count + 1
53 lines[4] = k + ":%d\n" % new_count
54
55 with open("output", "w") as f:
56 f.writelines(lines)
57 f.write(writemi())
58
59 f.close()
60 </configfile>
61 </configfiles>
62
63 <inputs>
64
65 <expand macro="input_pipeline_macro" />
66 <param name="input_image" label="Select input image" type="text">
67 <expand macro="text_validator" />
68 </param>
69
70 <param name="name_output_image" type="text" label="Name the output image">
71 <expand macro="text_validator" />
72 </param>
73
74 <conditional name="con_img_obj">
75 <param name="img_obj" label="Use objects or an image as a mask?" type="select">
76 <option value="Objects">Objects</option>
77 <option value="Image">Image</option>
78 </param>
79 <when value="Objects">
80 <param name="select_obj" label="Select object for mask" type="text"/>
81 </when>
82 <when value="Image">
83 <param name="select_img" label="Select image for mask" type="text"/>
84 </when>
85 </conditional>
86 <param name="invert_mask" label="Invert the mask?" type="select" display="radio">
87 <option value="Yes">Yes</option>
88 <option value="No">No</option>
89 </param>
90 </inputs>
91
92 <outputs>
93 <expand macro="output_pipeline_macro" />
94 </outputs>
95
96 <tests>
97 <test>
98 <expand macro="test_input_pipeline_param"/>
99 <param name="input_image" value="DNAdarkholes" />
100 <param name="name_output_image" value="MaskDNAdarkholes" />
101 <conditional name="con_img_obj">
102 <param name="img_obj" value="Objects" />
103 <param name="select_obj" value="Nuclei" />
104 </conditional>
105 <param name="invert_mask" value="No" />
106 <expand macro="test_out_file" file="mask_image.txt" />
107 </test>
108 </tests>
109
110 <expand macro="help" module="GrayToColor" />
111 <expand macro="citations" />
112
113 </tool>