Skip to content

Commit 70db186

Browse files
🐛 Fix Immutable Output from WSIReader (#850)
- Resolve issue #837 The output of WSI readers (read_rect, read_region, etc) are immutable, i.e. Read-only. We assume that created Numpy arrays created from PIL images in the `background_composite` are mutable by default. After Numpy v1.16.0, doing np.asarray(pil_image) will return an immutable Numpy array. Gladly, there is an easy fix for this, we should use `np.array()` instead of `np.asarray`.
1 parent b0b1474 commit 70db186

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tiatoolbox/utils/transforms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ def background_composite(
5353
)
5454
composite.alpha_composite(image)
5555
if not alpha:
56-
return np.asarray(composite.convert("RGB"))
56+
return np.array(composite.convert("RGB"))
5757

58-
return np.asarray(composite)
58+
return np.array(composite)
5959

6060

6161
def _convert_scalar_to_width_height(array: np.ndarray) -> np.ndarray:

0 commit comments

Comments
 (0)