Mercurial > repos > thomaswollmann > mergeneighboursinlabelimage
comparison mergeneighboursinlabelimage.py @ 1:3536648d0a93 draft default tip
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/\mergeneighboursinlabelimage commit d93e1dd276027cfc3fb518236110395a23d96f66
author | thomaswollmann |
---|---|
date | Wed, 16 Jan 2019 15:35:29 -0500 |
parents | 66f7e94db2e6 |
children |
comparison
equal
deleted
inserted
replaced
0:66f7e94db2e6 | 1:3536648d0a93 |
---|---|
1 #!/usr/bin/python | |
2 | |
3 import argparse | 1 import argparse |
4 import sys | 2 import sys |
5 import skimage.io | 3 import skimage.io |
6 import skimage.util | 4 import skimage.util |
7 from skimage.measure import regionprops | 5 from skimage.measure import regionprops |
44 | 42 |
45 label_image = skimage.io.imread(args.input_file.name) | 43 label_image = skimage.io.imread(args.input_file.name) |
46 label_image = merge_n(label_image, args.cluster_merge) | 44 label_image = merge_n(label_image, args.cluster_merge) |
47 with warnings.catch_warnings(): | 45 with warnings.catch_warnings(): |
48 warnings.simplefilter("ignore") | 46 warnings.simplefilter("ignore") |
49 res = skimage.util.img_as_uint(res) | 47 res = skimage.util.img_as_uint(label_image) |
50 skimage.io.imsave("tmp.tiff", res) | 48 skimage.io.imsave(args.out_file.name, res, plugin="tifffile") |
51 os.rename("tmp.tiff", args.output_file.name) |