view imagej2_analyze_particles_binary.xml @ 3:862af85a50ec 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:13:47 +0000
parents ae4ae9c5c56c
children
line wrap: on
line source

<tool id="imagej2_analyze_particles_binary" name="Analyze particles" 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' &&
#if str($show) == 'Nothing':
    #set display_results = 'yes'
    #set output_filename = ''
    #set output_datatype = ''
    #set results_filename = $results
#else:
    #set display_results = $display_results
    #set output_filename = '.'.join(['output', $input.ext])
    #set output_datatype = $input.ext
    touch '$output_filename' &&
    #if str($display_results) == 'yes':
        #set results_filename = $results
    #else:
        #set results_filename = ''
    #end if
#end if
#if str($export_rois) == 'true':
    #set rois_filename = $rois
#else:
    #set rois_filename = ''
#end if
ImageJ --ij2 --headless --debug
--jython '$__tool_directory__/imagej2_analyze_particles_binary_jython_script.py'
'$rois_filename'
'$input'
'$black_background'
'$size'
$circularity_min
$circularity_max
'$show'
'$display_results'
'$exclude_edges'
'$include_holes'
'$output_filename'
'$output_datatype'
'$results_filename'
#if str($output_filename) != '':
    && mv '$output_filename' '$output';
#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="Overlay">Overlay</option>
            <option value="Overlay_Masks">Overlay Masks</option>
            <option value="Nothing">Nothing</option>
        </param>
        <param name="display_results" type="select" label="Display results">
            <option value="no" selected="True">No</option>
            <option value="yes">Yes</option>
        </param>
        <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>
        <param name="export_rois" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Export particles outlines coordinates" help="Exports particles coordinates as a tabular file, which can be imported as ROIs in OMERO." />
    </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 == "yes"</filter>
        </data>
        <data format="tabular" name="rois" label="${tool.name} (particles coordinates) on ${on_string}">
            <filter>export_rois</filter>
        </data>
    </outputs>
    <tests>
        <test expect_num_outputs="1">
            <param name="input" value="blobs.gif"/>
            <param name="show" value="Nothing"/>
            <output name="results" file="analyze_particles_nothing.tabular"/>
        </test>
        <test expect_num_outputs="1">
            <param name="input" value="blobs.gif"/>
            <param name="show" value="Outlines"/>
            <output name="output" file="analyze_particles_outlines.gif" compare="image_diff"/>
        </test>
        <test expect_num_outputs="1">
            <param name="input" value="blobs.gif"/>
            <param name="show" value="Bare_Outlines"/>
            <param name="exclude_edges" value="yes"/>
            <param name="include_holes" value="yes"/>
            <output name="output" file="analyze_particles_bareoutlines.gif" compare="image_diff" metric="iou"/>
        </test>
        <test expect_num_outputs="3">
            <param name="input" value="blobs.gif"/>
            <param name="show" value="Overlay_Masks"/>
            <param name="display_results" value="yes"/>
            <param name="export_rois" value="true"/>
            <output name="output" file="analyze_particles_overlaymasks.gif" compare="image_diff"/>
            <output name="results" file="analyze_particles_nothing.tabular"/>
            <output name="rois" file="analyze_particles_rois.tabular"/>
        </test>
        <test expect_num_outputs="3">
            <param name="input" value="confocal-series-first-channel_threshold_default.tiff"/>
            <param name="black_background" value="yes"/>
            <param name="show" value="Overlay_Masks"/>
            <param name="display_results" value="yes"/>
            <param name="export_rois" value="true"/>
            <output name="output" file="confocal-series-first-channel_threshold_default_overlay_mask.tiff" compare="sim_size"/>
            <output name="results" file="confocal_analyze_particles.tabular"/>
            <output name="rois" file="confocal_analyze_particles_rois.tabular"/>
        </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>