Getting the values of a Plot Profile after using peak finder script

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

Getting the values of a Plot Profile after using peak finder script

Burni
Greetings,

I am using the peak finding tool of Tiago Ferreira written in Beanshell (http://fiji.sc/Find_Peaks).
I exported it as a .jar so that I can access it from the addon menu.
The problem I have is that I want to get the actual maxima and minima values automatically with a Macro.
I wrote this so far, with "FindPeaks" being the .jar I exported. The macro is supposed to run with a selected image.

run("Select All");
setKeyDown("alt"); run("Plot Profile");
run("FindPeaks ", "min._peak_amplitude=0.15 min._peak_distance=0 min._value=NaN max._value=NaN");
Plot.getValues(x0, y0);
for (i=0; i<x0.length; i++)
        print(x0[i],y0[i]);

When you run the addon, you get the Plot Profile with all the peaks and minima marked.
What I want to do is get the actual coordinates of the peaks, but the getvalues command only gives me the standard data of the plot profile.
When I click the 'List' button of the Plot Profile with the marked peaks, I get 6 columns. The first 2 are again the standard values of the Plot Profile. The 3.-6. column however are the coordinates of the maxima and minima. How do I access them? I tried Plot.getValues(x0, y0, x1, y1, x2, y2), but that doesn't work either.

Burni
Reply | Threaded
Open this post in threaded view
|

Re: Getting the values of a Plot Profile after using peak finder script

dscho
Hi Burni,

On Wed, 26 Mar 2014, Burni wrote:

> I am using the peak finding tool of Tiago Ferreira written in Beanshell
> (http://fiji.sc/Find_Peaks).
> I exported it as a .jar so that I can access it from the addon menu.

No need. You can put the Find_Peaks.bsh file directly into the plugins/
directory.

> The problem I have is that I want to get the actual maxima and minima values
> automatically with a Macro.

If you want to do sophisticated things, the Macro language is probably not
the way to go. Since you already have a Beanshell script, why not modify
this?

Ciao,
Johannes

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

Re: Getting the values of a Plot Profile after using peak finder script

Burni
Hi Johannes,

the macro isn't all that complex, I figured it could be done well enough with The ImageJ macro language.
Also, I'm not that experienced with Beanshell, so tried to make use of the Record function.
But you are probably right, it seems best to just stay in Beanshell and modify it.
Thanks for your response,

Burni
j__
Reply | Threaded
Open this post in threaded view
|

Re: Getting the values of a Plot Profile after using peak finder script

j__
In reply to this post by Burni
Hi Burni

I'm trying to do something very similar, although I have a rather involved macro that I have worked the PeakFinder script into. The inability to pull the maxima/minima values seems to be pretty independent of the PeakFinder script, but rather is a gap in the built-in macro functions around the PlotProfile function. I can extract the x0, y0 values (which aren't useful), but not the x1,y1, x2,y2, etc. Have you found a work around, or did you just re-code your macro into the beanshell script?
Reply | Threaded
Open this post in threaded view
|

Re: Getting the values of a Plot Profile after using peak finder script

Burni
Sorry, I didn't find a way to access the entries externally either.
As you said, I rewrote my entire macro in Beanshell and took the entries from the arrays the script works with.
Getting the entries when using Beanshell is pretty easy, but rewriting your own macro is probably the most work.

Regards, Burni