comparison label_to_binary.py @ 0:5da15c3bafed draft default tip

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/label_to_binary/ commit 0a64a49d4a0ac3438544244a8b871be2fc144766
author imgteam
date Wed, 13 Mar 2024 14:55:31 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:5da15c3bafed
1 import argparse
2
3 import numpy as np
4 import skimage.io
5
6
7 if __name__ == '__main__':
8
9 parser = argparse.ArgumentParser()
10 parser.add_argument('input', type=str)
11 parser.add_argument('bg_label', type=int)
12 parser.add_argument('output', type=str)
13 args = parser.parse_args()
14
15 im = skimage.io.imread(args.input)
16 im = (im != args.bg_label)
17 im = (im * 255).astype(np.uint8)
18 skimage.io.imsave(args.output, im)