<?xml version='1.0' encoding='UTF-8'?>
<tool id="imagej2_watershed_binary" name="Watershed segmentation" version="@WRAPPER_VERSION@.0">
    <description>of binary image</description>
    <macros>
        <import>imagej2_macros.xml</import>
    </macros>
    <expand macro="fiji_requirements" />
    <command>
<![CDATA[
    python $__tool_directory__/imagej2_watershed_binary.py
    --input "$input"
    --input_datatype $input.ext
    --black_background $black_background
    --jython_script $__tool_directory__/imagej2_watershed_binary_jython_script.py
    --output_datatype $output.ext
    --output "$output"
]]>
    </command>
    <inputs>
        <param format="bmp,eps,gif,jpg,pcx,pgm,png,psd,tiff" name="input" type="data" label="Select image"/>
        <expand macro="black_background_param" />
    </inputs>
    <outputs>
        <data name="output" format_source="input" label="${tool.name} on ${on_string}" />
    </outputs>
    <tests>
        <test>
            <param name="input" value="blobs.gif" />
            <output name="output" file="blobs_watershed_binary.gif" compare="sim_size" />
        </test>
    </tests>
    <help>
.. class:: warningmark

@requires_binary_input@

**What it does**

<![CDATA[
Watershed segmentation is a way of automatically separating or cutting apart particles that touch.
It first calculates the Euclidian distance map (EDM) and finds the ultimate eroded points (UEPs).
It then dilates each of the UEPs (the peaks or local maxima of the EDM) as far as possible — either
until the edge of the particle is reached, or the edge touches a region of another (growing) UEP.
Watershed segmentation works best for smooth convex objects that don’t overlap too much.
]]>

    </help>
    <expand macro="fiji_headless_citations" />
</tool>
