Skip to content

median filter is only available for integer-type images #1419

Closed

Description

@emmanuelle

filters.median only operates on integer images. For float images, we could return the output of ndimage.median_filter.

Activity

  1. jni commented on Mar 12, 2015

    @jni
    Member

    👍 ! Have a look at the default_fallback decorator in morphology.misc. Solves exactly the same problem for morphological functions. (Or it did prior to 0.11, actually.)

  2. added
    ⏩ type: Enhancement
    on Dec 11, 2015
  3. added this to the 0.15 milestone on Jan 18, 2018
  4. glemaitre commented on Dec 18, 2018

    @glemaitre
    Contributor

    I was thinking to pick up this issue.

    The suggestion was to use the SciPy functions. Would it make sense to adapt the Cython code instead to deal with floating images instead?

  5. emmanuelle commented on Dec 18, 2018

    @emmanuelle
    MemberAuthor

    @glemaitre I'm not sure the implementation is easily adapted to floating point images, since the median filter is from filters.rank, which works using local histograms computed on neighbourhoods (8 or 16-bit histograms are computed). It is a more generic implementation than the plain median filters alone, but I think it works better for integer images. Maybe we would need a lecture on filters.rank someday as the one we had today on attribute operators...

  6. glemaitre commented on Dec 18, 2018

    @glemaitre
    Contributor

    OK I see. So defaulting on the scipy depending on the dtype would still be correct then.

  7. stefanv commented on Dec 18, 2018

    @stefanv
    Member

    It's probably not great to have different implementations for ints and floats, especially not in different packages. Then, rather two implementations, with a "See Also" referring to the other location.

  8. emmanuelle commented on Dec 19, 2018

    @emmanuelle
    MemberAuthor

    OK, here is what I suggest: how about

    • skimage.filters.median calls ndimage.median_filter for all data types
    • and skimage.filters.rank.median is imported from the rank submodule only, and only for integer data types?
  9. glemaitre commented on Dec 19, 2018

    @glemaitre
    Contributor

    ndimage.median_filter does not support an option mask. I could deprecate the parameter and fallback to the skimage.rank.median for 2 release cycle.
    I also have to check the mode policy for the borders to be sure that both implementations will give similar results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ⏩ type: Enhancement

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions