Mercurial > repos > thomaswollmann > anisotropic_diffusion
comparison anisotropic_diffusion.py @ 1:6be26440a8ec draft default tip
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/anisotropic-diffusion/ commit d93e1dd276027cfc3fb518236110395a23d96f66
author | thomaswollmann |
---|---|
date | Wed, 16 Jan 2019 15:33:19 -0500 |
parents | 9a30c8f0f651 |
children |
comparison
equal
deleted
inserted
replaced
0:9a30c8f0f651 | 1:6be26440a8ec |
---|---|
13 parser.add_argument('kappa', type=int, help='Conduction coefficient', default=50) | 13 parser.add_argument('kappa', type=int, help='Conduction coefficient', default=50) |
14 parser.add_argument('gamma', type=float, help='Speed of diffusion', default=0.1) | 14 parser.add_argument('gamma', type=float, help='Speed of diffusion', default=0.1) |
15 parser.add_argument('eqoption', type=int, choices=[1,2], help='Perona Malik diffusion equation', default=1) | 15 parser.add_argument('eqoption', type=int, choices=[1,2], help='Perona Malik diffusion equation', default=1) |
16 args = parser.parse_args() | 16 args = parser.parse_args() |
17 | 17 |
18 img_in = skimage.io.imread(args.input_file.name) | 18 with warnings.catch_warnings(): |
19 res = anisotropic_diffusion(img_raw, niter=args.niter, kappa=args.kappa, gamma=args.gamma, option=args.eqoption) | 19 warnings.simplefilter("ignore") #to ignore FutureWarning as well |
20 res[res<-1]=-1 | |
21 res[res>1]=1 | |
22 | 20 |
23 with warnings.catch_warnings(): | 21 img_in = skimage.io.imread(args.input_file.name, plugin='tifffile') |
24 warnings.simplefilter("ignore") | 22 res = anisotropic_diffusion(img_in, niter=args.niter, kappa=args.kappa, gamma=args.gamma, option=args.eqoption) |
23 res[res<-1]=-1 | |
24 res[res>1]=1 | |
25 | |
25 res = skimage.util.img_as_uint(res) #Attention: precision loss | 26 res = skimage.util.img_as_uint(res) #Attention: precision loss |
26 skimage.io.imsave(args.out_file.name, res, plugin='tifffile') | 27 |
28 skimage.io.imsave(args.out_file.name, res, plugin='tifffile') |