Fresh upstream release - includes slicing-error.patch freeimage-fix.patch

This commit is contained in:
Yaroslav Halchenko
2015-03-05 08:41:18 -05:00
parent b6f64f2f79
commit 12ad6e8cbf
4 changed files with 7 additions and 98 deletions
+7
View File
@@ -1,3 +1,10 @@
skimage (0.11.0-1) experimental; urgency=medium
* Fresh upstream release
- includes slicing-error.patch freeimage-fix.patch
-- Yaroslav Halchenko <debian@onerussian.com> Thu, 05 Mar 2015 08:32:02 -0500
skimage (0.10.1-2) unstable; urgency=medium
* build with -fsigned-char to fix test failures on unsigned ports
-77
View File
@@ -1,77 +0,0 @@
Author: Stefan van der Walt <stefan@sun.ac.za>
Description: freeimage: Correctly handle saving uint16 images and fix big endian
Origin: 2b1dde20 051c54c577b3 84f3835106aaeb
Applied-Upstream: 0.11
--- a/skimage/io/_plugins/freeimage_plugin.py
+++ b/skimage/io/_plugins/freeimage_plugin.py
@@ -493,7 +493,6 @@ def _array_from_bitmap(bitmap):
# swizzle the color components and flip the scanlines to go from
# FreeImage's BGR[A] and upside-down internal memory format to something
# more normal
-
def n(arr):
return arr[..., ::-1].T
if len(shape) == 3 and _FI.FreeImage_IsLittleEndian() and \
@@ -637,17 +636,28 @@ def _array_to_bitmap(array):
raise RuntimeError('Could not allocate image for storage')
try:
def n(arr): # normalise to freeimage's in-memory format
- return arr.T[:, ::-1]
+ return arr.T[..., ::-1]
+
wrapped_array = _wrap_bitmap_bits_in_array(bitmap, w_shape, dtype)
# swizzle the color components and flip the scanlines to go to
# FreeImage's BGR[A] and upside-down internal memory format
- if len(shape) == 3 and _FI.FreeImage_IsLittleEndian() and \
- dtype.type == numpy.uint8:
- wrapped_array[0] = n(array[:, :, 2])
- wrapped_array[1] = n(array[:, :, 1])
- wrapped_array[2] = n(array[:, :, 0])
+ if len(shape) == 3 and _FI.FreeImage_IsLittleEndian():
+ R = array[:, :, 0]
+ G = array[:, :, 1]
+ B = array[:, :, 2]
+
+ if dtype.type == numpy.uint8:
+ wrapped_array[0] = n(B)
+ wrapped_array[1] = n(G)
+ wrapped_array[2] = n(R)
+ elif dtype.type == numpy.uint16:
+ wrapped_array[0] = n(R)
+ wrapped_array[1] = n(G)
+ wrapped_array[2] = n(B)
+
if shape[2] == 4:
- wrapped_array[3] = n(array[:, :, 3])
+ A = array[:, :, 3]
+ wrapped_array[3] = n(A)
else:
wrapped_array[:] = n(array)
if len(shape) == 2 and dtype.type == numpy.uint8:
diff --git a/skimage/io/tests/test_freeimage.py b/skimage/io/tests/test_freeimage.py
index 32e01bd..308f1ee 100644
--- a/skimage/io/tests/test_freeimage.py
+++ b/skimage/io/tests/test_freeimage.py
@@ -74,15 +74,15 @@ class TestSave:
f.close()
sio.imsave(fname, x)
y = sio.imread(fname)
- assert_array_equal(x, y)
+ assert_array_equal(y, x)
@skipif(not FI_available)
def test_imsave_roundtrip(self):
for shape, dtype, format in [
[(10, 10), (np.uint8, np.uint16), ('tif', 'png')],
[(10, 10), (np.float32,), ('tif',)],
- [(10, 10, 3), (np.uint8,), ('png',)],
- [(10, 10, 4), (np.uint8,), ('png',)]
+ [(10, 10, 3), (np.uint8, np.uint16), ('png',)],
+ [(10, 10, 4), (np.uint8, np.uint16), ('png',)]
]:
tests = [(d, f) for d in dtype for f in format]
for d, f in tests:
--
1.9.1
-2
View File
@@ -1,5 +1,3 @@
search-html.patch
fix-doc-links.patch
doc-privacy.patch
slicing-error.patch
freeimage-fix.patch
-19
View File
@@ -1,19 +0,0 @@
Description: Fix slicing error revealed by numpy 1.9.0.
Numpy 1.9.0 no longer allows oversize data to be assigned to a
boolean indexed 1-d array by discarding excess elements.
Author: Charles Harris <charlesr.harris@gmail.com>
Origin: 7a074d5dd165536cb05fd87ea94a29510edac1a7
Date: Fri, 4 Jul 2014 20:04:32 -0600
Bug: https://github.com/scikit-image/scikit-image/issues/1050
--- a/skimage/segmentation/_join.py
+++ b/skimage/segmentation/_join.py
@@ -124,7 +124,7 @@ def relabel_sequential(label_field, offs
if m == len(labels0): # nothing to do, already 1...n labels
return label_field, labels, labels
forward_map = np.zeros(m + 1, int)
- forward_map[labels0] = np.arange(offset, offset + len(labels0) + 1)
+ forward_map[labels0] = np.arange(offset, offset + len(labels0))
if not (labels == 0).any():
labels = np.concatenate(([0], labels))
inverse_map = np.zeros(offset - 1 + len(labels), dtype=np.intp)