summaryrefslogtreecommitdiff
path: root/silx/image/medianfilter.py
diff options
context:
space:
mode:
authorAlexandre Marie <alexandre.marie@synchrotron-soleil.fr>2018-12-17 12:28:45 +0100
committerAlexandre Marie <alexandre.marie@synchrotron-soleil.fr>2018-12-17 12:28:45 +0100
commitc49572a2e90b398e90a43f86b490f27ee6c58de6 (patch)
treed130cf7dfc3cf73157e1bece8173331bb4bc7156 /silx/image/medianfilter.py
parent0bbc8ab933e62c1fa6d548e879ae6d98cbd461f1 (diff)
parentcebdc9244c019224846cb8d2668080fe386a6adc (diff)
Merge tag 'upstream/0.9.0+dfsg'
Upstream version 0.9.0+dfsg
Diffstat (limited to 'silx/image/medianfilter.py')
-rw-r--r--silx/image/medianfilter.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/silx/image/medianfilter.py b/silx/image/medianfilter.py
index a986b4d..5d98b48 100644
--- a/silx/image/medianfilter.py
+++ b/silx/image/medianfilter.py
@@ -1,6 +1,6 @@
# coding: utf-8
# /*##########################################################################
-# Copyright (C) 2017 European Synchrotron Radiation Facility
+# Copyright (C) 2017-2018 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -31,12 +31,15 @@ __authors__ = ["H. Payno"]
__license__ = "MIT"
__date__ = "04/05/2017"
+
+import logging
+
from silx.math import medianfilter as medianfilter_cpp
-try:
+from silx.opencl import ocl as _ocl
+if _ocl is not None:
from silx.opencl import medfilt as medfilt_opencl
-except ImportError:
+else: # No OpenCL device or pyopencl not installed
medfilt_opencl = None
-import logging
_logger = logging.getLogger(__name__)
@@ -84,7 +87,7 @@ def medfilt2d(image, kernel_size=3, engine='cpp'):
conditional=False)
elif engine == 'opencl':
if medfilt_opencl is None:
- wrn = 'opencl median filter module import failed'
+ wrn = 'opencl median filter not available. '
wrn += 'Launching cpp implementation.'
_logger.warning(wrn)
# instead call the cpp implementation