diff imagej2_enhance_contrast.xml @ 1:ef3de3e84817 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:58:37 +0000
parents edfc597fb180
children 056e74fbbf6c
line wrap: on
line diff
--- a/imagej2_enhance_contrast.xml	Tue Sep 17 17:01:04 2019 -0400
+++ b/imagej2_enhance_contrast.xml	Mon Sep 28 16:58:37 2020 +0000
@@ -1,27 +1,40 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<tool id="imagej2_enhance_contrast" name="Enhance contrast" version="@WRAPPER_VERSION@.0">
+<tool id="imagej2_enhance_contrast" name="Enhance contrast" version="@WRAPPER_VERSION@.1">
     <description></description>
     <macros>
         <import>imagej2_macros.xml</import>
     </macros>
-    <expand macro="fiji_requirements" />
-    <command>
-<![CDATA[
-    python $__tool_directory__/imagej2_enhance_contrast.py
-    --input "$input"
-    --input_datatype $input.ext
-    --equalize_histogram $equalize_histogram_cond.equalize_histogram
-    #if $equalize_histogram_cond.equalize_histogram == 'no':
-        --saturated_pixels $equalize_histogram_cond.saturated_pixels
-        --normalize $equalize_histogram_cond.normalize
-    #end if
-    --jython_script $__tool_directory__/imagej2_enhance_contrast_jython_script.py
-    --output_datatype $output.ext
-    --output "$output"
-]]>
-    </command>
+    <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' &&
+ImageJ --ij2 --headless --debug
+--jython '$__tool_directory__/imagej2_enhance_contrast_jython_script.py'
+'$error_log'
+'$input_with_ext'
+'$equalize_histogram_cond.equalize_histogram'
+#if $equalize_histogram_cond.equalize_histogram == 'no':
+    $equalize_histogram_cond.saturated_pixels
+    '$equalize_histogram_cond.normalize'
+#else:
+    'None'
+    'no'
+#end if
+'$output_filename'
+'$input.ext'
+&>'$error_log';
+if [[ $? -ne 0 ]]; then
+    cat '$error_log' >&2;
+else
+    mv '$output_filename' '$output';
+fi
+]]></command>
     <inputs>
-        <param format="bmp,eps,gif,jpg,pcx,pgm,png,psd,tiff" name="input" type="data" label="Select image"/>
+        <expand macro="param_input"/>
         <conditional name="equalize_histogram_cond">
             <param name="equalize_histogram" type="select" label="Equalize histogram?">
                 <option value="no" selected="True">No</option>
@@ -29,7 +42,7 @@
             </param>
             <when value="no">
                 <param name="saturated_pixels" type="float" value="0.3" min="0.0" max="100.0" label="Saturated pixels pct" help="Value is percentage of total number of pixels">
-                    <validator type="in_range" min="0" exclude_min="true" max="100" />
+                    <validator type="in_range" min="0" exclude_min="true" max="100"/>
                 </param>
                 <param name="normalize" type="select" label="Normalize?">
                     <option value="no" selected="True">No</option>
@@ -40,24 +53,24 @@
         </conditional>
     </inputs>
     <outputs>
-        <data name="output" format_source="input" label="${tool.name} on ${on_string}"/>
+        <data name="output" format_source="input"/>
     </outputs>
     <tests>
         <test>
-            <param name="input" value="blobs.gif" />
-            <param name="equalize_histogram" value="yes" />
-            <output name="output" file="blobs_equalize.gif" compare="sim_size" />
+            <param name="input" value="blobs.gif"/>
+            <param name="equalize_histogram" value="yes"/>
+            <output name="output" file="blobs_equalize.gif" compare="sim_size"/>
         </test>
         <test>
-            <param name="input" value="blobs.gif" />
-            <param name="saturated_pixels" value="6.2" />
-            <output name="output" file="blobs_saturate.gif" compare="sim_size" />
+            <param name="input" value="blobs.gif"/>
+            <param name="saturated_pixels" value="6.2"/>
+            <output name="output" file="blobs_saturate.gif" compare="sim_size"/>
         </test>
         <test>
-            <param name="input" value="blobs.gif" />
-            <param name="saturated_pixels" value="13.0" />
-            <param name="normalize" value="yes" />
-            <output name="output" file="blobs_normalize.gif" compare="sim_size" />
+            <param name="input" value="blobs.gif"/>
+            <param name="saturated_pixels" value="13.0"/>
+            <param name="normalize" value="yes"/>
+            <output name="output" file="blobs_normalize.gif" compare="sim_size"/>
         </test>
     </tests>
     <help>
@@ -89,5 +102,5 @@
 ]]>
 
     </help>
-    <expand macro="fiji_headless_citations" />
+    <expand macro="fiji_headless_citations"/>
 </tool>