"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "skimage/transform/_warps.py" between
scikit-image-0.19.2.tar.gz and scikit-image-0.19.3.tar.gz

About: scikit-image is a collection of algorithms for image processing in Python.

_warps.py  (scikit-image-0.19.2):_warps.py  (scikit-image-0.19.3)
skipping to change at line 709 skipping to change at line 709
cval : float cval : float
Used in conjunction with mode 'constant', the value outside Used in conjunction with mode 'constant', the value outside
the image boundaries. the image boundaries.
clip : bool clip : bool
Whether to clip the output to the range of values of the input image. Whether to clip the output to the range of values of the input image.
This is enabled by default, since higher order interpolation may This is enabled by default, since higher order interpolation may
produce values outside the given input range. produce values outside the given input range.
""" """
if clip: if clip:
min_val = input_image.min() min_val = np.min(input_image)
max_val = input_image.max() if np.isnan(min_val):
# NaNs detected, use NaN-safe min/max
preserve_cval = (mode == 'constant' and not min_func = np.nanmin
(min_val <= cval <= max_val)) max_func = np.nanmax
min_val = min_func(input_image)
else:
min_func = np.min
max_func = np.max
max_val = max_func(input_image)
# Check if cval has been used such that it expands the effective input
# range
preserve_cval = (mode == 'constant'
and not min_val <= cval <= max_val
and min_func(output_image) <= cval <= max_func(output_i
mage))
# expand min/max range to account for cval
if preserve_cval: if preserve_cval:
cval_mask = output_image == cval # cast cval to the same dtype as the input image
cval = input_image.dtype.type(cval)
min_val = min(min_val, cval)
max_val = max(max_val, cval)
np.clip(output_image, min_val, max_val, out=output_image) np.clip(output_image, min_val, max_val, out=output_image)
if preserve_cval:
output_image[cval_mask] = cval
def warp(image, inverse_map, map_args={}, output_shape=None, order=None, def warp(image, inverse_map, map_args={}, output_shape=None, order=None,
mode='constant', cval=0., clip=True, preserve_range=False): mode='constant', cval=0., clip=True, preserve_range=False):
"""Warp an image according to a given coordinate transformation. """Warp an image according to a given coordinate transformation.
Parameters Parameters
---------- ----------
image : ndarray image : ndarray
Input image. Input image.
inverse_map : transformation object, callable ``cr = f(cr, **kwargs)``, or n darray inverse_map : transformation object, callable ``cr = f(cr, **kwargs)``, or n darray
Inverse coordinate map, which transforms coordinates in the output Inverse coordinate map, which transforms coordinates in the output
 End of changes. 4 change blocks. 
9 lines changed or deleted 22 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)