9fcb6c9d9cadb8efa6426f29c94ab59928f41761,skimage/morphology/extrema.py,,h_maxima,#Any#Any#Any#,48

Before Change


    
    if np.issubdtype(image.dtype, np.floating):
        resolution = 2 * np.finfo(image.dtype).resolution
        if h < resolution:
            h = resolution
        h_corrected = h - resolution / 2.0
        shifted_img = image - h
    else:
        shifted_img = _subtract_constant_clip(image, h)

After Change


    //   >>> b[0] == b[1]
    //   True
    //
    if np.issubdtype(type(h), np.floating) and \
       np.issubdtype(image.dtype, np.integer):
        if ((h % 1) != 0):
            warn("possible precision loss converting image to "
                 "floating point. To silence this warning, "
                 "ensure image and h have same data type.",
                 stacklevel=2)
            image = image.astype(np.float_)
        else:
            h = image.dtype.type(h)

    if (h == 0):
        raise ValueError("h = 0 is ambiguous, use local_maxima() "
                         "instead?")

    if np.issubdtype(image.dtype, np.floating):
        // The purpose of the resolution variable is to allow for the
        // small rounding errors that inevitably occur when doing
        // floating point arithmetic. We want shifted_img to be
        // guaranteed to be h less than image. If we only subtract h
        // there may be pixels were shifted_img ends up being
        // slightly greater than image - h.
        //
        // The resolution is scaled based on the pixel values in the
        // image because floating point precision is relative. A
        // very large value of 1.0e10 will have a large precision,
        // say +-1.0e4, and a very small value of 1.0e-10 will have
        // a very small precision, say +-1.0e-16.
        //
        resolution = 2 * np.finfo(image.dtype).resolution * np.abs(image)
        shifted_img = image - h - resolution
    else:
        shifted_img = _subtract_constant_clip(image, h)

    rec_img = greyreconstruct.reconstruction(shifted_img, image,
                                             method="dilation", selem=selem)
    residue_img = image - rec_img
    return (residue_img >= h).astype(np.uint8)


def h_minima(image, h, selem=None):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


Project Name: scikit-image/scikit-image
Commit Name: 9fcb6c9d9cadb8efa6426f29c94ab59928f41761
Time: 2020-04-22
Author: hbabcock@mac.com
File Name: skimage/morphology/extrema.py
Class Name:
Method Name: h_maxima


Project Name: scikit-image/scikit-image
Commit Name: 9fcb6c9d9cadb8efa6426f29c94ab59928f41761
Time: 2020-04-22
Author: hbabcock@mac.com
File Name: skimage/morphology/extrema.py
Class Name:
Method Name: h_minima


Project Name: RaRe-Technologies/gensim
Commit Name: 8daace20a97c65f845ed008f4b60bdc62b12e250
Time: 2018-04-15
Author: 35378674+o-P-o@users.noreply.github.com
File Name: gensim/matutils.py
Class Name:
Method Name: unitvec


Project Name: scikit-image/scikit-image
Commit Name: 9fcb6c9d9cadb8efa6426f29c94ab59928f41761
Time: 2020-04-22
Author: hbabcock@mac.com
File Name: skimage/morphology/extrema.py
Class Name:
Method Name: h_maxima