Hie Everyone
Is there a mode filter for imagej?. I can only find mean, median etc. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On 18/08/2017 09:21, Richard wrote:
> Hie Everyone > Is there a mode filter for imagej?. I can only find mean, median etc. _______________________________________________________________________ Hi Richard, well, I think a 'true' mode filter is not of much value, the 'mode' as the most frequently occurring value makes sense only if there are very many pixels included, not for a few pixels in a given surrounding (like in a typical filter operation with small radius, such as typically used for the 'median', 'mean', etc. filters). E.g., if the pixel values in a given 3x3 neighborhood are 10, 10, 21, 23, 24, 25, 26, 27, 29 the mode filter would report 10 A median would give you 24. If the filter is meant for removing outliers, I think it should discard the two '10' values (maybe also the '21' and '29') and give you 25. So a better algorithm might be finding the smallest interval where some given fraction of pixels is situated (about 50% for small samples like 3x3, maybe 30% for very large samples) and then taking the average of the pixel values in that range. It would be a bit like finding the peak (mode) of a smoothed histogram. If this fraction of pixels is less than 50% such a filter might also do some edge-preserving smoothing (probably resulting in more noisy edges than other edge-preserving smoothing algorithms). Some ideas for the algorithm for such a filter: - first sorting the pixel values in a given neighborhood (which gives you a list as my example above) - then step through the array taking the differences between the (i+n*percentage)-th and i-th element, and finding the minimum of these percentages. In the example above, assuming n*percentage=4 (4/9 = 44%) the differences are 23-10= 13, 24-10= 14, 25-21= 4, 26-23= 3, 27-24= 3, 29-25= 4 Both '3' values are minima, corresponding to averages for the given intervals of (23+24+25+26)/4 = 24.5 and (24+25+26+27)/4 = 25.5 This looks almost perfect, but if you have the following values: 10, 10, 21, 23, 24, 26, 27, 28, 29 you would get 27.5, which is probably higher what a human would consider the optimum result (but still slightly better than the median, which is 24). -- An alternative you could also have a look at is Lee's Sigma filter: http://imagej.net/plugins/sigma-filter.html Michael -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by rmakanza
Richard, I first want to apologize that I do not have an answer for you, but I did want to comment on Michael's response.
I disagree with Michael's comment that the mode filter is of little value. If the value of the pixels in the image represent a classification rather than digitization of a continuous attribute (like color), then the mode filter can be applied to replace "objects" of small size with the predominant classification in the neighborhood. Continuous operations like the mean filter, and others like scaling algorithms, and standard edge detection operations do not lend themselves well to classified images. So, in short I certainly do see the value in a mode filter, but sadly I do not know of an implementation of it in ImageJ or FIJI. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Jim & everyone,
It would be straightforward to add a mode filter to ImageJ Ops [1], but first, a question: what should the algorithm do when there are multiple/many values tied for mode? Regards, Curtis [1] https://imagej.net/Ops -- Curtis Rueden LOCI software architect - https://loci.wisc.edu/software ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden Did you know ImageJ has a forum? http://forum.imagej.net/ On Wed, Aug 23, 2017 at 2:13 PM, Jim Peterson <[hidden email]> wrote: > Richard, I first want to apologize that I do not have an answer for you, > but I did want to comment on Michael's response. > > I disagree with Michael's comment that the mode filter is of little > value. If the value of the pixels in the image represent a classification > rather than digitization of a continuous attribute (like color), then the > mode filter can be applied to replace "objects" of small size with the > predominant classification in the neighborhood. Continuous operations like > the mean filter, and others like scaling algorithms, and standard edge > detection operations do not lend themselves well to classified images. So, > in short I certainly do see the value in a mode filter, but sadly I do not > know of an implementation of it in ImageJ or FIJI. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Michael Schmid
Hie Everyone
I would like to thank all of you for your wonderful suggestions to my question. What motivated me to ask was this review paper: https://people.csail.mit.edu/jsolomon/assets/smooth_local_histograms.pdf. and also this post:http://www.roborealm.com/help/Mode.php, http://www.shawnlankton.com/2008/04/selective-mode-filter-in-matlab/. It seems like its more effective than the median filter based on the descriptions and the results. So I thought if this can be done in image j. that would be wonderful Thank you -- Sent from: http://imagej.1557.x6.nabble.com/ -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |