Mercurial > repos > imgteam > morphological_operations
comparison morphological_operations.py @ 2:4e25befab102 draft default tip
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/morphological_operations commit c86a1b93cb7732f7331a981d13465653cc1a2790
| author | imgteam |
|---|---|
| date | Wed, 24 Apr 2024 08:12:39 +0000 |
| parents | f10112b317a1 |
| children |
comparison
equal
deleted
inserted
replaced
| 1:ad795d260ba8 | 2:4e25befab102 |
|---|---|
| 1 import argparse | 1 import argparse |
| 2 | 2 |
| 3 import giatools.io | |
| 3 import numpy as np | 4 import numpy as np |
| 4 import scipy.ndimage as ndi | 5 import scipy.ndimage as ndi |
| 5 import skimage.io | 6 import skimage.io |
| 6 import skimage.morphology as morph | 7 import skimage.morphology as morph |
| 7 | 8 |
| 74 parser.add_argument('--selem-size', type=int) | 75 parser.add_argument('--selem-size', type=int) |
| 75 parser.add_argument('input', type=str) | 76 parser.add_argument('input', type=str) |
| 76 parser.add_argument('output', type=str) | 77 parser.add_argument('output', type=str) |
| 77 args = parser.parse_args() | 78 args = parser.parse_args() |
| 78 | 79 |
| 79 im = skimage.io.imread(args.input) | 80 im = giatools.io.imread(args.input) |
| 80 assert im.ndim in (2, 3), 'Input image must be two-dimensional and either single-channel or multi-channel.' | 81 assert im.ndim in (2, 3), 'Input image must be two-dimensional and either single-channel or multi-channel.' |
| 81 | 82 |
| 82 if im.ndim == 2: | 83 if im.ndim == 2: |
| 83 im_result = apply_operation(args, im) | 84 im_result = apply_operation(args, im) |
| 84 | 85 |
