view imagej2_analyze_particles_binary.xml @ 1:1dd5396c734a draft default tip

"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:59:30 +0000
parents aeb9bb864b8c
children
line wrap: on
line source

<tool id="imagej2_analyze_particles_binary" name="Analyze particles" 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 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_log = 'output_log.txt'
touch '$output_log' &&
#if str($show) == 'Nothing':
    #set display_results = 'yes'
    #set all_results = 'yes'
    #set output_filename = ''
    #set output_datatype = ''
    #set results_filename = $results
#else:
    #set display_results = $display_results_cond.display_results
    #set all_results = $display_results_cond.all_results
    #set output_filename = '.'.join(['output', $input.ext])
    #set output_datatype = $input.ext
    touch '$output_filename' &&
    #if str($display_results_cond.display_results) == 'yes':
        #set results_filename = $results
    #else:
        #set results_filename = ''
    #end if
#end if
ImageJ --ij2 --headless --debug
--jython '$__tool_directory__/imagej2_analyze_particles_binary_jython_script.py'
'$output_log'
'$input'
'$black_background'
'$size'
$circularity_min
$circularity_max
'$show'
'$display_results'
'$all_results'
'$exclude_edges'
'$include_holes'
'$output_filename'
'$output_datatype'
'$results_filename'
&>'$output_log';
#if str($output_filename) != '':
    if [[ $? -ne 0 ]]; then
        cat '$output_log' >&2;
    else
        mv '$output_filename' '$output';
    fi
#else:
    if [[ $? -ne 0 ]]; then
        cat '$output_log' >&2;
    fi
#end if
]]></command>
    <inputs>
        <expand macro="param_input"/>
        <expand macro="black_background_param"/>
        <param name="size" type="text" value="0-Infinity" label="Size (pixel^2)" help="Enter a single value and particles smaller than that value will be ignored."/>
        <param name="circularity_min" type="float" value="0.0" label="Circularity minimum" help="Values from 0.0 to 1.0, but less than maximum">
            <validator type="in_range" min="0" max="1"/>
        </param>
        <param name="circularity_max" type="float" value="1.0" label="Circularity maximum" help="Values from 0.0 to 1.0, but greater than minimum">
            <validator type="in_range" min="0" max="1"/>
        </param>
        <param name="show" type="select" label="Show" help="Selecting Nothing will display results, but no image.">
            <option value="Outlines" selected="True">Outlines</option>
            <option value="Bare_Outlines">Bare Outlines</option>
            <option value="Ellipses">Ellipses</option>
            <option value="Masks">Masks</option>
            <option value="Count_Masks">Count Masks</option>
            <option value="Nothing">Nothing</option>
        </param>
        <conditional name="display_results_cond">
            <param name="display_results" type="select" label="Display results">
                <option value="no" selected="True">No</option>
                <option value="yes">Yes</option>
            </param>
            <when value="no">
                <param name="all_results" type="hidden" value="no"/>
            </when>
            <when value="yes">
                <param name="all_results" type="select" label="All results?" help="If no, only summary displayed.">
                    <option value="yes" selected="True">Yes</option>
                    <option value="no">No</option>
                </param>
            </when>
        </conditional>
        <param name="exclude_edges" type="select" label="Exclude on edges?">
            <option value="no" selected="True">No</option>
            <option value="yes">Yes</option>
        </param>
        <param name="include_holes" type="select" label="Include holes?">
            <option value="no" selected="True">No</option>
            <option value="yes">Yes</option>
        </param>
    </inputs>
    <outputs>
        <data name="output" format_source="input">
            <filter>show != "Nothing"</filter>
       </data>
        <data format="tabular" name="results" label="${tool.name} (results) on ${on_string}">
            <filter>show == "Nothing" or display_results_cond['display_results'] == "yes"</filter>
        </data>
    </outputs>
    <tests>
        <test>
            <param name="input" value="blobs.gif"/>
            <param name="show" value="Nothing"/>
            <output name="output" file="analyze_particles_nothing.tabular"/>
        </test>
        <test>
            <param name="input" value="blobs.gif"/>
            <param name="show" value="Outlines"/>
            <output name="output" file="analyze_particles_outlines.gif" compare="sim_size"/>
        </test>
        <test>
            <param name="input" value="blobs.gif"/>
            <param name="show" value="Masks"/>
            <param name="exclude_edges" value="yes"/>
            <param name="include_holes" value="yes"/>
            <output name="output" file="analyze_particles_masks.gif" compare="sim_size"/>
        </test>
    </tests>
    <help>
.. class:: warningmark

@requires_binary_input@

**What it does**

<![CDATA[
Counts and measures objects in binary or thresholded images.  It works by scanning the image until
it finds the edge of an object.  It then outlines the object, measures it, fills it to make it
invisible, then resumes scanning until it reaches the end of the image.  Features of thresholded
images can be extracted by specifying suitable **Size** and **Circularity** ranges and/or by choosing
if particles should be traced by their outer edge or by flood filling.

- **Size** - Particles with size (area) outside the range specified in this field are ignored. Values may range between 0 and ‘Infinity’.  Enter a single value and particles smaller than that value will be ignored.
- **Cicularity** - Particles with size circularity values outside the range specified in the min/max fields are also ignored.
- **Show: Nothing** - No image will be generated, but **Display Results** will be set to Yes.  Note that the particle analyzer will display a blank image when the count of detected particles is zero and **Show** is not **Nothing**.
- **Show: Outlines** - Generates an 8-bit image containing numbered outlines of the measured particles (gray levels: Outlines: 0; Labels: 1; Background: 255).
- **Show: Bare Outlines** - Generates an 8-bit image containing simple outlines of the measured particles without labels (graylevels: Outlines: 0; Background: 255).
- **Show: Ellipses** - Generates an 8-bit image containing the best fit ellipse of each measured particle (gray levels: Ellipses: 0; Background: 255).
- **Show: Masks** - Generates an 8-bit image containing filled outlines of the measured particles (gray levels: Masks: 0; Background: 255).
- **Show: Count Masks** - Generates a 16-bit image containing filled outlines of the measured particles painted with a grayscale value corresponding to the particle number.
- **Display Results** - If Yes, the measurements for each particle will be generated.
- **All results** - If No, results will be restricted to the particle count, total particle area, average particle size, and area fraction.
- **Exclude on Edges** - If Yes, particles touching the edge of the image will be ignored.
- **Include Holes** - If Yes, interior holes will be included (set to No to exclude interior holes and to measure particles enclosed by other particles).
]]>

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