From bf4709155d3c64d26553eb6614e496083af2cb22 Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Thu, 17 Jan 2013 11:11:21 +0700 Subject: [PATCH 1/4] PKG: MSVC build fixes by Christoph Gohlke. --- skimage/draw/setup.py | 2 +- skimage/filter/rank/_crank16.pyx | 4 ++-- skimage/filter/rank/_crank8.pyx | 4 ++-- skimage/filter/setup.py | 20 ++++++++++---------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/skimage/draw/setup.py b/skimage/draw/setup.py index 5b8e237d..1414fca8 100644 --- a/skimage/draw/setup.py +++ b/skimage/draw/setup.py @@ -15,7 +15,7 @@ def configuration(parent_package='', top_path=None): cython(['_draw.pyx'], working_path=base_path) config.add_extension('_draw', sources=['_draw.c'], - include_dirs=[get_numpy_include_dirs(), '../shared']) + include_dirs=[get_numpy_include_dirs(), '../_shared']) return config diff --git a/skimage/filter/rank/_crank16.pyx b/skimage/filter/rank/_crank16.pyx index e81bf81f..b7aca483 100644 --- a/skimage/filter/rank/_crank16.pyx +++ b/skimage/filter/rank/_crank16.pyx @@ -5,7 +5,7 @@ import numpy as np cimport numpy as np -from libc.math cimport log2 +from libc.math cimport log from skimage.filter.rank._core16 cimport _core16 @@ -274,7 +274,7 @@ cdef inline np.uint16_t kernel_entropy(Py_ssize_t * histo, float pop, for i in range(maxbin): p = histo[i] / pop if p > 0: - e -= p * log2(p) + e -= p * log(p) / 0.30102999566398119521373889472449 return < np.uint16_t > e * 1000 else: diff --git a/skimage/filter/rank/_crank8.pyx b/skimage/filter/rank/_crank8.pyx index 8bff9703..d7ece4dd 100644 --- a/skimage/filter/rank/_crank8.pyx +++ b/skimage/filter/rank/_crank8.pyx @@ -5,7 +5,7 @@ import numpy as np cimport numpy as np -from libc.math cimport log2 +from libc.math cimport log from skimage.filter.rank._core8 cimport _core8 @@ -279,7 +279,7 @@ cdef inline np.uint8_t kernel_entropy(Py_ssize_t * histo, float pop, for i in range(256): p = histo[i] / pop if p > 0: - e -= p * log2(p) + e -= p * log(p) / 0.30102999566398119521373889472449 return < np.uint8_t > e * 10 else: diff --git a/skimage/filter/setup.py b/skimage/filter/setup.py index 650a26a6..934d3f2e 100644 --- a/skimage/filter/setup.py +++ b/skimage/filter/setup.py @@ -29,31 +29,31 @@ def configuration(parent_package='', top_path=None): include_dirs=[get_numpy_include_dirs()]) config.add_extension('_denoise_cy', sources=['_denoise_cy.c'], include_dirs=[get_numpy_include_dirs(), '../_shared']) - config.add_extension('rank/_core8', sources=['rank/_core8.c'], + config.add_extension('rank._core8', sources=['rank/_core8.c'], include_dirs=[get_numpy_include_dirs()]) - config.add_extension('rank/_core16', sources=['rank/_core16.c'], + config.add_extension('rank._core16', sources=['rank/_core16.c'], include_dirs=[get_numpy_include_dirs()]) - config.add_extension('rank/_crank8', sources=['rank/_crank8.c'], + config.add_extension('rank._crank8', sources=['rank/_crank8.c'], include_dirs=[get_numpy_include_dirs()]) config.add_extension( - 'rank/_crank8_percentiles', sources=['rank/_crank8_percentiles.c'], + 'rank._crank8_percentiles', sources=['rank/_crank8_percentiles.c'], include_dirs=[get_numpy_include_dirs()]) - config.add_extension('rank/_crank16', sources=['rank/_crank16.c'], + config.add_extension('rank._crank16', sources=['rank/_crank16.c'], include_dirs=[get_numpy_include_dirs()]) config.add_extension( - 'rank/_crank16_percentiles', sources=['rank/_crank16_percentiles.c'], + 'rank._crank16_percentiles', sources=['rank/_crank16_percentiles.c'], include_dirs=[get_numpy_include_dirs()]) config.add_extension( - 'rank/_crank16_bilateral', sources=['rank/_crank16_bilateral.c'], + 'rank._crank16_bilateral', sources=['rank/_crank16_bilateral.c'], include_dirs=[get_numpy_include_dirs()]) config.add_extension( - 'rank/rank', sources=['rank/rank.c'], + 'rank.rank', sources=['rank/rank.c'], include_dirs=[get_numpy_include_dirs()]) config.add_extension( - 'rank/percentile_rank', sources=['rank/percentile_rank.c'], + 'rank.percentile_rank', sources=['rank/percentile_rank.c'], include_dirs=[get_numpy_include_dirs()]) config.add_extension( - 'rank/bilateral_rank', sources=['rank/bilateral_rank.c'], + 'rank.bilateral_rank', sources=['rank/bilateral_rank.c'], include_dirs=[get_numpy_include_dirs()]) return config From 27b837b79979957879ebf027323d86f2aedf2327 Mon Sep 17 00:00:00 2001 From: Christoph Gohlke Date: Sun, 24 Feb 2013 08:57:53 -0800 Subject: [PATCH 2/4] Use log(2) instead of log10(2) --- skimage/filter/rank/_crank16.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skimage/filter/rank/_crank16.pyx b/skimage/filter/rank/_crank16.pyx index b7aca483..3c0e5ceb 100644 --- a/skimage/filter/rank/_crank16.pyx +++ b/skimage/filter/rank/_crank16.pyx @@ -274,7 +274,7 @@ cdef inline np.uint16_t kernel_entropy(Py_ssize_t * histo, float pop, for i in range(maxbin): p = histo[i] / pop if p > 0: - e -= p * log(p) / 0.30102999566398119521373889472449 + e -= p * log(p) / 0.6931471805599453 return < np.uint16_t > e * 1000 else: From 2e230c70c0c512b812e0bbd4999c2d77a42cc155 Mon Sep 17 00:00:00 2001 From: Christoph Gohlke Date: Sun, 24 Feb 2013 09:01:09 -0800 Subject: [PATCH 3/4] Use log(2) instead of log10(2) --- skimage/filter/rank/_crank8.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skimage/filter/rank/_crank8.pyx b/skimage/filter/rank/_crank8.pyx index d7ece4dd..c64d78ba 100644 --- a/skimage/filter/rank/_crank8.pyx +++ b/skimage/filter/rank/_crank8.pyx @@ -279,7 +279,7 @@ cdef inline np.uint8_t kernel_entropy(Py_ssize_t * histo, float pop, for i in range(256): p = histo[i] / pop if p > 0: - e -= p * log(p) / 0.30102999566398119521373889472449 + e -= p * log(p) / 0.6931471805599453 return < np.uint8_t > e * 10 else: From a17d8182aabfe10ba4f6629435a2bd11bcf80852 Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Thu, 17 Jan 2013 11:11:21 +0700 Subject: [PATCH 4/4] PKG: MSVC build fixes by Christoph Gohlke. --- skimage/filter/rank/_crank16.pyx | 2 +- skimage/filter/rank/_crank8.pyx | 2 +- skimage/filter/setup.py | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/skimage/filter/rank/_crank16.pyx b/skimage/filter/rank/_crank16.pyx index 87199e80..667c179d 100644 --- a/skimage/filter/rank/_crank16.pyx +++ b/skimage/filter/rank/_crank16.pyx @@ -276,7 +276,7 @@ cdef inline dtype_t kernel_entropy(Py_ssize_t * histo, float pop, for i in range(maxbin): p = histo[i] / pop if p > 0: - e -= p * log2(p) + e -= p * log(p) / 0.30102999566398119521373889472449 return e * 1000 else: diff --git a/skimage/filter/rank/_crank8.pyx b/skimage/filter/rank/_crank8.pyx index c9e8b14f..3e06f319 100644 --- a/skimage/filter/rank/_crank8.pyx +++ b/skimage/filter/rank/_crank8.pyx @@ -281,7 +281,7 @@ cdef inline dtype_t kernel_entropy(Py_ssize_t * histo, float pop, for i in range(256): p = histo[i] / pop if p > 0: - e -= p * log2(p) + e -= p * log(p) / 0.30102999566398119521373889472449 return e * 10 else: diff --git a/skimage/filter/setup.py b/skimage/filter/setup.py index 650a26a6..934d3f2e 100644 --- a/skimage/filter/setup.py +++ b/skimage/filter/setup.py @@ -29,31 +29,31 @@ def configuration(parent_package='', top_path=None): include_dirs=[get_numpy_include_dirs()]) config.add_extension('_denoise_cy', sources=['_denoise_cy.c'], include_dirs=[get_numpy_include_dirs(), '../_shared']) - config.add_extension('rank/_core8', sources=['rank/_core8.c'], + config.add_extension('rank._core8', sources=['rank/_core8.c'], include_dirs=[get_numpy_include_dirs()]) - config.add_extension('rank/_core16', sources=['rank/_core16.c'], + config.add_extension('rank._core16', sources=['rank/_core16.c'], include_dirs=[get_numpy_include_dirs()]) - config.add_extension('rank/_crank8', sources=['rank/_crank8.c'], + config.add_extension('rank._crank8', sources=['rank/_crank8.c'], include_dirs=[get_numpy_include_dirs()]) config.add_extension( - 'rank/_crank8_percentiles', sources=['rank/_crank8_percentiles.c'], + 'rank._crank8_percentiles', sources=['rank/_crank8_percentiles.c'], include_dirs=[get_numpy_include_dirs()]) - config.add_extension('rank/_crank16', sources=['rank/_crank16.c'], + config.add_extension('rank._crank16', sources=['rank/_crank16.c'], include_dirs=[get_numpy_include_dirs()]) config.add_extension( - 'rank/_crank16_percentiles', sources=['rank/_crank16_percentiles.c'], + 'rank._crank16_percentiles', sources=['rank/_crank16_percentiles.c'], include_dirs=[get_numpy_include_dirs()]) config.add_extension( - 'rank/_crank16_bilateral', sources=['rank/_crank16_bilateral.c'], + 'rank._crank16_bilateral', sources=['rank/_crank16_bilateral.c'], include_dirs=[get_numpy_include_dirs()]) config.add_extension( - 'rank/rank', sources=['rank/rank.c'], + 'rank.rank', sources=['rank/rank.c'], include_dirs=[get_numpy_include_dirs()]) config.add_extension( - 'rank/percentile_rank', sources=['rank/percentile_rank.c'], + 'rank.percentile_rank', sources=['rank/percentile_rank.c'], include_dirs=[get_numpy_include_dirs()]) config.add_extension( - 'rank/bilateral_rank', sources=['rank/bilateral_rank.c'], + 'rank.bilateral_rank', sources=['rank/bilateral_rank.c'], include_dirs=[get_numpy_include_dirs()]) return config