Mercurial > repos > imgteam > repeat_channels
changeset 0:7cdb50fee601 draft default tip
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/repeat_channels/ commit 60cf803236ef94f414056823688e6fd008b7a1b6
author | imgteam |
---|---|
date | Thu, 25 Apr 2024 10:57:53 +0000 |
parents | |
children | |
files | creators.xml repeat_channels.py repeat_channels.xml test-data/input1.tif test-data/input1_c3.tif tests.xml |
diffstat | 6 files changed, 198 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creators.xml Thu Apr 25 10:57:53 2024 +0000 @@ -0,0 +1,23 @@ +<macros> + + <xml name="creators/bmcv"> + <organization name="Biomedical Computer Vision Group, Heidelberg Universtiy" alternateName="BMCV" url="http://www.bioquant.uni-heidelberg.de/research/groups/biomedical_computer_vision.html" /> + <yield /> + </xml> + + <xml name="creators/alliecreason"> + <person givenName="Allison" familyName="Creason"/> + <yield/> + </xml> + + <xml name="creators/bugraoezdemir"> + <person givenName="Bugra" familyName="Oezdemir"/> + <yield/> + </xml> + + <xml name="creators/thawn"> + <person givenName="Till" familyName="Korten"/> + <yield/> + </xml> + +</macros>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/repeat_channels.py Thu Apr 25 10:57:53 2024 +0000 @@ -0,0 +1,19 @@ +import argparse + +import giatools.io +import numpy as np +import skimage.io + + +if __name__ == '__main__': + + parser = argparse.ArgumentParser() + parser.add_argument('input', type=str) + parser.add_argument('count', type=int) + parser.add_argument('output', type=str) + args = parser.parse_args() + + im = giatools.io.imread(args.input) + im = np.squeeze(im) + im = np.dstack([im] * args.count) + skimage.io.imsave(args.output, im)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/repeat_channels.xml Thu Apr 25 10:57:53 2024 +0000 @@ -0,0 +1,61 @@ +<tool id="repeat_channels" name="Convert single-channel to multi-channel image" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="22.05"> + <description>with NumPy</description> + <macros> + <import>creators.xml</import> + <import>tests.xml</import> + <token name="@TOOL_VERSION@">1.26.4</token> + <token name="@VERSION_SUFFIX@">0</token> + </macros> + <creator> + <expand macro="creators/bmcv"/> + </creator> + <edam_operations> + <edam_operation>operation_3443</edam_operation> + </edam_operations> + <xrefs> + <xref type="bio.tools">galaxy_image_analysis</xref> + </xrefs> + <requirements> + <requirement type="package" version="1.26.4">numpy</requirement> + <requirement type="package" version="0.18.1">scikit-image</requirement> + <requirement type="package" version="0.1">giatools</requirement> + </requirements> + <command><![CDATA[ + + ## Inputs + + python '$__tool_directory__/repeat_channels.py' + '$input' + '$count' + + ## Outputs + + ./output.tif + + ]]> + </command> + <inputs> + <param name="input" type="data" format="tiff,png" label="Input image (single-channel)" /> + <param name="count" type="integer" value="3" min="1" label="Number of channels" /> + </inputs> + <outputs> + <data format="tiff" name="output" from_work_dir="output.tif" /> + </outputs> + <tests> + <test> + <param name="input" value="input1.tif" /> + <param name="count" value="3" /> + <expand macro="tests/intensity_image_diff" name="output" value="input1_c3.tif" ftype="tiff" /> + </test> + </tests> + <help> + + **Convert single-channel to multi-channel image.** + + This tools converts a single-channel image to a multi-channel image by repeating the channel multiple times. + + </help> + <citations> + <citation type="doi">10.1038/s41586-020-2649-2</citation> + </citations> +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests.xml Thu Apr 25 10:57:53 2024 +0000 @@ -0,0 +1,95 @@ +<macros> + + <!-- Macros for verification of image outputs --> + + <xml + name="tests/binary_image_diff" + tokens="name,value,ftype,metric,eps" + token_metric="mae" + token_eps="0.01"> + + <output name="@NAME@" value="@VALUE@" ftype="@FTYPE@" compare="image_diff" metric="@METRIC@" eps="@EPS@" pin_labels="0"> + <assert_contents> + <has_image_n_labels n="2"/> + <yield/> + </assert_contents> + </output> + + </xml> + + <xml + name="tests/label_image_diff" + tokens="name,value,ftype,metric,eps,pin_labels" + token_metric="iou" + token_eps="0.01" + token_pin_labels="0"> + + <output name="@NAME@" value="@VALUE@" ftype="@FTYPE@" compare="image_diff" metric="@METRIC@" eps="@EPS@" pin_labels="@PIN_LABELS@"> + <assert_contents> + <yield/> + </assert_contents> + </output> + + </xml> + + <xml + name="tests/intensity_image_diff" + tokens="name,value,ftype,metric,eps" + token_metric="rms" + token_eps="0.01"> + + <output name="@NAME@" value="@VALUE@" ftype="@FTYPE@" compare="image_diff" metric="@METRIC@" eps="@EPS@"> + <assert_contents> + <yield/> + </assert_contents> + </output> + + </xml> + + <!-- Variants of the above for verification of collection elements --> + + <xml + name="tests/binary_image_diff/element" + tokens="name,value,ftype,metric,eps" + token_metric="mae" + token_eps="0.01"> + + <element name="@NAME@" value="@VALUE@" ftype="@FTYPE@" compare="image_diff" metric="@METRIC@" eps="@EPS@" pin_labels="0"> + <assert_contents> + <has_image_n_labels n="2"/> + <yield/> + </assert_contents> + </element> + + </xml> + + <xml + name="tests/label_image_diff/element" + tokens="name,value,ftype,metric,eps" + token_metric="iou" + token_eps="0.01" + token_pin_labels="0"> + + <element name="@NAME@" value="@VALUE@" ftype="@FTYPE@" compare="image_diff" metric="@METRIC@" eps="@EPS@" pin_labels="@PIN_LABELS@"> + <assert_contents> + <yield/> + </assert_contents> + </element> + + </xml> + + <xml + name="tests/intensity_image_diff/element" + tokens="name,value,ftype,metric,eps" + token_metric="rms" + token_eps="0.01"> + + <element name="@NAME@" value="@VALUE@" ftype="@FTYPE@" compare="image_diff" metric="@METRIC@" eps="@EPS@"> + <assert_contents> + <yield/> + </assert_contents> + </element> + + </xml> + +</macros>