Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function to remove near objects in nd-image #4165

Open
wants to merge 69 commits into
base: main
Choose a base branch
from

Commits on Sep 29, 2019

  1. Configuration menu
    Copy the full SHA
    d929614 View commit details
    Browse the repository at this point in the history
  2. Add remove_close_objects function

    This function iterates over all objects (connected pixels that are True)
    inside an image and removes neighboring objects until all remaining ones
    are at least a minimal euclidean distance from each other.
    lagru committed Sep 29, 2019
    Configuration menu
    Copy the full SHA
    e35ffa3 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    03830d9 View commit details
    Browse the repository at this point in the history
  4. Add manual bounds checking

    lagru committed Sep 29, 2019
    Configuration menu
    Copy the full SHA
    bcac7ee View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    f153fe9 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    cac1a0c View commit details
    Browse the repository at this point in the history
  7. Simplify Cythonization in morphology.setup.py

    _extrema_cy.pyx was cythonized twice for now reason.
    lagru committed Sep 29, 2019
    Configuration menu
    Copy the full SHA
    0814f91 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    f3aeb68 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    c53a492 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    fbe45c8 View commit details
    Browse the repository at this point in the history
  11. Simplify/tweak helper functions in morphology._util

    Simplify construction of indices, use consistent name for structuring
    element (selem), some reformatting and improve documentation.
    lagru committed Sep 29, 2019
    Configuration menu
    Copy the full SHA
    0d08d0f View commit details
    Browse the repository at this point in the history
  12. Only evaluate object surface in remove_close_objects

    This trick significantly improves the performance by reducing the number
    of points inside the KDTree whose neighborhood needs to be evaluated
    for objects that are to close. The greater the checked objects size to
    surface ratio, the greater the improvement.
    lagru committed Sep 29, 2019
    Configuration menu
    Copy the full SHA
    ffcdb38 View commit details
    Browse the repository at this point in the history
  13. Use intp as label dtype

    numpy.bincount seems to cast its input to dtype('intp') according to
    the rule safe. Therefore giving a dtype such as uint32 or int64 that
    can hold a larger number fails on 32-bit platforms.
    lagru committed Sep 29, 2019
    Configuration menu
    Copy the full SHA
    0b36136 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    b44c417 View commit details
    Browse the repository at this point in the history
  15. Correct faulty results in docstring example

    With recent changes the evalutation order of objects changed.
    lagru committed Sep 29, 2019
    Configuration menu
    Copy the full SHA
    27777e3 View commit details
    Browse the repository at this point in the history
  16. Use "mergesort" instead of "stable" sort

    The latter was added in NumPy 1.15 which is not yet a minimal
    requirement for scikit-image.
    lagru committed Sep 29, 2019
    Configuration menu
    Copy the full SHA
    2a6e09e View commit details
    Browse the repository at this point in the history

Commits on Sep 30, 2019

  1. Configuration menu
    Copy the full SHA
    695b2c7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9dfe298 View commit details
    Browse the repository at this point in the history

Commits on Oct 4, 2019

  1. Support raveled offsets for dimensions smaller selem

    The old implementation would raise a ValueError if a dimension length
    given in `image_shape` was smaller than in `selem`. This precluded
    operations on images e.g. with the shape (2, 100).
    lagru committed Oct 4, 2019
    Configuration menu
    Copy the full SHA
    b4b0155 View commit details
    Browse the repository at this point in the history
  2. Pass-through p-norm to KDTree

    This allows the user to control how the distance between objects/samples
    is calculated (e.g. Euclidean, Manhatten, Chebyshev).
    lagru committed Oct 4, 2019
    Configuration menu
    Copy the full SHA
    36cf967 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    fb5a75e View commit details
    Browse the repository at this point in the history
  4. Remove parameter not supported by Scipy 0.19

    return_sorted was added in SciPy 1.2 and is not yet supported by
    scikit-images minimal required version.
    lagru committed Oct 4, 2019
    Configuration menu
    Copy the full SHA
    0893179 View commit details
    Browse the repository at this point in the history

Commits on Oct 5, 2019

  1. Configuration menu
    Copy the full SHA
    a9a0204 View commit details
    Browse the repository at this point in the history

Commits on Oct 6, 2019

  1. Rename to remove_near_objects

    "close" can have multiple meanings especially in the context of
    morphological operations (closing). So the synonym "near" should have
    less potential for confusion.
    lagru committed Oct 6, 2019
    Configuration menu
    Copy the full SHA
    4cf5108 View commit details
    Browse the repository at this point in the history

Commits on Oct 19, 2019

  1. Use in_place instead of inplace

    lagru committed Oct 19, 2019
    Configuration menu
    Copy the full SHA
    0aaff28 View commit details
    Browse the repository at this point in the history

Commits on Apr 10, 2020

  1. Configuration menu
    Copy the full SHA
    0439065 View commit details
    Browse the repository at this point in the history
  2. Merge branch 'master' into remove-close-objects

    Resolve Conflicts in:
    doc/release/release_dev.rst
    skimage/morphology/_flood_fill.py
    skimage/morphology/_util.py
    skimage/morphology/extrema.py
    lagru committed Apr 10, 2020
    Configuration menu
    Copy the full SHA
    4868214 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b7d96b8 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    7c79fcc View commit details
    Browse the repository at this point in the history
  5. Fix whitespace

    lagru committed Apr 10, 2020
    Configuration menu
    Copy the full SHA
    2390fcf View commit details
    Browse the repository at this point in the history
  6. Add gallery example for removing objects

    This example demonstrates the usage of remove_small_objects and
    remove_near_objects.
    lagru committed Apr 10, 2020
    Configuration menu
    Copy the full SHA
    46c4edc View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    9ea2b38 View commit details
    Browse the repository at this point in the history

Commits on Apr 13, 2020

  1. Improve misleading doc wording

    lagru committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    39fc5a6 View commit details
    Browse the repository at this point in the history

Commits on Jul 15, 2020

  1. Configuration menu
    Copy the full SHA
    1a3f4a2 View commit details
    Browse the repository at this point in the history

Commits on Jul 16, 2020

  1. Use shared fused dtype np_real_numeric

    Already declared, so no need to duplicate it here.
    lagru committed Jul 16, 2020
    Configuration menu
    Copy the full SHA
    ba7aca5 View commit details
    Browse the repository at this point in the history

Commits on Mar 31, 2022

  1. Configuration menu
    Copy the full SHA
    8308572 View commit details
    Browse the repository at this point in the history

Commits on Apr 10, 2022

  1. Use out argument instead of in_place

    and rename selem to footprint for a more consistent API.
    
    ravel is replaced with reshape(-1) as recommended by NumPy's doc.
    lagru committed Apr 10, 2022
    Configuration menu
    Copy the full SHA
    373d0d3 View commit details
    Browse the repository at this point in the history
  2. Group test's for remove_near_objects in class

    It's easier to seperate the tests for this functions from the other
    ones this way.
    lagru committed Apr 10, 2022
    Configuration menu
    Copy the full SHA
    78323dd View commit details
    Browse the repository at this point in the history
  3. Simplify input sanitation

    _offsets_to_raveled_neighbors is now a just a wrapper for
    _raveled_offsets_and_distances, so replace it.
    
    Special handling of an empty `image` is no longer necessary as both
    _raveled_offsets_and_distances and cKDTree support arrays with size 0.
    lagru committed Apr 10, 2022
    Configuration menu
    Copy the full SHA
    51f9415 View commit details
    Browse the repository at this point in the history
  4. Handle memory layout more expicitely

    `out` must be C-contiguous which allows for efficient indexing in the
    underlying Cython code. This might raise an error if out is supplied by
    the user so document it with a test.
    
    It seems that special logic for bool-type arrays is no longer necessary
    as the appropriate PR [1] was merged.
    
    [1] cython/cython#2676
    lagru committed Apr 10, 2022
    Configuration menu
    Copy the full SHA
    1f7df29 View commit details
    Browse the repository at this point in the history

Commits on Oct 27, 2022

  1. Merge branch 'main' into remove-close-objects

    # Conflicts:
    #	benchmarks/benchmark_morphology.py
    #	skimage/morphology/__init__.py
    #	skimage/morphology/misc.py
    #	skimage/morphology/setup.py
    lagru committed Oct 27, 2022
    Configuration menu
    Copy the full SHA
    9b9c50e View commit details
    Browse the repository at this point in the history
  2. Remove trailing whitespace

    to make CI linter happy.
    lagru committed Oct 27, 2022
    Configuration menu
    Copy the full SHA
    d4f1fe6 View commit details
    Browse the repository at this point in the history

Commits on Jan 20, 2023

  1. Configuration menu
    Copy the full SHA
    633658b View commit details
    Browse the repository at this point in the history

Commits on Jan 21, 2023

  1. Add _near_objects_cy to new meson system

    and fix import path of _shared.fused_numerics. Of course wouldn't
    compile otherwise.
    lagru committed Jan 21, 2023
    Configuration menu
    Copy the full SHA
    729271d View commit details
    Browse the repository at this point in the history
  2. Address NumPy deprecation warning

    The warning was found by the CI (linux-cp3.9-pre) for NumPy v1.24.1:
    
    DeprecationWarning: NumPy will stop allowing conversion of out-of-bound
    Python integers to integer arrays.  The conversion of -1 to uint32 will
    fail in the future.
    
    The objects don't have to be -1, just any number != 0.
    lagru committed Jan 21, 2023
    Configuration menu
    Copy the full SHA
    668927e View commit details
    Browse the repository at this point in the history
  3. Add remove_near_objects to morpholoy.__all__

    Maybe missed during merging?
    lagru committed Jan 21, 2023
    Configuration menu
    Copy the full SHA
    384d2c1 View commit details
    Browse the repository at this point in the history

Commits on Jan 25, 2023

  1. Configuration menu
    Copy the full SHA
    faed84a View commit details
    Browse the repository at this point in the history

Commits on Feb 19, 2023

  1. Use labels as input and map priority to index

    This overhauls the API of remove_near_objects. Instead of labeling the
    input itself, the function already expects a labeled image. Sorting an
    index into this label_image by label ID first, and by priority second,
    makes it easy to find other indices belonging to the same object because
    they are contiguous in the resulting index. This makes it possible to
    entirely omit the parameters connectivity and footprint (for now).
    
    `priority` now is expected to assign a priority to each object and no
    longer gives a priority for each pixel.
    
    Test and benchmarks were updated accordingly.
    lagru committed Feb 19, 2023
    Configuration menu
    Copy the full SHA
    1196471 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9ef5415 View commit details
    Browse the repository at this point in the history
  3. Add two new test cases one of which currently fails

    Also sadly the optimization isn't working as expected. See
    test_objects_with_inside.
    lagru committed Feb 19, 2023
    Configuration menu
    Copy the full SHA
    c733e61 View commit details
    Browse the repository at this point in the history

Commits on Apr 18, 2024

  1. Configuration menu
    Copy the full SHA
    664a220 View commit details
    Browse the repository at this point in the history

Commits on Apr 19, 2024

  1. Allow F-contiguous arrays

    requires an additional copy but still, good to support.
    lagru committed Apr 19, 2024
    Configuration menu
    Copy the full SHA
    72e58f6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c78dc8a View commit details
    Browse the repository at this point in the history
  3. Remove obsolete _max_priority

    lagru committed Apr 19, 2024
    Configuration menu
    Copy the full SHA
    887968f View commit details
    Browse the repository at this point in the history
  4. Release GIL in _remove_object

    lagru committed Apr 19, 2024
    Configuration menu
    Copy the full SHA
    571aa4a View commit details
    Browse the repository at this point in the history
  5. Update docstrings

    lagru committed Apr 19, 2024
    Configuration menu
    Copy the full SHA
    bb2a9af View commit details
    Browse the repository at this point in the history
  6. Format with black

    lagru committed Apr 19, 2024
    Configuration menu
    Copy the full SHA
    11ac443 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    d2f602e View commit details
    Browse the repository at this point in the history

Commits on Apr 20, 2024

  1. Use C++ set and release GIL

    lagru committed Apr 20, 2024
    Configuration menu
    Copy the full SHA
    2573cd8 View commit details
    Browse the repository at this point in the history
  2. Exclude inner samples of objects from KDTree & critical loop

    Even with the additional cost of separating bounday and inner samples
    of objects, this improves the performance significantly!
    lagru committed Apr 20, 2024
    Configuration menu
    Copy the full SHA
    e98eb6d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    20a5cee View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    4399993 View commit details
    Browse the repository at this point in the history
  5. Color labels in gallery example

    lagru committed Apr 20, 2024
    Configuration menu
    Copy the full SHA
    fefdb67 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    6709e68 View commit details
    Browse the repository at this point in the history
  7. Add support for anistropic data in remove_near_objects

    and also add a random test that uses CKDTree.sparse_distance_matrix to
    manually check distance between remaining objects.
    lagru committed Apr 20, 2024
    Configuration menu
    Copy the full SHA
    fe1a8e8 View commit details
    Browse the repository at this point in the history

Commits on Apr 21, 2024

  1. Rename to min_distance like in peak_local_max

    or corner_peaks.
    lagru committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    e6c02bd View commit details
    Browse the repository at this point in the history
  2. Test p-norm as well

    lagru committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    7a59894 View commit details
    Browse the repository at this point in the history
  3. Correct spelling

    lagru committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    49ce7c3 View commit details
    Browse the repository at this point in the history
  4. Use sparser borders if possible

    for unity spacing and if p-norm is 1 or 2. Also refactor code structure
    a little bit.
    lagru committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    c8756ca View commit details
    Browse the repository at this point in the history