Candidate for MaximumFinder.java update

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Candidate for MaximumFinder.java update

CARL Philippe (LBP)
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


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Candidate for MaximumFinder.java update

Aryeh Weiss
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
Reply | Threaded
Open this post in threaded view
|

Re: Candidate for MaximumFinder.java update

CARL Philippe (LBP)
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

-----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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Candidate for MaximumFinder.java update

Aryeh Weiss
In reply to this post by Aryeh Weiss
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
Reply | Threaded
Open this post in threaded view
|

Re: Candidate for MaximumFinder.java update

Gabriel Landini
In reply to this post by Aryeh Weiss
On Wednesday 18 Jun 2014 09:13:06 Philippe CARL wrote:
> 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.

Perhaps it might be useful to look at the morphological procedure called "h-
domes" which detects *regional* maxima (or minima) based on a height h.
This is basically a greyscale reconstruction of the original using the
original-h as the seed.

See Fig 12 here:
http://www.vincent-net.com/luc/papers/93ieeeip_recons.pdf

You can do this with the Domes plugin in the morphology collection.
Then, if still needed, you can filter the domes that have at least height h or
any other value. To do this duplicate "domes" as "domes1" image, binarise it a
t>0 then apply particles8 with redirection to the "domes" to collect the max
gresycale value of each dome.

Hope it helps.

Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Candidate for MaximumFinder.java update

Michael Schmid
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
Reply | Threaded
Open this post in threaded view
|

Re: Candidate for MaximumFinder.java update

Aryeh Weiss
In reply to this post by Gabriel Landini
On 6/18/14, 11:22 AM, Gabriel Landini wrote:

> On Wednesday 18 Jun 2014 09:13:06 Philippe CARL wrote:
>> 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.
> Perhaps it might be useful to look at the morphological procedure called "h-
> domes" which detects *regional* maxima (or minima) based on a height h.
> This is basically a greyscale reconstruction of the original using the
> original-h as the seed.
>
> See Fig 12 here:
> http://www.vincent-net.com/luc/papers/93ieeeip_recons.pdf
>
> You can do this with the Domes plugin in the morphology collection.
> Then, if still needed, you can filter the domes that have at least height h or
> any other value. To do this duplicate "domes" as "domes1" image, binarise it a
> t>0 then apply particles8 with redirection to the "domes" to collect the max
> gresycale value of each dome.
>
> Hope it helps.
>
> Gabriel
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
Hi Gabriel,

Thank  you for your reply. First thing I did was try out the domes
plugin. Unfortunately, it appears to be broken in the latest Fij
distribution. I reported it with the Fiji bug reporter, but I figured
you might want to check it. I put it on the list because I am sure that
lots of people use your morphology plugins (they are the first thing
that I add to any new installation...)

GrayScaleReconstruct also seems broken. Most of the others work -- I did
not have a chance to test them all.

Best regards
--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
Reply | Threaded
Open this post in threaded view
|

Re: Candidate for MaximumFinder.java update

Gabriel Landini
On Wednesday 18 Jun 2014 16:14:55 you wrote:
> Thank  you for your reply. First thing I did was try out the domes
> plugin. Unfortunately, it appears to be broken in the latest Fij
> distribution. I reported it with the Fiji bug reporter, but I figured
> you might want to check it. I put it on the list because I am sure that
> lots of people use your morphology plugins (they are the first thing
> that I add to any new installation...)
>
> GrayScaleReconstruct also seems broken. Most of the others work -- I did
> not have a chance to test them all.

Hm... Have you tried removing the *.java files from the folder? I.e. just
leave the class files in /Morphology

By the way, I realised that it is no needed to process the result with
particles8 to do what I suggested earlier. This macro would do:

//-------------------------8<--------------------------
//DomesH40.txt
//This processes domes and keeps those strictly with h=40
// G. Landini at bham. ac. uk
// 28 June 2014
//
//run("Blobs (25K)");
//run("Invert"); // to make bright blobs.
h=40
setBatchMode(true);
run("Duplicate...", "title=domes");
run("Domes ", "height="+h);
setOption("BlackBackground", true);
run("Duplicate...", "title=mask");
setThreshold(1, 255);
run("Convert to Mask");

selectWindow("domes");
setThreshold(h, h);
run("Convert to Mask");

run("BinaryReconstruct ", "mask=mask seed=domes white");
rename("domes="+h);
//selectWindow("mask");
//close();
setBatchMode(false);
//-------------------------8<--------------------------

Cheers

Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Candidate for MaximumFinder.java update

Gabriel Landini
On Wednesday 18 Jun 2014 14:41:11 you wrote:

> By the way, I realised that it is no needed to process the result with
> particles8 to do what I suggested earlier. This macro would do:
>
> //-------------------------8<--------------------------
> //DomesH40.txt
> //This processes domes and keeps those strictly with h=40
> // G. Landini at bham. ac. uk
> // 28 June 2014
> //
> //run("Blobs (25K)");
> //run("Invert"); // to make bright blobs.
> h=40
> setBatchMode(true);
> run("Duplicate...", "title=domes");
> run("Domes ", "height="+h);
> setOption("BlackBackground", true);
> run("Duplicate...", "title=mask");
> setThreshold(1, 255);
> run("Convert to Mask");
>
> selectWindow("domes");
> setThreshold(h, h);
> run("Convert to Mask");
>
> run("BinaryReconstruct ", "mask=mask seed=domes white");
> rename("domes="+h);
> //selectWindow("mask");
> //close();
> setBatchMode(false);
> //-------------------------8<--------------------------

Hi Aryeh, I see what you mean that the plugins do not work in Fiji.
Even the domes plugin is called with all the parameters filled, it shows the
dialog window (but it shouldn't).

In case you want to try, the above works fine in IJ1.

Cheers

Gabriel

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