Module Expr Str Import alias identifier FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore CompareNotEq SubscriptLoad NameLoad Slice Num SubscriptLoad NameLoad Slice Num Expr Call AttributeLoad NameLoad attr NameLoad keyword SubscriptLoad NameLoad Slice Num Assign NameStore Call AttributeLoad NameLoad attr TupleLoad BinOpAdd SubscriptLoad NameLoad Index Num Num AttributeLoad NameLoad attr Assign SubscriptStore NameLoad Index Num SubscriptLoad NameLoad Index Num Assign SubscriptStore NameLoad Slice Num SubscriptLoad SubscriptLoad NameLoad Slice Num Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad Return TupleLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list
N/A N/A rankorder.py - convert an image of any type to an image of ints whose
pixels have an identical rank order compared to the original image

Originally part of CellProfiler, code licensed under both GPL and BSD licenses.
Website: http://www.cellprofiler.org
Copyright (c) 2003-2009 Massachusetts Institute of Technology
Copyright (c) 2009-2011 Broad Institute
All rights reserved.
Original author: Lee Kamentstky
 N/A numpy np rank_order N/A N/A image N/A N/A N/A Return an image of the same shape where each pixel is the
    index of the pixel value in the ascending order of the unique
    values of `image`, aka the rank-order value.

    Parameters
    ----------
    image: ndarray

    Returns
    -------
    labels: ndarray of type np.uint32, of shape image.shape
        New array where each pixel has the rank-order value of the
        corresponding pixel in `image`. Pixel values are between 0 and
        n - 1, where n is the number of distinct unique values in
        `image`.

    original_values: 1-D ndarray
        Unique original values of `image`

    Examples
    --------
    >>> a = np.array([[1, 4, 5], [4, 4, 1], [5, 1, 1]])
    >>> a
    array([[1, 4, 5],
           [4, 4, 1],
           [5, 1, 1]])
    >>> rank_order(a)
    (array([[0, 1, 2],
           [1, 1, 0],
           [2, 0, 0]], dtype=uint32), array([1, 4, 5]))
    >>> b = np.array([-1., 2.5, 3.1, 2.5])
    >>> rank_order(b)
    (array([0, 1, 2, 1], dtype=uint32), array([-1. ,  2.5,  3.1]))
     N/A flat_image N/A N/A image ravel N/A sort_order N/A N/A N/A N/A flat_image argsort astype N/A np uint32 N/A flat_image N/A flat_image N/A sort_order N/A sort_rank N/A N/A np zeros_like sort_order N/A is_different N/A N/A flat_image N/A -1 N/A flat_image N/A 1 N/A N/A N/A np cumsum is_different out N/A sort_rank N/A 1 N/A original_values N/A N/A np zeros N/A N/A N/A sort_rank N/A -1 1 N/A image dtype N/A N/A original_values N/A 0 N/A flat_image N/A 0 N/A N/A original_values N/A 1 N/A N/A flat_image N/A 1 N/A is_different N/A int_image N/A N/A np zeros_like sort_order N/A N/A int_image N/A sort_order sort_rank N/A N/A N/A N/A int_image reshape N/A image shape original_values N/A