view overlay_outlines.xml @ 0:39006f6fd6bf draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
author bgruening
date Sat, 06 Feb 2021 10:06:16 +0000
parents
children 91560258e972
line wrap: on
line source

<tool id="cp_overlay_outlines" name="OverlayOutlines" version="@CP_VERSION@" python_template_version="3.5">
    <description> places outlines of objects over a desired image. </description>
    <macros>
        <import>macros.xml</import>
        <xml name="non_blank">
            <param name="image_to_outline" type="text" label="Enter the name of image on which to display outlines" >
                <help>
                    <![CDATA[
                        Choose the image to serve as the background for the outlines. You can choose from images that were loaded or created by modules previous to this one.
                    ]]>
                </help>
            </param>
            <conditional name="con_display_mode">
                <param name="display_mode" type="select" label="Outline display mode">
                    <help>
                        <![CDATA[
                            Specify how to display the outline contours around your objects.
                            <i>Color:</i> outlines produce a clearer display for images where the cell borders have a high intensity, but take up more space in memory.
                            <i>Grayscale:</i> outlines are displayed with either the highest possible intensity or the same intensity as the brightest pixel in the image. 
                        ]]>
                    </help>
                    <option value="Color">Color</option>
                    <option value="Grayscale">Grayscale</option>
                </param>
                <when value="Color">
                    <repeat name="rpt_obj_to_display" title="Outline" min="1">
                        <param name="obj_to_display" type="text" label="Enter the name of the objects to display" help="Choose the objects whose outlines you would like to display. "/>

                         <param name="outline_color" type="color" label="Select outline color"/>
                    </repeat>
                </when>
                <when value="Grayscale">
                    <param name="method_brightness" type="select" label="Select method to determine brightness of outlines" help="If your image is quite dim, then putting bright white lines onto it may not be useful. It may be preferable to make the outlines equal to the maximal brightness already occurring in the image. ">
                        <option value="Max of image">Max of image</option>
                        <option value="Max possible">Max possible</option>
                    </param>
                    <repeat name="rpt_obj_to_display" title="Outline" min="1">
                        <param name="obj_to_display" type="text" label="Enter the name of the objects to display" help="Choose the objects whose outlines you would like to display. "/>
                    </repeat>
                </when>
            </conditional>
        </xml>

        <xml name="common">
            <param name="name_output_image" type="text" label="Name the output image" />
            <param name="howto_outline" type="select" label="How to outline">
                <help>
                    <![CDATA[
                        Specify how to mark the boundaries around an object:
                        <i>Inner:</i> outline the pixels just inside of objects, leaving background pixels untouched. 
                        <i>Outer:</i> outline pixels in the background around object boundaries. When two objects touch, their boundary is also marked. 
                        <i>Thick:</i> any pixel not completely surrounded by pixels of the same label is marked as a boundary. This results in boundaries that are 2 pixels thick.
                    ]]>
                </help>
                <option value="Inner">Inner</option>
                <option value="Outer">Outer</option>
                <option value="Thick">Thick</option>
            </param>
        </xml>

    </macros>
    <expand macro="py_requirements"/>
    <command detect_errors="exit_code">
        <![CDATA[
            python '$__tool_directory__/overlay_outlines.py' -p '$input_pipeline' -i '$input_json'
            ]]>
    </command>
    <configfiles>
        <inputs name="input_json"/>
    </configfiles>
    <inputs>
        <expand macro="input_pipeline_param"/>
        <conditional name="con_blank_img">
            <param name="blank_img" type="select" label="Display outlines on a blank image?">
                <option value="Yes">Yes</option>
                <option value="No">No</option>
            </param>
            <when value="Yes">  
                <conditional name="con_display_mode">
                    <param name="display_mode" type="select" label="Outline display mode">
                        <help>
                            <![CDATA[
                                Specify how to display the outline contours around your objects.
                                <i>Color:</i> outlines produce a clearer display for images where the cell borders have a high intensity, but take up more space in memory.
                                <i>Grayscale:</i> outlines are displayed with either the highest possible intensity or the same intensity as the brightest pixel in the image. 
                            ]]>
                        </help>
                        <option value="Color">Color</option>
                        <option value="Grayscale">Grayscale</option>
                    </param>
                    <when value="Color">
                        <repeat name="rpt_obj_to_display" title="Outline" min="1">
                            <param name="obj_to_display" type="text" label="Enter the name of the objects to display" help="Choose the objects whose outlines you would like to display. "/>
                            <param name="outline_color" type="color" label="Select outline color"/>
                        </repeat>
                    </when>
                    <when value="Grayscale">
                        <repeat name="rpt_obj_to_display" title="Outline" min="1">
                            <param name="obj_to_display" type="text" label="Enter the name of the objects to display" help="Choose the objects whose outlines you would like to display. "/>
                        </repeat>
                    </when>
                </conditional>
            </when>
            <when value="No">
                <expand macro= "non_blank" />
            </when>
        </conditional>
        <expand macro ="common" />
    </inputs>
    <outputs>
        <expand macro="output_pipeline_param" />
    </outputs>
    <tests>
        <test>
            <param name="input_pipeline" value="common.cppipe"/>
            <conditional name="con_blank_img">
                <param name="blank_img" value="No"/>
                <param name="image_to_outline" value="OrigGray" />
                <conditional name="con_display_mode">
                    <param name="display_mode" value="Color"/>
                    <repeat name="rpt_obj_to_display">
                        <param name="obj_to_display" value = "Embryos" />
                        <param name="outline_color" value="#FF0000"/>
                    </repeat>
                </conditional>
            </conditional>
            <param name="name_output_image" value="OutlineImage" />
            <param name="howto_outline" value="Inner"/>
            <expand macro="test_out_file" file="overlay_outlines_non_blank_color.cppipe" />
        </test>
        <test>
            <param name="input_pipeline" value="common.cppipe"/>
            <conditional name="con_blank_img">
                <param name="blank_img" value="Yes"/>
                <conditional name="con_display_mode">
                    <param name="display_mode" value = "Grayscale"/>
                    <repeat name="rpt_obj_to_display">
                        <param name="obj_to_display" value = "DNA"/>
                    </repeat>
                    <repeat name="rpt_obj_to_display">
                        <param name="obj_to_display" value = "DNA1"/>
                    </repeat>
                </conditional>
            </conditional>
            <param name="name_output_image" value="OutputImage" />
            <param name="howto_outline" value="Outer"/>
            <expand macro="test_out_file" file="overlay_outlines_blank_grayscale.cppipe" />
        </test>
        <test>
            <param name="input_pipeline" value="common.cppipe"/>
            <conditional name="con_blank_img">
                <param name="blank_img" value="Yes"/>
                <conditional name="con_display_mode">
                    <param name="display_mode" value = "Color"/>
                    <repeat name="rpt_obj_to_display">
                        <param name="obj_to_display" value = "DNA1"/>
                        <param name="outline_color" value = "#548dd4"/>
                    </repeat>
                    <repeat name="rpt_obj_to_display">
                        <param name="obj_to_display" value = "DNA3"/>
                        <param name="outline_color" value = "#000000"/>
                    </repeat>
                </conditional>
            </conditional>
            <param name="name_output_image" value="OutputImage" />
            <param name="howto_outline" value="Inner"/>
            <expand macro="test_out_file" file="overlay_outlines_blank_color.cppipe" />
        </test>
        <test>
            <param name="input_pipeline" value="common.cppipe"/>
            <conditional name="con_blank_img">
                <param name="blank_img" value="No"/>   
                    <param name="image_to_outline" value = "DNA1" />
                    <conditional name="con_display_mode">
                        <param name="display_mode" value = "Grayscale" />

                            <param name="method_brightness" value = "Max possible" />
                            <repeat name="rpt_obj_to_display">
                                <param name="obj_to_display" value = "Object1" />
                            </repeat>
                            <repeat name="rpt_obj_to_display">
                                <param name="obj_to_display" value = "Object2" />
                            </repeat>
                    </conditional>
            </conditional>
            <param name="name_output_image" value="OutputImage" />
            <param name="howto_outline" value="Thick"/>
            <expand macro="test_out_file" file="overlay_outlines_non_blank_grayscale.cppipe" />
        </test>
    </tests>
    <help>
        <![CDATA[

            .. class:: infomark

            **What it does**

            This module places outlines of objects on any desired image (grayscale, color, or blank). The resulting image can be saved using the SaveImages module. 

            @COMMON_HELP@
            ]]>
    </help>
    <expand macro="citations"/>
</tool>