view overlay_images.xml @ 8:ca362a9bfa20 draft default tip

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit 574caf027453f080a7f86f80eae9775ed1c8afa0
author imgteam
date Mon, 23 Sep 2024 10:26:26 +0000
parents 8dc02c854048
children
line wrap: on
line source

<tool id="ip_overlay_images" name="Overlay images" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.05">
    <description></description>
    <macros>
        <import>creators.xml</import>
        <import>tests.xml</import>
        <token name="@TOOL_VERSION@">0.0.4</token>
        <token name="@VERSION_SUFFIX@">4</token>
    </macros>
    <creator>
        <expand macro="creators/bmcv"/>
        <expand macro="creators/thawn"/>
    </creator>
    <edam_operations>
        <edam_operation>operation_3443</edam_operation>
    </edam_operations>
    <xrefs>
        <xref type="bio.tools">galaxy_image_analysis</xref>
    </xrefs>
    <requirements>
        <requirement type="package" version="0.18.1">scikit-image</requirement> 
        <requirement type="package" version="3.3.4">matplotlib</requirement>
        <requirement type="package" version="2020.10.1">tifffile</requirement>
        <requirement type="package" version="1.21">numpy</requirement>
        <requirement type="package" version="10.4.0">pillow</requirement>
        <requirement type="package" version="0.1">giatools</requirement>
    </requirements>
    <command detect_errors="aggressive">
    <![CDATA[
        python '$__tool_directory__/overlay_images.py'
        '$method_option.im1' '$method_option.im2'
        #if $method_option.method == "seg_contour"
            ./output.png
        #else
            ./output.tif
        #end if
        --method $method_option.method
        #if $method_option.method == "blending"
            --alpha $method_option.alpha
        #elif $method_option.method == "seg_contour"
            --thickness $method_option.thickness
            --color '$method_option.color'
            $method_option.show_label
            --label_color '$method_option.label_color'
        #end if
    ]]>
    </command>
    <inputs>
        <conditional name="method_option">
            <param name="method" type="select" label="Type of the overlay">
                <option value="coloc_vis" selected="True">Colocalization</option>
                <option value="blending">Linear blending</option>
                <option value="seg_contour">Segmentation contours over image</option>
            </param>
            <when value="coloc_vis">
                <param name="im1" type="data" format="tiff,png" label="Image 1 (red channel)" />
                <param name="im2" type="data" format="tiff,png" label="Image 2 (green channel)" />
            </when>
            <when value="blending">
                <param name="im1" type="data" format="tiff,png" label="Image 1" />
                <param name="im2" type="data" format="tiff,png" label="Image 2" />
                <param name="alpha" type="float" value="0.5" min="0.0" max="1.0" label="The weight for blending: result = (1 - weight) * image1 + weight * image2." />
            </when>
            <when value="seg_contour">
                <param name="im1" type="data" format="tiff,png" label="Intensity image" />
                <param name="im2" type="data" format="tiff,png" label="Label map" />
                <param name="thickness" type="integer" value="2" min="1" label="Contour thickness (in pixels)" />
                <param name="color" type="color" value="#ff0000" label="Contour color"/>
                <param argument="--show_label" type="boolean" checked='false' truevalue="--show_label" falsevalue="" label="Show labels" />
                <param name="label_color" type="color" value="#ffff00" label="Label color"/>
            </when>
        </conditional>
    </inputs>
    <outputs>
        <data format="tiff" name="out_tiff" from_work_dir="output.tif" label="${tool.name} on ${on_string} output:tiff">
            <filter>method_option['method'] != 'seg_contour'</filter>
        </data>
        <data format="png" name="out_png" from_work_dir="output.png" label="${tool.name} on ${on_string} output:png">
            <filter>method_option['method'] == 'seg_contour'</filter>
        </data>
    </outputs>
    <tests>
        <test expect_num_outputs="1">
            <param name="im1" value="mask1.tif"/>
            <param name="im2" value="mask1r.tif"/>
            <param name="method" value="coloc_vis"/>
            <expand macro="tests/intensity_image_diff" name="out_tiff" value="test1.tif" ftype="tiff"/>
        </test>
        <test expect_num_outputs="1">
            <param name="im1" value="mask1.tif"/>
            <param name="im2" value="mask1r.tif"/>
            <param name="method" value="blending"/>
            <param name="alpha" value="0.3"/>
            <expand macro="tests/intensity_image_diff" name="out_tiff" value="test2.tif" ftype="tiff"/>
        </test>
        <test expect_num_outputs="1">
            <param name="im1" value="sample1_uint8.tif"/>
            <param name="im2" value="mask1.tif"/>
            <param name="method" value="seg_contour"/>
            <param name="thickness" value="2"/>
            <param name="color" value="#ff0000"/>
            <param name="show_label" value="--show_label"/>
            <expand macro="tests/intensity_image_diff" name="out_png" value="test3.png" ftype="png"/>
        </test>
        <test expect_num_outputs="1"><!-- segmentation overlay, 8bit test -->
            <param name="im1" value="sample1_uint8.tif"/>
            <param name="im2" value="mask2.tif"/>
            <param name="method" value="seg_contour"/>
            <param name="thickness" value="2"/>
            <param name="color" value="#ff0000"/>
            <expand macro="tests/intensity_image_diff" name="out_png" value="test4.png" ftype="png"/>
        </test>
        <test expect_num_outputs="1"><!-- segmentation overlay, 16bit test -->
            <param name="im1" value="sample1_uint16.tif"/>
            <param name="im2" value="mask2.tif"/>
            <param name="method" value="seg_contour"/>
            <param name="thickness" value="2"/>
            <param name="color" value="#ff0000"/>
            <expand macro="tests/intensity_image_diff" name="out_png" value="test4.png" ftype="png" eps="1"/>
        </test>
        <test expect_num_outputs="1"><!-- segmentation overlay, 8bit RGB test -->
            <param name="im1" value="sample1_uint8_rgb.png"/>
            <param name="im2" value="mask2.tif"/>
            <param name="method" value="seg_contour"/>
            <param name="thickness" value="2"/>
            <param name="color" value="#ff0000"/>
            <expand macro="tests/intensity_image_diff" name="out_png" value="test5.png" ftype="png"/>
        </test>
    </tests>
    <help><![CDATA[

        **Overlays two images for visualization.**

        This tool overlays two image to visualize *linear image blending*, *colocalization*, or *segmentation contours*
        over an intensity image. For *image blending* and *colocalization*, the input images must be single-channel 2-D
        images. For *segmentation contours*, the intensity must be a 2-D single-channel or 2-D RGB image.

    ]]></help>
    <citations>
        <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation>
    </citations>
</tool>