|
2 | 2 | <description>with highly customizable appearance</description> |
3 | 3 | <macros> |
4 | 4 | <token name="@TOOL_VERSION@">1.9.4</token> |
5 | | - <token name="@VERSION_SUFFIX@">2</token> |
| 5 | + <token name="@VERSION_SUFFIX@">3</token> |
6 | 6 | <token name="@PROFILE@">23.0</token> |
7 | 7 | </macros> |
8 | 8 | <requirements> |
|
47 | 47 | #if str($margin): |
48 | 48 | --margin $margin |
49 | 49 | #end if |
50 | | - #if $background |
51 | | - --background '$background' |
| 50 | + --mode $background_options.mode |
| 51 | + #if str($background_options.mode) == 'RGB' |
| 52 | + --background '$background_options.background_color' |
| 53 | + #if str($background_options.cloud_shape.cloud_shape_options) == 'mask' |
| 54 | + --mask $background_options.cloud_shape.mask |
| 55 | + --contour_width $background_options.cloud_shape.contour_width |
| 56 | + --contour_color '$background_options.cloud_shape.contour_color' |
| 57 | + #end if |
| 58 | + #else |
| 59 | + --background None |
| 60 | + #if str($background_options.cloud_shape.cloud_shape_options) == 'mask' |
| 61 | + --mask $background_options.cloud_shape.mask |
| 62 | + #end if |
52 | 63 | #end if |
53 | | - #if $mask |
54 | | - --mask $mask |
55 | | - #end if |
56 | | - #if $color_choice == "color": |
57 | | - --color '$color' |
58 | | - #else if $color_choice == "colormask": |
59 | | - --colormask $colormask |
| 64 | + #if $color_choice.color_option == "color": |
| 65 | + --color '$color_choice.color' |
| 66 | + #else if $color_choice.color_option == "colormask": |
| 67 | + --colormask $color_choice.colormask |
60 | 68 | #end if |
61 | 69 | #if $colormap |
62 | 70 | --colormap $colormap |
63 | 71 | #end if |
64 | | - #if $mode |
65 | | - --mode $mode |
66 | | - #end if |
67 | | - #if $contour_width |
68 | | - --contour_width $contour_width |
69 | | - #end if |
70 | | - #if $contour_color |
71 | | - --contour_color '$contour_color' |
72 | | - #end if |
73 | 72 | #if str($prefer_horizontal): |
74 | 73 | --prefer_horizontal $prefer_horizontal |
75 | 74 | #end if |
|
120 | 119 | <param argument="--width" type="integer" min="1" value="400" optional="true" label="Define output image width"/> |
121 | 120 | <param argument="--height" type="integer" min="1" value="200" optional="true" label="Define output image height"/> |
122 | 121 | <param argument="--margin" type="integer" value="2" label="Spacing to leave around words"/> |
123 | | - <param argument="--background" type="color" value="#000000" optional="true" label="Use given color as background color for the image"> |
124 | | - <validator type="regex" message="Please select a valid RGB color">[#][0-9A-Fa-f]{6}</validator> |
125 | | - </param> |
126 | | - <param argument="--mask" type="data" format="png" optional="true" label="Mask to use for the image form"/> |
| 122 | + <conditional name="background_options"> |
| 123 | + <param argument="--mode" type="select" label="Use RGB or RGBA for transparent background"> |
| 124 | + <option value="RGB" selected="true">RGB</option> |
| 125 | + <option value="RGBA">RGBA</option> |
| 126 | + </param> |
| 127 | + <when value="RGB"> |
| 128 | + <param argument="--background_color" type="color" value="#000000" optional="true" label="Use given color as background color for the image"> |
| 129 | + <validator type="regex" message="Please select a valid RGB color">[#][0-9A-Fa-f]{6}</validator> |
| 130 | + </param> |
| 131 | + <conditional name="cloud_shape"> |
| 132 | + <param name="cloud_shape_options" type="select" label="Choose word cloud shape"> |
| 133 | + <option value="rectangle" selected="true">Default - Rectangle</option> |
| 134 | + <option value="mask">Mask from image input</option> |
| 135 | + </param> |
| 136 | + <when value="rectangle"/> |
| 137 | + <when value="mask"> |
| 138 | + <param argument="--mask" type="data" format="png" optional="true" label="Mask to use for the image form"/> |
| 139 | + <param argument="--contour_width" type="float" min="0" value="0" optional="true" label="Contour width" help="Use given color as mask contour color"/> |
| 140 | + <param argument="--contour_color" type="color" value="#000000" optional="true" label="Contour color"> |
| 141 | + <validator type="regex" message="Please select a valid RGB color">[#][0-9A-Fa-f]{6}</validator> |
| 142 | + </param> |
| 143 | + </when> |
| 144 | + </conditional> |
| 145 | + </when> |
| 146 | + <when value="RGBA"> |
| 147 | + <conditional name="cloud_shape"> |
| 148 | + <param name="cloud_shape_options" type="select" label="Choose word cloud shape"> |
| 149 | + <option value="rectangle" selected="true">Default - Rectangle</option> |
| 150 | + <option value="mask">Mask from image input</option> |
| 151 | + </param> |
| 152 | + <when value="rectangle"/> |
| 153 | + <when value="mask"> |
| 154 | + <param argument="--mask" type="data" format="png" optional="true" label="Mask to use for the image form"/> |
| 155 | + </when> |
| 156 | + </conditional> |
| 157 | + </when> |
| 158 | + </conditional> |
127 | 159 | <conditional name="color_choice" label="Choose color option"> |
128 | 160 | <param name="color_option" type="select" label="Color option"> |
129 | 161 | <option value="color">Color</option> |
|
163 | 195 | <option value="BuGn">BuGn</option> |
164 | 196 | <option value="YlGn">YlGn</option> |
165 | 197 | </param> |
166 | | - <param argument="--mode" type="select" value="RGB" optional="true" label="Use RGB or RGBA for transparent background"> |
167 | | - <option value="RGB">RGB</option> |
168 | | - <option value="RGBA">RGBA</option> |
169 | | - </param> |
170 | | - <param argument="--contour_width" type="float" min="0" value="0" optional="true" label="Contour width" help="Use given color as mask contour color"/> |
171 | | - <param argument="--contour_color" type="color" value="#000000" optional="true" label="Contour color"> |
172 | | - <validator type="regex" message="Please select a valid RGB color">[#][0-9A-Fa-f]{6}</validator> |
173 | | - </param> |
174 | 198 | <param argument="--prefer_horizontal" type="float" min="0" max="1" value="0.9" optional="true" label="Ratio of times to try horizontal fitting as opposed to vertical"/> |
175 | 199 | <param argument="--scale" type="float" value="1.0" optional="True" label="Scaling between computation and drawing"/> |
176 | 200 | <param argument="--relative_scaling" type="float" min="0.0" max="1.0" value="0.0" optional="true" label="Scaling of words by frequency (0 - 1)"/> |
|
185 | 209 | </outputs> |
186 | 210 | <tests> |
187 | 211 | <test expect_num_outputs="1"> |
188 | | - <param name="text" value="test.txt" ftype="txt"/> |
189 | | - <conditional name="color_choice"> |
190 | | - <param name="color_option" value="color"/> |
191 | | - <param name="color" value="#00ff00"/> |
| 212 | + <param name="text" value="test.txt"/> |
| 213 | + <param name="font_step" value="2"/> |
| 214 | + <param name="min_word_length" value="2"/> |
| 215 | + <param name="width" value="200"/> |
| 216 | + <param name="height" value="100"/> |
| 217 | + <param name="colormap" value="inferno"/> |
| 218 | + <param name="scale" value="1.8"/> |
| 219 | + <param name="no_collocations" value="false"/> |
| 220 | + <conditional name="fonts"> |
| 221 | + <param name="fonts_selector" value="none"/> |
192 | 222 | </conditional> |
193 | | - <param name="contour_color" value="#1f4068"/> |
194 | | - <param name="random_state" value="10"/> |
195 | | - <param name="background" value="#000000"/> |
196 | | - <output name="output" file="output_1.png" compare="image_diff" /> |
| 223 | + <output name="output" file="output0.png" ftype="png"/> |
197 | 224 | </test> |
| 225 | + |
198 | 226 | <test expect_num_outputs="1"> |
199 | | - <param name="text" value="test.txt" ftype="txt"/> |
| 227 | + <param name="text" value="test.txt"/> |
200 | 228 | <param name="stopwords" value="stopwords.txt"/> |
201 | 229 | <conditional name="fonts"> |
202 | | - <param name="fonts_selector" value="cached" /> |
203 | | - <param name="fonts_select" value="test_font"/> |
204 | | - </conditional> |
205 | | - <param name="min_font_size" value="4"/> |
206 | | - <param name="max_font_size" value="100"/> |
207 | | - <param name="font_step" value="1"/> |
208 | | - <param name="min_word_length" value="0"/> |
209 | | - <param name="max_words" value="200"/> |
210 | | - <param name="width" value="800"/> |
211 | | - <param name="height" value="600"/> |
212 | | - <param name="margin" value="0"/> |
213 | | - <param name="background" value="#ffffff"/> |
214 | | - <param name="mask" value="mask.png"/> |
215 | | - <conditional name="color_choice"> |
216 | | - <param name="color_option" value="color"/> |
217 | | - <param name="color" value="#1f4068"/> |
| 230 | + <param name="fonts_selector" value="cached"/> |
| 231 | + <param name="fonts_select" value="Test Font"/> |
218 | 232 | </conditional> |
219 | | - <param name="colormap" value="viridis"/> |
220 | | - <param name="mode" value="RGB"/> |
221 | | - <param name="contour_width" value="8"/> |
222 | | - <param name="contour_color" value="#1f4068"/> |
223 | | - <param name="prefer_horizontal" value="0.9"/> |
224 | | - <param name="scale" value="1.0"/> |
225 | | - <param name="relative_scaling" value="0.0"/> |
226 | | - <param name="no_collocations" value="True"/> |
227 | | - <param name="include_numbers" value="False"/> |
228 | | - <param name="no_normalize_plurals" value="True"/> |
229 | | - <param name="repeat" value="True"/> |
230 | | - <param name="random_state" value="10"/> |
231 | | - <output name="output" file="output_2.png" compare="image_diff" /> |
| 233 | + <output name="output" file="output1.png" ftype="png"/> |
232 | 234 | </test> |
| 235 | + |
233 | 236 | <test expect_num_outputs="1"> |
234 | | - <param name="text" value="test.txt" ftype="txt"/> |
| 237 | + <param name="text" value="test.txt"/> |
235 | 238 | <param name="stopwords" value="stopwords.txt"/> |
236 | 239 | <conditional name="fonts"> |
237 | | - <param name="fonts_selector" value="history" /> |
| 240 | + <param name="fonts_selector" value="history"/> |
238 | 241 | <param name="fontfile" value="font.ttf"/> |
239 | 242 | </conditional> |
240 | | - <param name="min_font_size" value="4"/> |
241 | | - <param name="max_font_size" value="100"/> |
242 | | - <param name="font_step" value="1"/> |
243 | | - <param name="min_word_length" value="0"/> |
244 | | - <param name="max_words" value="200"/> |
245 | | - <param name="width" value="800"/> |
246 | | - <param name="height" value="600"/> |
247 | | - <param name="margin" value="0"/> |
248 | | - <param name="background" value="#ffffff"/> |
249 | | - <param name="mask" value="mask.png"/> |
| 243 | + <output name="output" file="output1.png" ftype="png"/> |
| 244 | + </test> |
| 245 | + |
| 246 | + <test expect_num_outputs="1"> |
| 247 | + <param name="text" value="test.txt"/> |
| 248 | + <param name="stopwords" value="stopwords.txt"/> |
| 249 | + <conditional name="background_options"> |
| 250 | + <param name="mode" value="RGB"/> |
| 251 | + <param name="background_color" value="#9141ac"/> |
| 252 | + <conditional name="cloud_shape"> |
| 253 | + <param name="cloud_shape_options" value="mask"/> |
| 254 | + <param name="mask" value="mask.png"/> |
| 255 | + <param name="contour_width" value="1.8"/> |
| 256 | + <param name="contour_color" value="#e01b24"/> |
| 257 | + </conditional> |
| 258 | + </conditional> |
| 259 | + <output name="output" file="output2.png" ftype="png"/> |
| 260 | + </test> |
| 261 | + |
| 262 | + <test expect_num_outputs="1"> |
| 263 | + <param name="text" value="test.txt"/> |
| 264 | + <param name="stopwords" value="stopwords.txt"/> |
| 265 | + <param name="include_numbers" value="true"/> |
| 266 | + <param name="no_normalize_plurals" value="false"/> |
| 267 | + <param name="repeat" value="false"/> |
| 268 | + <param name="random_state" value="10"/> |
250 | 269 | <conditional name="color_choice"> |
251 | 270 | <param name="color_option" value="color"/> |
252 | | - <param name="color" value="#1f4068"/> |
| 271 | + <param name="color" value="#99c1f1"/> |
253 | 272 | </conditional> |
254 | | - <param name="colormap" value="viridis"/> |
255 | | - <param name="mode" value="RGB"/> |
256 | | - <param name="contour_width" value="8"/> |
257 | | - <param name="contour_color" value="#1f4068"/> |
258 | | - <param name="prefer_horizontal" value="0.9"/> |
259 | | - <param name="scale" value="1.0"/> |
260 | | - <param name="relative_scaling" value="0.0"/> |
261 | | - <param name="no_collocations" value="True"/> |
262 | | - <param name="include_numbers" value="False"/> |
263 | | - <param name="no_normalize_plurals" value="True"/> |
264 | | - <param name="repeat" value="True"/> |
265 | | - <param name="random_state" value="10"/> |
266 | | - <output name="output" file="output_2.png" compare="image_diff" /> |
| 273 | + <conditional name="background_options"> |
| 274 | + <param name="mode" value="RGBA"/> |
| 275 | + <conditional name="cloud_shape"> |
| 276 | + <param name="cloud_shape_options" value="rectangle"/> |
| 277 | + </conditional> |
| 278 | + </conditional> |
| 279 | + <output name="output" file="output3.png" ftype="png"/> |
| 280 | + </test> |
| 281 | + |
| 282 | + <test expect_num_outputs="1"> |
| 283 | + <param name="text" value="test.txt"/> |
| 284 | + <param name="stopwords" value="stopwords.txt"/> |
| 285 | + <conditional name="color_choice"> |
| 286 | + <param name="color_option" value="colormask"/> |
| 287 | + <param name="colormask" value="mask.png"/> |
| 288 | + </conditional> |
| 289 | + <output name="output" file="output4.png" ftype="png"/> |
267 | 290 | </test> |
268 | 291 | </tests> |
269 | 292 | <help><![CDATA[ |
|
0 commit comments