Mercurial > repos > imgteam > 2d_simple_filter
changeset 1:dba87c4b32d3 draft
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/2d_simple_filter/ commit 8e0d09b4c4eadfaaf125f4a0ae7dcbd1bee5ee51
author | imgteam |
---|---|
date | Thu, 18 Jul 2019 08:51:58 -0400 |
parents | f264ae82f735 |
children | f70b215d155c |
files | filter.xml filter_image.py test-data/res.tif |
diffstat | 3 files changed, 4 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/filter.xml Sat Feb 09 14:29:13 2019 -0500 +++ b/filter.xml Thu Jul 18 08:51:58 2019 -0400 @@ -1,4 +1,4 @@ -<tool id="ip_filter_standard" name="Filter Image" version="0.0.2"> +<tool id="ip_filter_standard" name="Filter Image" version="0.0.3"> <description>applies a standard filter to an image</description> <requirements> <requirement type="package" version="0.14.2">scikit-image</requirement>
--- a/filter_image.py Sat Feb 09 14:29:13 2019 -0500 +++ b/filter_image.py Thu Jul 18 08:51:58 2019 -0400 @@ -6,6 +6,7 @@ import skimage.filters import skimage.util from skimage.morphology import disk +from skimage import img_as_uint filterOptions = { 'median' : lambda img_raw, radius: skimage.filters.median(img_raw, disk(radius)), @@ -24,11 +25,5 @@ args = parser.parse_args() img_in = skimage.io.imread(args.input_file.name) - res = filterOptions[args.filter_type](img_in, args.radius) - res[res<-1]=-1 - res[res>1]=1 - - with warnings.catch_warnings(): - warnings.simplefilter("ignore") - res = skimage.util.img_as_uint(res) #Attention: precision loss - skimage.io.imsave(args.out_file.name, res, plugin='tifffile') + res = img_as_uint(filterOptions[args.filter_type](img_in, args.radius)) + skimage.io.imsave(args.out_file.name, res, plugin='tifffile')