You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
median filter is only available for integer-type images #1419
👍 ! 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.)
@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...
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.
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.
Activity
jni commentedon Mar 12, 2015
👍 ! Have a look at the
default_fallbackdecorator inmorphology.misc. Solves exactly the same problem for morphological functions. (Or it did prior to 0.11, actually.)glemaitre commentedon Dec 18, 2018
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?
emmanuelle commentedon Dec 18, 2018
@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 onfilters.ranksomeday as the one we had today on attribute operators...glemaitre commentedon Dec 18, 2018
OK I see. So defaulting on the scipy depending on the dtype would still be correct then.
stefanv commentedon Dec 18, 2018
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.
emmanuelle commentedon Dec 19, 2018
OK, here is what I suggest: how about
skimage.filters.mediancallsndimage.median_filterfor all data typesskimage.filters.rank.medianis imported from theranksubmodule only, and only for integer data types?glemaitre commentedon Dec 19, 2018
ndimage.median_filterdoes not support an optionmask. I could deprecate the parameter and fallback to theskimage.rank.medianfor 2 release cycle.I also have to check the
modepolicy for the borders to be sure that both implementations will give similar results.