Mercurial > repos > imgteam > concat_channels
changeset 2:212627bfb759 draft
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/concat_channels/ commit 2286a6c9da88596349ed9d967c51541409c0a7bf
author | imgteam |
---|---|
date | Mon, 13 Nov 2023 22:10:47 +0000 |
parents | d42501109c05 |
children | 4c43875c790c |
files | concat_channels.py concat_channels.xml |
diffstat | 2 files changed, 13 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/concat_channels.py Mon Jul 22 05:02:26 2019 -0400 +++ b/concat_channels.py Mon Nov 13 22:10:47 2023 +0000 @@ -1,33 +1,33 @@ import argparse -import sys import warnings + import numpy as np import skimage.io import skimage.util + def concat_channels(input_image_paths, output_image_path, axis): images = [] for image_path in input_image_paths: raw_image = skimage.io.imread(image_path) if len(raw_image.shape) == 2: if axis == 0: - raw_image = [raw_image] + raw_image = [raw_image] else: raw_image = np.expand_dims(raw_image, 2) images.append(raw_image) res = np.concatenate(images, axis) with warnings.catch_warnings(): warnings.simplefilter("ignore") - res = skimage.util.img_as_uint(res) #Attention: precision loss + res = skimage.util.img_as_uint(res) # Attention: precision loss skimage.io.imsave(output_image_path, res, plugin='tifffile') + if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('input_files', type=argparse.FileType('r'), nargs='+', help='input file') parser.add_argument('-o', dest='out_file', type=argparse.FileType('w'), help='out file (TIFF)') - parser.add_argument('--axis', dest='axis', type=int, default=0, choices=[0,2], help='concatenation axis') + parser.add_argument('--axis', dest='axis', type=int, default=0, choices=[0, 2], help='concatenation axis') args = parser.parse_args() - # print([x.name for x in args.input_files], args.out_file.name, args.axis) concat_channels([x.name for x in args.input_files], args.out_file.name, args.axis) - # concat_channels(args.input_files, args.out_file, args.axis)
--- a/concat_channels.xml Mon Jul 22 05:02:26 2019 -0400 +++ b/concat_channels.xml Mon Nov 13 22:10:47 2023 +0000 @@ -1,5 +1,11 @@ -<tool id="ip_concat_channels" name="Concatenate images" version="0.2"> +<tool id="ip_concat_channels" name="Concatenate images or channels" version="0.2-2"> <description></description> + <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="0.14.2">scikit-image</requirement> <requirement type="package" version="1.15.4">numpy</requirement>