view imagej2_adjust_threshold_binary.xml @ 1:29a4d422f32a draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 2afb24f3c81d625312186750a714d702363012b5"
author imgteam
date Mon, 28 Sep 2020 16:41:15 +0000
parents f1ba33cd9edf
children da29019170f1
line wrap: on
line source

<tool id="imagej2_adjust_threshold_binary" name="Adjust threshold" version="@WRAPPER_VERSION@.0">
    <description>of binary image</description>
    <macros>
        <import>imagej2_macros.xml</import>
    </macros>
    <expand macro="fiji_requirements"/>
    <command detect_errors="exit_code"><![CDATA[
#import os
#set error_log = 'output_log.txt'
#set input_sans_ext = $os.path.splitext($os.path.basename($input.file_name))[0]
#set input_with_ext = '.'.join([input_sans_ext, $input.ext])
ln -s '$input.file_name' '$input_with_ext' &&
#set output_filename = '.'.join(['output', $input.ext])
touch '$output_filename' &&
touch '$error_log' &&
ImageJ --ij2 --headless --debug
--jython '$__tool_directory__/imagej2_adjust_threshold_binary_jython_script.py'
'$error_log'
'$input_with_ext'
$threshold_min
$threshold_max
'$method'
'$display'
'$black_background'
'$stack_histogram'
'$output_filename'
'$input.ext'
&>'$error_log';
if [[ $? -ne 0 ]]; then
    cat '$error_log' >&2;
else
    mv '$output_filename' '$output';
fi
]]></command>
    <inputs>
        <expand macro="param_input"/>
        <param name="threshold_min" type="float" value="0" min="0" max="255" label="Minimum threshold value"/>
        <param name="threshold_max" type="float" value="0" min="0" max="255" label="Maximum threshold value"/>
        <param name="method" type="select" label="Method" help="The Default method is the modified IsoData algorithm.">
            <option value="Default" selected="True">Default</option>
            <option value="Huang">Huang</option>
            <option value="Intermodes">Intermodes</option>
            <option value="IsoData">IsoData</option>
            <option value="IJ_IsoData">IJ_IsoData</option>
            <option value="Li">Li</option>
            <option value="MaxEntropy">MaxEntropy</option>
            <option value="Mean">Mean</option>
            <option value="MinError">MinError</option>
            <option value="Minimum">Minimum</option>
            <option value="Moments">Moments</option>
            <option value="Otsu">Otsu</option>
            <option value="RenyiEntropy">RenyiEntropy</option>
            <option value="Shanbhag">Shanbhag</option>
            <option value="Triangle">Triangle</option>
            <option value="Yen">Yen</option>
        </param>
        <param name="display" type="select" label="Display">
            <option value="red" selected="True">Red</option>
            <option value="bw">Black and White</option>
            <option value="over_under">Over/Under</option>
        </param>
        <param name="black_background" type="select" label="Black background" help="Select yes if features are lighter than the background.">
            <option value="no" selected="True">No</option>
            <option value="yes">Yes</option>
        </param>
        <param name="stack_histogram" type="select" label="Stack histogram" help="Select yes to first compute the histogram of the whole stack (or hyperstack) and then compute the threshold based on that histogram.">
            <option value="no" selected="True">No</option>
            <option value="yes">Yes</option>
        </param>
    </inputs>
    <outputs>
        <data name="output" format_source="input"/>
    </outputs>
    <tests>
        <test>
            <param name="input" value="blobs.gif"/>
            <param name="output_datatype" value="gif"/>
            <param name="threshold_min" value="0.0"/>
            <param name="threshold_max" value="129.0"/>
            <param name="method" value="Default"/>
            <param name="display" value="red"/>
            <param name="black_background" value="no"/>
            <param name="stack_histogram" value="no"/>
            <output name="output" file="blobs_threshold_default.gif" compare="sim_size"/>
        </test>
        <test>
            <param name="input" value="blobs.gif"/>
            <param name="output_datatype" value="gif"/>
            <param name="threshold_min" value="118.0"/>
            <param name="threshold_max" value="255.0"/>
            <param name="method" value="IJ_IsoData"/>
            <param name="display" value="over_under"/>
            <param name="black_background" value="no"/>
            <param name="stack_histogram" value="no"/>
            <output name="output" file="blobs_threshold_ijiso.gif" compare="sim_size"/>
        </test>
        <test>
            <param name="input" value="blobs.gif"/>
            <param name="output_datatype" value="gif"/>
            <param name="threshold_min" value="72.0"/>
            <param name="threshold_max" value="255.0"/>
            <param name="method" value="Huang"/>
            <param name="display" value="bw"/>
            <param name="black_background" value="yes"/>
            <param name="stack_histogram" value="no"/>
            <output name="output" file="blobs_threshold_huang_dark.gif" compare="sim_size"/>
        </test>
    </tests>
    <help>

@requires_binary_input@

**What it does**

<![CDATA[
Sets lower and upper threshold values, segmenting grayscale images into features of interest and background

- **Minimum threshold value** - Adjusts the minimum threshold value.
- **Maximum threshold value** - Adjusts the maximum threshold value.
- **Method** - Allows any of the 16 different automatic thresholding methods to be selected.  These are global thresholding methods that typically cannot deal with unevenly illuminated images (such as in brightfield microscopy)."
- **Display** - Selects one of three display mode:  **Red** displays the thresholded values in red, **Black and White** features are displayed in black and background in white, **Over/Under** displays pixels below the lower threshold value in blue, thresholded pixels in grayscale, and pixels above the upper threshold value in green.
- **Black background** - Select **yes** when features are lighter than the background.
- **Stack histogram**  Select **yes** to first compute the histogram of the whole stack (or hyperstack) and then compute the threshold based on that histogram.  As such, all slices are binarized using the single computed value. If unchecked, the threshold of each slice is computed separately.
]]>

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