Mercurial > repos > imgteam > concat_channels
comparison concat_channels.py @ 4:2592a29a785e draft default tip
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/concat_channels/ commit c86a1b93cb7732f7331a981d13465653cc1a2790
author | imgteam |
---|---|
date | Wed, 24 Apr 2024 08:12:22 +0000 |
parents | 4c43875c790c |
children |
comparison
equal
deleted
inserted
replaced
3:4c43875c790c | 4:2592a29a785e |
---|---|
1 import argparse | 1 import argparse |
2 | 2 |
3 import giatools.io | |
3 import numpy as np | 4 import numpy as np |
4 import skimage.io | 5 import skimage.io |
5 import skimage.util | 6 import skimage.util |
6 | 7 |
7 | 8 |
8 def concat_channels(input_image_paths, output_image_path, axis, preserve_values): | 9 def concat_channels(input_image_paths, output_image_path, axis, preserve_values): |
9 images = [] | 10 images = [] |
10 for image_path in input_image_paths: | 11 for image_path in input_image_paths: |
11 | 12 |
12 raw_image = skimage.io.imread(image_path) | 13 raw_image = giatools.io.imread(image_path) |
13 if len(raw_image.shape) == 2: | 14 if len(raw_image.shape) == 2: |
14 if axis == 0: | 15 if axis == 0: |
15 raw_image = [raw_image] | 16 raw_image = [raw_image] |
16 else: | 17 else: |
17 raw_image = np.expand_dims(raw_image, 2) | 18 raw_image = np.expand_dims(raw_image, 2) |