open tab delimited file in resultsTable

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

open tab delimited file in resultsTable

Thorsten Sy
Hello all,

from a plugin I want to open a tab-delimited file with parameters. Therefore I tried to load it as a resultsTable, but got empty result windows only.
Probably it is more related to my insufficient java knowledge than to ImageJ, but perhaps you can give me a hint anyway.


Here is my code:

                String pfad = <path of the file>;
                ResultsTable rt = new ResultsTable();
                try {
                rt.open(pfad);
                } catch (IOException e) {
                        IJ.error("Error Read - " + e.toString());
                }

                rt.show("Results");

Best regards,

Thorsten
Reply | Threaded
Open this post in threaded view
|

Re: open tab delimited file in resultsTable

Rasband, Wayne (NIH/NIMH) [E]
On Mar 6, 2012, at 8:00 AM, Thorsten Sy wrote:

> Hello all,
>
> from a plugin I want to open a tab-delimited file with parameters. Therefore I tried to load it as a resultsTable, but got empty result windows only.
> Probably it is more related to my insufficient java knowledge than to ImageJ, but perhaps you can give me a hint anyway.
>
>
> Here is my code:
>
> String pfad = <path of the file>;
> ResultsTable rt = new ResultsTable();
> try {
> rt.open(pfad);
> } catch (IOException e) {
> IJ.error("Error Read - " + e.toString());
> }
>
> rt.show("Results");

ResultsTable.open() is a static method that returns a ResultsTable, so the code to open and display a results table should be:

   String pfad = <path of the file>;
   ResultsTable rt = null;
   try {
      rt = ResultsTable.open(pfad);
   } catch (IOException e) {
      IJ.error("Error Read - " + e.toString());
   }
   if (rt!=null)
      rt.show("Results");

-wayne
Reply | Threaded
Open this post in threaded view
|

Re: open tab delimited file in resultsTable

Thorsten Sy
In reply to this post by Thorsten Sy
Am 07.03.2012 um 06:00 schrieb Wayne Rasband:

> Date:    Tue, 6 Mar 2012 10:43:19 -0500
> From:    "Rasband, Wayne (NIH/NIMH) [E]" <[hidden email]>
> Subject: Re: open tab delimited file in resultsTable
>
> ResultsTable.open() is a static method that returns a ResultsTable, so the code to open and display a results table should be:
>
>   String pfad = <path of the file>;
>   ResultsTable rt = null;
>   try {
>      rt = ResultsTable.open(pfad);
>   } catch (IOException e) {
>      IJ.error("Error Read - " + e.toString());
>   }
>   if (rt!=null)
>      rt.show("Results");
>
> -wayne

Worked!

Thank you very much,

Thorsten