diff 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 diff
--- a/imagej2_adjust_threshold_binary.xml	Sun Nov 05 10:52:33 2023 +0000
+++ b/imagej2_adjust_threshold_binary.xml	Wed Sep 25 16:06:33 2024 +0000
@@ -1,4 +1,4 @@
-<tool id="imagej2_adjust_threshold_binary" name="Adjust threshold" version="@WRAPPER_VERSION@.1">
+<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>
@@ -13,67 +13,66 @@
     <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])
+#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'
+$method_cond.threshold_min
+$method_cond.threshold_max
+'$method_cond.method'
 '$display'
-'$black_background'
-'$stack_histogram'
+'$method_cond.black_background'
 '$output_filename'
 '$input.ext'
-&>'$error_log';
-if [[ $? -ne 0 ]]; then
-    cat '$error_log' >&2;
-else
-    mv '$output_filename' '$output';
-fi
+&& mv '$output_filename' '$output';
 ]]></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>
+        <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>
-        <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"/>
@@ -81,36 +80,59 @@
     <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"/>
+            <conditional name="method_cond">
+                <param name="method" value="Default"/>
+                <param name="black_background" value="no"/>
+            </conditional>
             <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"/>
+            <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"/>
-            <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"/>
+            <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"/>
-            <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"/>
+            <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"/>
-            <param name="black_background" value="yes"/>
-            <param name="stack_histogram" value="no"/>
-            <output name="output" file="blobs_threshold_huang_dark.gif" compare="sim_size"/>
+            <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>
@@ -124,10 +146,9 @@
 
 - **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)."
+- **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.
-- **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>