diff gray_to_color.xml @ 3:bbf1ef17c01b draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
author bgruening
date Mon, 11 May 2020 07:56:38 -0400
parents e5870c434f28
children ad271f78a87a
line wrap: on
line diff
--- a/gray_to_color.xml	Thu Apr 16 05:44:36 2020 -0400
+++ b/gray_to_color.xml	Mon May 11 07:56:38 2020 -0400
@@ -3,56 +3,43 @@
     <macros>
         <import>macros.xml</import>
         <xml name="rgb">
-            <param name="rgb_red" label="Select the image to be colored red" value="Leave this black" type="text"/>
-            <param name="rgb_red_weight" label="Relative weight for the red image" optional="true" type="float" value="0.8"/>
+            <param name="rgb_red" label="Enter the name of the image to be colored red" value="Leave this black" type="text"/>
+            <param name="rgb_red_weight" label="Relative weight for the red image" optional="true" type="float" min="0.0" max="1.0" value="1.0" />
 
-            <param name="rgb_green" label="Select the image to be colored green" value="Leave this black" type="text"/>
-            <param name="rgb_green_weight" label="Relative weight for the green image" optional="true" type="float" value="1.0" />
+            <param name="rgb_green" label="Enter the name of the image to be colored green" value="Leave this black" type="text"/>
+            <param name="rgb_green_weight" label="Relative weight for the green image" optional="true" type="float" min="0.0" max="1.0" value="1.0" />
 
-            <param name="rgb_blue" label="Select the image to be colored blue" value="Leave this black" type="text"/>
-            <param name="rgb_blue_weight" label="Relative weight for the blue image" optional="true" type="float" value="0.5"/>
-
-            <param name="name_output_image" label="Name the output image" value="ColorImage" type="text"/>      
+            <param name="rgb_blue" label="Enter the name of the image to be colored blue" value="Leave this black" type="text"/>
+            <param name="rgb_blue_weight" label="Relative weight for the blue image" optional="true" type="float" min="0.0" max="1.0" value="1.0" />
         </xml>
         <xml name="cmyk">
-            <param name="cmyk_cyan" label="Select the image to be colored cyan" value="Leave this black" type="text"/>
-            <param name="cmyk_cyan_weight" label="Relative weight for the cyan image" optional="true" type="float" value="0.5"/>
+            <param name="cmyk_cyan" label="Enter the name of the image to be colored cyan" value="Leave this black" type="text"/>
+            <param name="cmyk_cyan_weight" label="Relative weight for the cyan image" optional="true" type="float" min="0.0" max="1.0" value="1.0" />
 
-            <param name="cmyk_magenta" label="Select the image to be colored magenta" value="Leave this black" type="text"/>
-            <param name="rgb_green_weight" label="Relative weight for the green image" optional="true" type="float" value="0.0"/>
+            <param name="cmyk_magenta" label="Enter the name of the image to be colored magenta" value="Leave this black" type="text"/>
+            <param name="rgb_green_weight" label="Relative weight for the green image" optional="true" type="float" min="0.0" max="1.0" value="1.0" />
 
-            <param name="cmyk_yellow" label="Select the image to be colored yellow" value="Leave this black" type="text"/>
-            <param name="cmyk_yellow_weight" label="Relative weight for the yellow image" optional="true" type="float" value="0.0"/>
+            <param name="cmyk_yellow" label="Enter the name of the image to be colored yellow" value="Leave this black" type="text"/>
+            <param name="cmyk_yellow_weight" label="Relative weight for the yellow image" optional="true" type="float" min="0.0" max="1.0" value="1.0" />
 
-            <param name="cmyk_brightness" label="Select the image that determines brightness" value="Leave this black" type="text"/>
-            <param name="cmyk_brightness_weight" label="Relative weight for the brightness image" optional="true" type="float" value="0.5"/>
-
-            <param name="name_output_image" label="Name the output image" value="ColorImage" type="text">
-                <expand macro="text_validator" />
-            </param>  
-          
+            <param name="cmyk_brightness" label="Enter the name of the image that determines brightness" value="Leave this black" type="text"/>
+            <param name="cmyk_brightness_weight" label="Relative weight for the brightness image" optional="true" type="float" min="0.0" max="1.0" value="1.0" />
         </xml>
         <xml name="stack">
-            <param name="name_output_image" label="Name the output image" value="ColorImage" type="text">
-                <expand macro="text_validator" />
-            </param>  
-            <repeat name="rpt_image_name" title="Add another channel">
-                <param name="image_name" type="text" label="Image name" >
+            <repeat name="rpt_image_name" title="another channel" min="1">
+                <param name="image_name" type="text" label="Enter the image name">
                     <expand macro="text_validator" />
                 </param>
             </repeat>
         </xml>
         <xml name="composite">
-            <param name="name_output_image" label="Name the output image" value="ColorImage" type="text">
-                <expand macro="text_validator" />
-            </param>  
-            <repeat name="rpt_image_name" title="Add another channel">
+            <repeat name="rpt_image_name" title="another channel" min="1">
                 <param name="image_name" type="text" label="Image name">
                     <expand macro="text_validator" />
                 </param>
                 <param name="color" type="color" label="Color" />
-                <param name="weight" type="float" label="Weight" value="0.8" min="0.0" max="1.0" />
-            </repeat>      
+                <param name="weight" type="float" label="Weight" value="1.0" min="0.0" max="1.0"/>
+            </repeat>
         </xml>
     </macros>
 
@@ -79,24 +66,18 @@
 
     color_scheme = params['con_color_scheme']['color_scheme']
 
-    rgb_blue = params['con_color_scheme']['rgb_blue'] if 'rgb_blue' in params[
-        'con_color_scheme'] else 'Leave this black'
-    rgb_blue_weight = 1.0 if params['con_color_scheme']['rgb_blue_weight'] == "" else params['con_color_scheme'][
-        'rgb_blue_weight']
+    rgb_blue = params['con_color_scheme']['rgb_blue'] if 'rgb_blue' in params['con_color_scheme'] else 'Leave this black'
+    rgb_blue_weight = 1.0 if params['con_color_scheme']['rgb_blue_weight'] == "" else params['con_color_scheme']['rgb_blue_weight']
 
-    rgb_green = params['con_color_scheme']['rgb_green'] if 'rgb_green' in params[
-        'con_color_scheme'] else 'Leave this black'
-    rgb_green_weight = 1.0 if params['con_color_scheme']['rgb_green_weight'] == "" else params['con_color_scheme'][
-        'rgb_green_weight']
+    rgb_green = params['con_color_scheme']['rgb_green'] if 'rgb_green' in params['con_color_scheme'] else 'Leave this black'
+    rgb_green_weight = 1.0 if params['con_color_scheme']['rgb_green_weight'] == "" else params['con_color_scheme']['rgb_green_weight']
 
     rgb_red = params['con_color_scheme']['rgb_red'] if 'rgb_red' in params['con_color_scheme'] else 'Leave this black'
-    rgb_red_weight = 1.0 if params['con_color_scheme']['rgb_red_weight'] == "" else params['con_color_scheme'][
-        'rgb_red_weight']
+    rgb_red_weight = 1.0 if params['con_color_scheme']['rgb_red_weight'] == "" else params['con_color_scheme']['rgb_red_weight']
 
-    name_output_image = params['con_color_scheme']['name_output_image']
+    name_output_image = params['name_output_image']
 
-    cmyk_cyan = params['con_color_scheme']['cmyk_cyan'] if 'cmyk_cyan' in params[
-        'con_color_scheme'] else 'Leave this black'
+    cmyk_cyan = params['con_color_scheme']['cmyk_cyan'] if 'cmyk_cyan' in params['con_color_scheme'] else 'Leave this black'
 
     if 'cmyk_cyan_weight' in params['con_color_scheme']:
         if params['con_color_scheme']['cmyk_cyan_weight'] == "":
@@ -106,8 +87,7 @@
     else:
         cmyk_cyan_weight = 1.0
 
-    cmyk_magenta = params['con_color_scheme']['cmyk_magenta'] if 'cmyk_magenta' in params[
-        'con_color_scheme'] else 'Leave this black'
+    cmyk_magenta = params['con_color_scheme']['cmyk_magenta'] if 'cmyk_magenta' in params['con_color_scheme'] else 'Leave this black'
 
     if 'cmyk_magenta_weight' in params['con_color_scheme']:
         if params['con_color_scheme']['cmyk_magenta_weight'] == "":
@@ -117,8 +97,7 @@
     else:
         cmyk_magenta_weight = 1.0
 
-    cmyk_yellow = params['con_color_scheme']['cmyk_yellow'] if 'cmyk_yellow' in params[
-        'con_color_scheme'] else 'Leave this black'
+    cmyk_yellow = params['con_color_scheme']['cmyk_yellow'] if 'cmyk_yellow' in params['con_color_scheme'] else 'Leave this black'
 
     if 'cmyk_yellow_weight' in params['con_color_scheme']:
         if params['con_color_scheme']['cmyk_yellow_weight'] == "":
@@ -128,8 +107,7 @@
     else:
         cmyk_yellow_weight = 1.0
 
-    cmyk_brightness = params['con_color_scheme']['cmyk_brightness'] if 'cmyk_brightness' in params[
-        'con_color_scheme'] else 'Leave this black'
+    cmyk_brightness = params['con_color_scheme']['cmyk_brightness'] if 'cmyk_brightness' in params['con_color_scheme'] else 'Leave this black'
 
     if 'cmyk_brightness_weight' in params['con_color_scheme']:
         if params['con_color_scheme']['cmyk_brightness_weight'] == "":
@@ -194,18 +172,32 @@
     new_count = module_count + 1
     lines[4] = k + ":%d\n" % new_count
 
-    with open("output", "w") as f:
+    with open("output.cppipe", "w") as f:
         f.writelines(lines)
         f.write(writegtc())
 
-f.close()
-        </configfile>    
+    f.close()
+        </configfile>
     </configfiles>
 
     <inputs>
-        <expand macro="input_pipeline_macro" />
+        <expand macro="input_pipeline_param" />
+        <param name="name_output_image" label="Enter the name of the resulting image" value="ColorImage" type="text">
+
+            <expand macro="text_validator" />
+        </param>
         <conditional name="con_color_scheme">
             <param name="color_scheme" label="Select a color scheme" type="select">
+                <help>
+                    <![CDATA[
+                        This tool can use one of two color schemes to combine images:
+                        <br> - RGB: Each input image determines the intensity of one of the color channels: red, green, and blue.
+                        <br> - CMYK: Three of the input images are combined to determine the colors (cyan, magenta, and yellow) and a fourth is used only for brightness. The cyan image adds equally to the green and blue intensities. The magenta image adds equally to the red and blue intensities. The yellow image adds equally to the red and green intensities.
+                        <br> - Stack: The channels are stacked in the order listed, from top to bottom. An arbitrary number of channels is allowed.
+                        For example, you could create a 5-channel image by providing 5 grayscale images. The first grayscale image you provide will fill the first channel, the second grayscale image you provide will fill the second channel, and so on.
+                        <br> - Composite: A color is assigned to each grayscale image. Each grayscale image is converted to color by multiplying the intensity by the color and the resulting color images are added together. An arbitrary number of channels can be composited into a single color image.
+                        ]]>
+                </help>
                 <option value="RGB">RGB</option>
                 <option value="CMYK">CMYK</option>
                 <option value="Stack">Stack</option>
@@ -227,26 +219,37 @@
     </inputs>
 
     <outputs>
-        <expand macro="output_pipeline_macro" />
+        <expand macro="output_pipeline_param" />
     </outputs>
 
     <tests>
-      <test>
-        <expand macro="test_input_pipeline_param" />
-        <conditional name="con_color_scheme">
-            <param name="color_scheme" value="RGB" />
-            <param name="rgb_red" value="MaskNucleoli" />
-            <param name="rgb_red_weight" value="0.8" />
-            <param name="rgb_green" value="Leave this black" />
-            <param name="rgb_blue" value="MaskNuclei" />
-            <param name="rgb_blue_weight" value="0.5" />
+        <test>
+            <expand macro="test_input_pipeline_param" />
             <param name="name_output_image" value="CombinedMask" />
-        </conditional>
-        <expand macro="test_out_file" file="gray_to_color.txt" />
-      </test>
+            <conditional name="con_color_scheme">
+                <param name="color_scheme" value="RGB" />
+                <param name="rgb_red" value="MaskNucleoli" />
+                <param name="rgb_red_weight" value="0.8" />
+                <param name="rgb_green" value="Leave this black" />
+                <param name="rgb_blue" value="MaskNuclei" />
+                <param name="rgb_blue_weight" value="0.5" />
+            </conditional>
+            <expand macro="test_out_file" file="gray_to_color.cppipe" />
+        </test>
     </tests>
 
-    <expand macro="help" module="GrayToColor" />
+    <help>
+        <![CDATA[
+            .. class:: infomark
+
+            **What it does**
+
+            This tool takes grayscale images as input and assigns them to colors in a red, green, blue (RGB) image or a cyan, magenta, yellow, black (CMYK) image. Each color’s brightness can be adjusted independently by using relative weights.
+
+            @COMMON_HELP@
+            ]]>
+    </help>
+
     <expand macro="citations" />
 
 </tool>