Re: Candidate for MaximumFinder.java update

Posted by Michael Schmid on
URL: http://imagej.273.s1.nabble.com/Candidate-for-MaximumFinder-java-update-tp5008256p5008275.html

Hi Philippe, Aryeh and everyone,

for images having no negative values (one should probably check this before entering the GenericDialog), it should be doable to have the tolerance as a percentage of the value.
I wonder whether this would be really helpful, however: typical images have intensity values going down to almost zero, and at these low intensities, a threshold that is a percentage of the value will be very low. So, one would get many maxima from the noise in low-intensity parts of the image!

To avoid this, one could have two thresholds, a 'normal' one and one given as a percentage, and whichever is higher for a given pixel becomes effective.
I fear, however, that this would make it more difficult for users to understand it, and one of the nice features of ImageJ is that one can use much of it in a very intuitive way...

Unfortunately, I am extremely busy these days with an urgent project proposal, so I can't do anything like this for the next few weeks, but I might eventually do it as a summer project.

For the moment, you can convert the image to 32 bit (in case it is not 32 bits yet), use Process>Math>Min with 1e-30 or so (to make sure there are no values of zero or less) and then Process>Math>Log.  Then, the current "Find Maxima"  will be equivalent to a "Find Maxima" operation where the threshold is a percentage of the original pixel value.

As a percentage of the original pixel value, the effective threshold will be 100 * (1-exp(-thresholdValue))
So a threshold of 0.01 will correspond to about 1% of the pixel value, but is nonlinear: a threshold value of 1 will be only about 63% of the pixel value.


Hope this helps,

Michael
________________________________________________________________
On Jun 18, 2014, at 09:38, Aryeh Weiss wrote:

> On 6/18/14, 10:13 AM, Philippe CARL wrote:
>> Dear Aryeh,
>> What you are describing below, in probably much better words than what I did
>> it myself, is exactly the improvement I wanted to implement after the
>> discussion with my colleague.
>> But looking at the code, I'm not sure whether this may actually be possible
>> since the noise tolerance value is actually as well used in order to define
>> what should be considered as a maxima.
>> This is why I did only minor improvements on the code up to now and that I'm
>> looking for some expert advices in how such an "relative noise tolerance"
>> algorithm could be done.
>> My best regards,
>> Philippe
>
> Dear Philippe,
>
> Bob Dougherty and I once implemented this as part of a plugin. In this case, we looped over each ROI and "trimmed" it. I think that this approach might be a bit awkward here, but maybe the code that does Maxima Within Tolerance can be modified to do it.
> I will have to see if I can cajole one of my sons (who know Java much better than I) to look into it during summer vacation (which starts for them in August...).
>
> Best regards,
> --aryeh
>
>
>
>
>
>
>
>> -----Message d'origine-----
>> De : ImageJ Interest Group [mailto:[hidden email]] De la part de Aryeh
>> Weiss
>> Envoyé : mardi 17 juin 2014 20:19
>> À : [hidden email]
>> Objet : Re: Candidate for MaximumFinder.java update
>>
>> On 6/17/14, 5:41 PM, Philippe CARL wrote:
>>> Dear all / Wayne,
>>>
>>> Please find under the following link:
>>>
>>> http://punias.free.fr/MaximumFinder.java
>>>
>>> a new version candidate for the "Process->Find Maxima..." feature where:
>>>
>>> -          the "Noise tolerance" NumericField has been replaced by a
>> Slider
>>> implementing MouseWheelListener features,
>>>
>>> -          a "Lower threshold" slider has been added implementing as well
>>> MouseWheelListener features,
>>>
>>> -          the GenericDialog has been replaced by a
>> NonBlockingGenericDialog
>>> (I'm not sure whether you would agree on this and would like to know
>>> the reasons if not).
>>>
>>> Also discussing with a colleague on the "Find Maxima..." feature, he
>>> came up with the idea of defining a relative "Noise tolerance" value
>>> which would for example be equal to 10 for a peak having a height H
>>> and 20 for a peak of height 2H.
>>>
>>> And before starting to look into the code I found this as being a good
>>> idea until I got lost within the algorithm (since the noise tolerance
>>> is actually as well used in order to define what should be considered as a
>> maxima).
>>> So now I'm not really sure now whether this could be a good idea and
>>> whether such an implementation is actually possible or not.
>>>
>>> Thus I would like to get the opinion of some experts on this and thank
>>> you very much in advance.
>>>
>>> My best regards,
>>>
>>> Philippe
>>>
>>>
>>> Philippe CARL
>>>
>>> Laboratoire de Biophotonique et Pharmacologie
>>>
>>> UMR 7213 CNRS - Université de Strasbourg
>>>
>>> Faculté de Pharmacie
>>>
>>> 74 route du Rhin
>>>
>>> 67401 ILLKIRCH
>>>
>>> Tel : +33(0)3 68 85 41 84
>>>
>>>
>>>
>> One feature which I would love to see in "find maximum" is the ability to
>> threshold each maximum at 50% of its value. So if max=100 we keep everything
>> over 50, and if max=50 we keep everything over 25, and so on, for each peak.
>>
>> --aryeh
>>
>> --
>> Aryeh Weiss
>> Faculty of Engineering
>> Bar Ilan University
>> Ramat Gan 52900 Israel
>>
>> Ph:  972-3-5317638
>> FAX: 972-3-7384051
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>> .
>>
>
>
> --
> Aryeh Weiss
> Faculty of Engineering
> Bar Ilan University
> Ramat Gan 52900 Israel
>
> Ph:  972-3-5317638
> FAX: 972-3-7384051
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html