Plot.getValues(values, counts);

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

Plot.getValues(values, counts);

GAUTAM SHANKAR
Plot.getValues(values, counts);

I cannot do this in Java.

WHY!?
Reply | Threaded
Open this post in threaded view
|

Re: Plot.getValues(values, counts);

Jerome Mutterer-3
>
> Plot.getValues(values, counts);

I cannot do this in Java.

WHY!?


Hi,
Go the the ImageJ source code, look in ij.macro.Functions.java
Search for string 'getValues'.
In the doPlot method, you see that getValues calls the getPlotValues();
method.
You find the source code for this method at line 1809.
There you can see how this function works, and that PlotWindow has
getXValues() and getYValues() methods.

http://pacific.mpi-cbg.de/cgi-bin/gitweb.cgi?p=imagej.git;a=blob;f=ij/macro/Functions.java;h=8ef6ee95567c52e4f086f977df50e26b79165735;hb=01bad343381f71d48781f291899896cb38ee80a4#l1809

Jerome


On Fri, Jul 9, 2010 at 10:56 PM, GAUTAM SHANKAR <[hidden email]> wrote:

> Plot.getValues(values, counts);
>
> I cannot do this in Java.
>
> WHY!?
>
Reply | Threaded
Open this post in threaded view
|

Re: Plot.getValues(values, counts);

dscho
Hi,

On Fri, 9 Jul 2010, Jerome Mutterer wrote:

> > Plot.getValues(values, counts);
>
> I cannot do this in Java.
>
> WHY!?

Well, you can. If you read the source code up until this point, that is:

http://pacific.mpi-cbg.de/cgi-bin/gitweb.cgi?p=ImageJA.git;a=blob;f=ij/macro/Functions.java;h=4a7b28e77328f96491a1c9b7f480db969c753092;hb=7bbce1e02aa3ba1971533441e9a50c75764c8e92#l1810

Ciao,
Dscho
Reply | Threaded
Open this post in threaded view
|

Re: Plot.getValues(values, counts);

GAUTAM SHANKAR
Thanks for links guys, but I just don't know how to implement.

so I've just run

IJ.run("Plot Profile");

then

I want to so something like this

ij.macro.Functions.getPlotValues(x, y);





On Sat, Jul 10, 2010 at 12:44 PM, Johannes Schindelin <
[hidden email]> wrote:

> Hi,
>
> On Fri, 9 Jul 2010, Jerome Mutterer wrote:
>
> > > Plot.getValues(values, counts);
> >
> > I cannot do this in Java.
> >
> > WHY!?
>
> Well, you can. If you read the source code up until this point, that is:
>
>
> http://pacific.mpi-cbg.de/cgi-bin/gitweb.cgi?p=ImageJA.git;a=blob;f=ij/macro/Functions.java;h=4a7b28e77328f96491a1c9b7f480db969c753092;hb=7bbce1e02aa3ba1971533441e9a50c75764c8e92#l1810
>
> Ciao,
> Dscho
>
Reply | Threaded
Open this post in threaded view
|

Re: Plot.getValues(values, counts);

Jerome Mutterer-3
On Mon, Jul 12, 2010 at 7:11 PM, GAUTAM SHANKAR <[hidden email]> wrote:

> Thanks for links guys, but I just don't know how to implement.
>
>
OK, here is some sample java code :

IJ.run("Plot Profile");
float[] xvalues = new float[0];
float[] yvalues = new float[0];
ImagePlus imp = IJ.getImage();
ImageWindow win = imp.getWindow();
if (win!=null && win instanceof PlotWindow) {
  PlotWindow pw = (PlotWindow)win;
  xvalues = pw.getXValues();
  yvalues = pw.getYValues();
}
IJ.log(IJ.d2s(xvalues.length));


Jerome
Reply | Threaded
Open this post in threaded view
|

Re: Plot.getValues(values, counts);

GAUTAM SHANKAR
Wow, I could have swore I tried the same thing..

Anyways, It works now. THANKS SO MUCH. I was stuck on this one for a while.

On Mon, Jul 12, 2010 at 10:26 AM, Jerome Mutterer <
[hidden email]> wrote:

> On Mon, Jul 12, 2010 at 7:11 PM, GAUTAM SHANKAR <[hidden email]>
> wrote:
>
> > Thanks for links guys, but I just don't know how to implement.
> >
> >
> OK, here is some sample java code :
>
> IJ.run("Plot Profile");
> float[] xvalues = new float[0];
> float[] yvalues = new float[0];
> ImagePlus imp = IJ.getImage();
> ImageWindow win = imp.getWindow();
> if (win!=null && win instanceof PlotWindow) {
>  PlotWindow pw = (PlotWindow)win;
>  xvalues = pw.getXValues();
>  yvalues = pw.getYValues();
> }
> IJ.log(IJ.d2s(xvalues.length));
>
>
> Jerome
>