Permalink
Browse files

workaround: convert `dtype(image)` to `image.astype(dtype)`

  • Loading branch information...
1 parent c64350a commit 4b43e9f33e1397dce2e3c162d6bac5f5ea9f600f @JDWarner JDWarner committed Mar 21, 2013
Showing with 5 additions and 5 deletions.
  1. +5 −5 skimage/util/dtype.py
View
@@ -176,7 +176,7 @@ def _scale(a, n, m, copy=True):
if kind_in == 'b':
# from binary image, to float and to integer
- result = dtype(image)
+ result = image.astype(dtype)
if kind != 'f':
result *= dtype(dtype_range[dtype][1])
return result
@@ -195,7 +195,7 @@ def _scale(a, n, m, copy=True):
# floating point -> floating point
if itemsize_in > itemsize:
prec_loss()
- return dtype(image)
+ return image.astype(dtype)
# floating point -> integer
prec_loss()
@@ -218,7 +218,7 @@ def _scale(a, n, m, copy=True):
image *= (imax - imin + 1.0) / 2.0
np.floor(image, out=image)
np.clip(image, imin, imax, out=image)
- return dtype(image)
+ return image.astype(dtype)
if kind == 'f':
# integer -> floating point
@@ -236,7 +236,7 @@ def _scale(a, n, m, copy=True):
image *= 2.0
image += 1.0
image /= imax_in - imin_in
- return dtype(image)
+ return image.astype(dtype)
if kind_in == 'u':
if kind == 'i':
@@ -262,7 +262,7 @@ def _scale(a, n, m, copy=True):
image -= imin_in
image = _scale(image, 8 * itemsize_in, 8 * itemsize, copy=False)
image += imin
- return dtype(image)
+ return image.astype(dtype)
def img_as_float(image, force_copy=False):

0 comments on commit 4b43e9f

Please sign in to comment.