Plot Profile Data

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

Plot Profile Data

davek604
Hello
I'm cuurently writing a plugin which involves some processing of data extracted from a plot profile. Unfortunately I can't figure out how to get the raw data values out of the profile into an array. The code I'm trying is below.

ProfilePlot theplot = new ProfilePlot();
theplot.getPlot();
double thedata[] = theplot.getProfile();

Any help appreciated

Regards

David
Reply | Threaded
Open this post in threaded view
|

Re: Plot Profile Data

Peter Haub
Hi David,

if you are talking about the values of the PlotWindow try this:

boolean averageHorizontally = false; // true
PlotProfile profile = new PlotProfile(imp, averageHorizontally );
double[] data = profile.getProfile();

Plot plot = profile .getProfile();
PlotWindow pw = plot.show();
float[] fX =  pw.getXValues();
float[] fY =  pw.getYValues();
pw.close();


Regards,
Peter

On 07.12.2015 23:00, davek604 wrote:

> Hello
> I'm cuurently writing a plugin which involves some processing of data
> extracted from a plot profile. Unfortunately I can't figure out how to get
> the raw data values out of the profile into an array. The code I'm trying is
> below.
>
> ProfilePlot theplot = new ProfilePlot();
> theplot.getPlot();
> double thedata[] = theplot.getProfile();
>
> Any help appreciated
>
> Regards
>
> David
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Plot-Profile-Data-tp5015167.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> 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: Plot Profile Data

davek604
Hello Peter

Thanks for replying but unfortunately it still doesn't work. The variable profile seems to pick up the plot profile window as it gets its name correct, but none of the data within the window is picked up. The variables data and plot both remain null. Still confused as looking at the API both of our methods should work.

Regards

David
Reply | Threaded
Open this post in threaded view
|

Re: Plot Profile Data

davek604
Hello Peter

Sorry it does work, it suddenly occurred that your code was creating the plot profile from the line on the image rather than from an already created plot window which is what I was using.

So thank you, works great.

Regards

David
Reply | Threaded
Open this post in threaded view
|

Re: Plot Profile Data

Emanuele Martini
Hey Dave,
a year ago I wrote a plugin that took the values of a plot window.
If I remember well, I used these lines:
 
   pplot=WindowManager.getCurrentWindow()
   X_distance=pplot.XValues;
   X_distance_list=X_distance.tolist();

the trick is to pay attention in getCurrentWindow, you have to be sure that the last active window is the plot.
If not, you can pass by WindowManager.getWindow("name of your window").
I wrote it in Jython.

Hoping to be helpful,
have anice day,
Emanuele
Image Analyst @Ifom-IEO research campus -MI-
Reply | Threaded
Open this post in threaded view
|

Re: Plot Profile Data

davek604
Hello Emanuele,

Also works thanks.

Cheers

Dave