<?xml version='1.0' encoding='UTF-8'?>
<macros>
    <token name="@WRAPPER_VERSION@">1.0</token>
    <xml name="fiji_requirements">
        <requirements>
            <requirement type="package" version="20141125">fiji</requirement>
        </requirements>
    </xml>
    <xml name="stdio">
        <stdio>
            <exit_code range="1:"/>
            <exit_code range=":-1"/>
            <regex match="Error:"/>
            <regex match="Exception:"/>
        </stdio>
    </xml>
    <xml name="image_type">
        <param name="image_type" type="select" label="Image type">
            <option value="8-bit_white" selected="True">8-bit white</option>
            <option value="8-bit_black">8-bit black</option>
            <option value="8-bit_random">8-bit random</option>
            <option value="8-bit_ramp">8-bit ramp</option>
            <option value="16-bit_white">16-bit white</option>
            <option value="16-bit_black">16-bit black</option>
            <option value="16-bit_random">16-bit random</option>
            <option value="16-bit_ramp">16-bit ramp</option>
            <option value="32-bit_white">32-bit white</option>
            <option value="32-bit_black">32-bit black</option>
            <option value="32-bit_random">32-bit random</option>
            <option value="32-bit_ramp">32-bit ramp</option>
            <option value="RGB_white">RGB white</option>
            <option value="RGB_black">RGB black</option>
            <option value="RGB_random">RGB random</option>
            <option value="RGB_ramp">RGB ramp</option>
        </param>
    </xml>
    <xml name="make_binary_params">
        <param name="iterations" type="integer" value="1" min="1" max="100" label="Iterations" help="The number of times (1-100) erosion, dilation, opening, and closing are performed."/>
        <param name="count" type="integer" value="1" min="1" max="8" label="Count" help="The number of adjacent background pixels necessary (1-8) for erosion or dilation."/>
        <param name="black_background" type="select" label="Black background" help="If Yes, the background is black and the foreground is white (no implies the opposite).">
            <option value="no" selected="True">No</option>
            <option value="yes">Yes</option>
        </param>
        <param name="pad_edges_when_eroding" type="select" label="Pad edges when eroding" help="If Yes, eroding does not erode from the edges of the image.">
            <option value="no" selected="True">No</option>
            <option value="yes">Yes</option>
        </param>
    </xml>
    <xml name="black_background_param">
        <param name="black_background" type="select" label="Black background" help="If Yes, the background is black and the foreground is white (no implies the opposite).">
            <option value="no" selected="True">No</option>
            <option value="yes">Yes</option>
        </param>
    </xml>
    <token name="@make_binary_args@">
        --iterations $iterations
        --count $count
        --black_background $black_background
        --pad_edges_when_eroding $pad_edges_when_eroding
    </token>
    <token name="@requires_binary_input@">
.. class:: warningmark

This tool works on binary images, so other image types will automatically be converted to binary
before they are analyzed.  This step is performed using the ImageJ2 **Make Binary** command with
the following settings: **Iterations:** 1, **Count:** 1, **Pad edges when eroding:** No.  The tool
allows you to choose the **Black background** setting.  If these settings are not appropriate,
first manually convert the image to binary using the **Convert to binary (black and white)**
tool, which allows you to change them.
    </token>
    <xml name="image_datatypes">
        <option value="bmp">bmp</option>
        <option value="gif">gif</option>
        <option value="jpg">jpg</option>
        <option value="png" selected="true">png</option>
        <option value="tiff">tiff</option>
    </xml>
    <xml name="bunwarpj_citations">
        <citations>
            <citation type="bibtex">
                @InProceedings(Arganda-Carreras2006,
                    author =     "Ignacio Arganda-Carreras and
                                        Carlos Oscar S{\'a}nchez Sorzano and
                                        Roberto Marabini and
                                        Jos{\'e} Mar\'{\i}a Carazo and
                                        Carlos Ortiz-de-Solorzano and
                                        Jan Kybic",
                    title =          "Consistent and Elastic Registration of Histological Sections Using Vector-Spline Regularization",    
                    publisher =  "Springer Berlin / Heidelberg",    
                    booktitle =   "Computer Vision Approaches to Medical Image Analysis",
                    series =       "Lecture Notes in Computer Science",
                    year =          "2006",
                    volume =      "4241",
                    pages =       "85-95",
                    month =       "May",
                    city =            "Graz, Austria")
            </citation>
            <citation type="doi">10.1038/nmeth.2019</citation>
        </citations>
    </xml>
    <xml name="fiji_headless_citations">
        <citations>
            <citation type="doi">10.1038/nmeth.2102</citation>
        </citations>
    </xml>
</macros>
