view imagej2_adjust_threshold_binary.xml @ 3:2b007b1e6c1b draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 8f49f3c66b5a1de99ec15e65c2519a56792f1d56
author imgteam
date Wed, 25 Sep 2024 16:06:33 +0000
parents da29019170f1
children
line wrap: on
line source

<tool id="imagej2_adjust_threshold_binary" name="Adjust threshold" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="23.0">
    <description>with ImageJ2</description>
    <macros>
        <import>imagej2_macros.xml</import>
    </macros>
    <edam_operations>
        <edam_operation>operation_3443</edam_operation>
    </edam_operations>
    <xrefs>
        <xref type="bio.tools">imagej</xref>
        <xref type="biii">imagej2</xref>
    </xrefs>
    <expand macro="fiji_requirements"/>
    <command detect_errors="exit_code"><![CDATA[
#import os
#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' &&
ImageJ --ij2 --headless --debug
--jython '$__tool_directory__/imagej2_adjust_threshold_binary_jython_script.py'
'$input_with_ext'
$method_cond.threshold_min
$method_cond.threshold_max
'$method_cond.method'
'$display'
'$method_cond.black_background'
'$output_filename'
'$input.ext'
&& mv '$output_filename' '$output';
]]></command>
    <inputs>
        <expand macro="param_input"/>
        <conditional name="method_cond">
            <param name="auto_method" type="select" label="Use autothreshold or manual">
                <option value="Auto" selected="true">Autothreshold</option>
                <option value="Manual" selected="true">Manual (set min max values)</option>
            </param>
            <when value="Auto">
                <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="Huang2">Huang2</option>
                    <option value="Intermodes">Intermodes</option>
                    <option value="IsoData">IsoData</option>
                    <option value="Li">Li</option>
                    <option value="MaxEntropy">MaxEntropy</option>
                    <option value="Mean">Mean</option>
                    <option value="MinError(I)">MinError(I)</option>
                    <option value="Minimum">Minimum</option>
                    <option value="Moments">Moments</option>
                    <option value="Otsu">Otsu</option>
                    <option value="Percentile">Percentile</option>
                    <option value="RenyiEntropy">RenyiEntropy</option>
                    <option value="Shanbhag">Shanbhag</option>
                    <option value="Triangle">Triangle</option>
                    <option value="Yen">Yen</option>
                </param>
                <expand macro="black_background_param"/>
                <param type="hidden" name="threshold_min" value="0.0"/>
                <param type="hidden" name="threshold_max" value="255.0"/>
            </when>
            <when value="Manual">
                <param type="hidden" name="method" value="Manual"/>
                <param type="hidden" name="black_background" value="yes"/>
                <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"/>
            </when>
        </conditional>
        <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>
    </inputs>
    <outputs>
        <data name="output" format_source="input"/>
    </outputs>
    <tests>
        <test>
            <param name="input" value="blobs.gif"/>
            <conditional name="method_cond">
                <param name="method" value="Default"/>
                <param name="black_background" value="no"/>
            </conditional>
            <param name="display" value="red"/>
            <output name="output" file="blobs_threshold_default.gif" compare="image_diff" metric="iou"/>
        </test>
        <test>
            <param name="input" value="blobs.gif"/>
            <conditional name="method_cond">
                <param name="method" value="Percentile"/>
                <param name="black_background" value="no"/>
            </conditional>
            <param name="display" value="over_under"/>
            <output name="output" file="blobs_threshold_percentile.gif" compare="image_diff" metric="iou"/>
        </test>
        <test>
            <param name="input" value="blobs.gif"/>
            <conditional name="method_cond">
                <param name="method" value="Huang"/>
                <param name="black_background" value="yes"/>
            </conditional>
            <param name="display" value="bw"/>
            <output name="output" file="blobs_threshold_huang_dark.gif" compare="image_diff" metric="iou"/>
        </test>
        <test>
            <param name="input" value="blobs.gif"/>
            <conditional name="method_cond">
                <param name="auto_method" value="Manual"/>
                <param name="threshold_min" value="8"/>
                <param name="threshold_max" value="255"/>
            </conditional>
            <param name="display" value="bw"/>
            <output name="output" file="blobs_threshold_8-255.gif" compare="image_diff" metric="iou"/>
        </test>
        <test>
            <param name="input" value="blobs.gif"/>
            <conditional name="method_cond">
                <param name="auto_method" value="Manual"/>
                <param name="threshold_min" value="0"/>
                <param name="threshold_max" value="8"/>
            </conditional>
            <param name="display" value="bw"/>
            <output name="output" file="blobs_threshold_0-8.gif" compare="image_diff" metric="iou"/>
        </test>
        <test>
            <param name="input" value="confocal-series-first-channel.tif"/>
            <conditional name="method_cond">
                <param name="method" value="Default"/>
                <param name="black_background" value="yes"/>
            </conditional>
            <param name="display" value="bw"/>
            <output name="output" file="confocal-series-first-channel_threshold_default.tiff" 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 17 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.
]]>

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