Mercurial > repos > imgteam > anisotropic_diffusion
changeset 2:e6987afa0484 draft
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/anisotropic-diffusion/ commit 2286a6c9da88596349ed9d967c51541409c0a7bf
author | imgteam |
---|---|
date | Mon, 13 Nov 2023 22:10:29 +0000 |
parents | 17d3cfba9b5a |
children | 097b803aeb5d |
files | anisotropic_diffusion.py anisotropic_diffusion.xml |
diffstat | 2 files changed, 15 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/anisotropic_diffusion.py Mon Jul 22 05:01:04 2019 -0400 +++ b/anisotropic_diffusion.py Mon Nov 13 22:10:29 2023 +0000 @@ -1,7 +1,7 @@ import argparse import sys import warnings -import numpy as np + import skimage.io import skimage.util from medpy.filter.smoothing import anisotropic_diffusion @@ -12,17 +12,17 @@ parser.add_argument('niter', type=int, help='Number of iterations', default=1) parser.add_argument('kappa', type=int, help='Conduction coefficient', default=50) parser.add_argument('gamma', type=float, help='Speed of diffusion', default=0.1) -parser.add_argument('eqoption', type=int, choices=[1,2], help='Perona Malik diffusion equation', default=1) +parser.add_argument('eqoption', type=int, choices=[1, 2], help='Perona Malik diffusion equation', default=1) args = parser.parse_args() - + with warnings.catch_warnings(): - warnings.simplefilter("ignore") #to ignore FutureWarning as well + warnings.simplefilter("ignore") # to ignore FutureWarning as well - img_in = skimage.io.imread(args.input_file.name, plugin='tifffile') - res = anisotropic_diffusion(img_in, niter=args.niter, kappa=args.kappa, gamma=args.gamma, option=args.eqoption) - res[res<-1]=-1 - res[res>1]=1 + img_in = skimage.io.imread(args.input_file.name, plugin='tifffile') + res = anisotropic_diffusion(img_in, niter=args.niter, kappa=args.kappa, gamma=args.gamma, option=args.eqoption) + res[res < -1] = -1 + res[res > +1] = +1 - res = skimage.util.img_as_uint(res) #Attention: precision loss + res = skimage.util.img_as_uint(res) # Attention: precision loss - skimage.io.imsave(args.out_file.name, res, plugin='tifffile') + skimage.io.imsave(args.out_file.name, res, plugin='tifffile')
--- a/anisotropic_diffusion.xml Mon Jul 22 05:01:04 2019 -0400 +++ b/anisotropic_diffusion.xml Mon Nov 13 22:10:29 2023 +0000 @@ -1,5 +1,8 @@ -<tool id="ip_anisotropic_diffusion" name="Anisotropic Diffusion" version="0.2"> - <description>Edge-preserving, Anisotropic diffusion</description> +<tool id="ip_anisotropic_diffusion" name="Apply anisotropic diffusion" version="0.2-2"> + <description>with MedPy</description> + <edam_operations> + <edam_operation>operation_3443</edam_operation> + </edam_operations> <requirements> <requirement type="package" version="0.14.2">scikit-image</requirement> <requirement type="package" version="0.3.0">medpy</requirement>