Mercurial > repos > imgteam > imagej2_enhance_contrast
view imagej2_enhance_contrast.xml @ 2:056e74fbbf6c draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
author | imgteam |
---|---|
date | Sun, 05 Nov 2023 14:25:00 +0000 |
parents | ef3de3e84817 |
children | 1f92b1da556b |
line wrap: on
line source
<tool id="imagej2_enhance_contrast" name="Enhance contrast" version="@WRAPPER_VERSION@.2"> <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 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> <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> <option value="yes">Yes</option> </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"/> </param> <param name="normalize" type="select" label="Normalize?"> <option value="no" selected="True">No</option> <option value="yes">Yes</option> </param> </when> <when value="yes"/> </conditional> </inputs> <outputs> <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"/> </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"/> </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"/> </test> </tests> <help> **What it does** <![CDATA[ Enhances image contrast by using either normalization (contrast stretching) or histogram equalization. Normalization (i.e., contrast stretching) attempts to improve the contrast in an image by stretching the range of intensity values it contains to span a desired range of values (e.g. the the full range of pixel values that the image type allows). It differs from the more sophisticated histogram equalization in that it can only apply a linear scaling function to the image pixel values. As a result the enhancement is less harsh. Histogram equalization provides a sophisticated method for modifying the dynamic range and contrast of an image by altering the image such that its intensity histogram has a desired shape. Unlike contrast stretching, histogram modeling operators may employ non-linear and non-monotonic transfer functions to map between pixel intensity values in the input and output images. Histogram equalization re-assigns the intensity values of pixels in the input image such that the output image contains a uniform distribution of intensities (i.e. a flat histogram). - **Equalize histogram** - Enhances the image using histogram equalization. Choosing this option eliminates the "Saturated pixels pct" and "Normalize" options. - **Saturated pixels pct** - Determines the number of pixels in the image that are allowed to become saturated. Increasing this value increases contrast. This value should be greater than zero to prevent a few outlying pixels from causing the histogram stretch to not work as intended. - **Normalize** - Recalculates the pixel values of the image so the range is equal to the maximum range for the data type, or 0-1.0 for float images. The maximum range is 0-255 for 8-bit images and 0-65535 for 16-bit images. Normalization of RGB images is not supported, so selecting "yes" is ignored for this image type. ]]> </help> <expand macro="fiji_headless_citations"/> </tool>