view scale_image.xml @ 5:85666e555698 draft default tip

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/scale_image/ commit c86a1b93cb7732f7331a981d13465653cc1a2790
author imgteam
date Wed, 24 Apr 2024 08:13:13 +0000
parents 3179853faae9
children
line wrap: on
line source

<tool id="ip_scale_image" name="Scale image" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.05"> 
    <description>with scikit-image</description>
    <macros>
        <import>creators.xml</import>
        <import>tests.xml</import>
        <token name="@TOOL_VERSION@">0.18.3</token>
        <token name="@VERSION_SUFFIX@">1</token>
    </macros>
    <creator>
        <expand macro="creators/bmcv" />
    </creator>
    <edam_operations>
        <edam_operation>operation_3443</edam_operation>
    </edam_operations>
    <xrefs>
        <xref type="bio.tools">scikit-image</xref>
        <xref type="biii">scikit-image</xref>
    </xrefs>
    <requirements>
        <requirement type="package" version="@TOOL_VERSION@">scikit-image</requirement>
        <requirement type="package" version="10.0.1">pillow</requirement>
        <requirement type="package" version="1.24.4">numpy</requirement>
        <requirement type="package" version="2021.7.2">tifffile</requirement>
        <requirement type="package" version="0.1">giatools</requirement>
    </requirements> 
    <command detect_errors="aggressive"><![CDATA[

        python '$__tool_directory__/scale_image.py' '$input'

        ./output.${input.ext}

        --scale '$scale'
        --order  $order
        $antialias

        && mv ./output.${input.ext} ./output

    ]]></command>
    <inputs>
        <param name="input" type="data" format="png" label="Image file"/>
        <param argument="--scale" type="text" value="1" label="Scaling factor" help="Use either a single scaling factor (uniform scaling), or a comma-separated list of scaling factors (anistropic scaling). For a 2-D single-channel or RGB image, the first scaling factor corresponds to the image width and the second corresponds to the image height. For images with 3 or more axes, the last axis is assumed to correspond to the image channels if uniform scaling is used (a single value)."/>
        <param argument="--order" type="select" label="Interpolation method">
            <option value="0">Nearest-neighbor</option>
            <option value="1" selected="true">Bi-linear</option>
            <option value="2">Bi-cubic</option>
        </param>
        <param name="antialias" type="boolean" truevalue="--antialias" falsevalue="" checked="true" label="Enable anti-aliasing" help="This should only be used for down-scaling."/>
    </inputs>
    <outputs>
        <data name="output" from_work_dir="output" format_source="input" metadata_source="input"/>
    </outputs>
    <tests>
        <!-- Test PNG, without antialias -->
        <test>
            <param name="input" value="input1_binary_rgb.png"/>
            <param name="scale" value="0.5"/>
            <param name="antialias" value="false"/>
            <param name="order" value="0"/>
            <expand macro="tests/binary_image_diff" name="output" value="uniform_binary.png" ftype="png"/>
        </test>
        <!-- Test PNG, uniform scaling -->
        <test>
            <param name="input" value="input1_binary_rgb.png"/>
            <param name="scale" value="0.5"/>
            <expand macro="tests/intensity_image_diff" name="output" value="uniform.png" ftype="png"/>
        </test>
        <!-- Test PNG, anistropic scaling -->
        <test>
            <param name="input" value="input1_binary_rgb.png"/>
            <param name="scale" value="0.5, 0.8"/>
            <expand macro="tests/intensity_image_diff" name="output" value="anisotropic.png" ftype="png"/>
        </test>
        <test>
            <param name="input" value="input1_binary_rgb.png"/>
            <param name="scale" value="0.5, 0.8, 1"/>
            <expand macro="tests/intensity_image_diff" name="output" value="anisotropic.png" ftype="png"/>
        </test>
        <!-- Test TIFF, normalized -->
        <test>
            <param name="input" value="input2_normalized.tiff"/>
            <param name="scale" value="0.5"/>
            <expand macro="tests/intensity_image_diff" name="output" value="normalized.tiff" ftype="tiff"/>
        </test>
        <!-- Test TIFF, not normalized -->
        <test>
            <param name="input" value="input3_not_normalized.tiff"/>
            <param name="scale" value="0.5"/>
            <expand macro="tests/intensity_image_diff" name="output" value="not_normalized.tiff" ftype="tiff"/>
        </test>
    </tests>
    <help>

        **Scales an image using one or more scaling factors.**

        The image is rescaled uniformly along all axes, or anistropically if multiple scale factors are given.

        This operation preserves both the brightness of the image, and the range of values.

    </help>
    <citations>
        <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation>
    </citations>
</tool>