Get the values from a non-system Results Table

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

Get the values from a non-system Results Table

lechristophe
Hi,

I'd like to process the Results Table output at the end of a plugin,
i.e. launch a script that would get the values in this displayed Table
after the plugin has finished. However, this Table is not the System
Results Table, so the ResultsTable.getResultsTable() static method
does not work. How can I do that? Is there something that would grab
the content of a text table and create a Results Table object from it?

Thanks,

Christophe
Reply | Threaded
Open this post in threaded view
|

Re: Get the values from a non-system Results Table

Gabriel Landini
On Tuesday 20 Mar 2012 14:31:50 you wrote:
> I'd like to process the Results Table output at the end of a plugin,
> i.e. launch a script that would get the values in this displayed Table
> after the plugin has finished. However, this Table is not the System
> Results Table, so the ResultsTable.getResultsTable() static method
> does not work. How can I do that? Is there something that would grab
> the content of a text table and create a Results Table object from it?


Save the table and re-import it in to the real Results table.
Or maybe you can copy it all, parse the cell entries and put it in the real
RT.

Cheers
G.
Reply | Threaded
Open this post in threaded view
|

Re: Get the values from a non-system Results Table

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by lechristophe
On Mar 20, 2012, at 10:31 AM, Christophe Leterrier wrote:

> Hi,
>
> I'd like to process the Results Table output at the end of a plugin,
> i.e. launch a script that would get the values in this displayed Table
> after the plugin has finished. However, this Table is not the System
> Results Table, so the ResultsTable.getResultsTable() static method
> does not work. How can I do that? Is there something that would grab
> the content of a text table and create a Results Table object from it?

Here is JavaScript code that creates a results table named "Sine/Cosine Table":

   rt = new ResultsTable();
   for (n=0; n<=2*Math.PI; n += 0.1) {
      rt.incrementCounter();
      rt.addValue("n", n);
      rt.addValue("Sine(n)", Math.sin(n));
      rt.addValue("Cos(n)", Math.cos(n));
   }
   rt.showRowNumbers(false);
   rt.show("Sine/Cosine Table");

And here is JavaScript code that gets that table's ResultsTable:

   window = WindowManager.getFrame("Sine/Cosine Table");
   if (window!=null) {
      rt = window.getTextPanel().getResultsTable();
   }

This is what it looks like in Java:

   Frame window = WindowManager.getFrame("Sine/Cosine Table");
   if (window ==null) return;
   ResultsTable rt = ((TextWindow)window).getTextPanel().getResultsTable();

-wayne