Re: opening and saving 2 results window

Posted by Fernando Sales on
URL: http://imagej.273.s1.nabble.com/opening-and-saving-2-results-window-tp3692423p3692426.html

Donny,

i've been working with ResultsTable on my plugins as described in IJ plugins
page <http://rsbweb.nih.gov/ij/plugins/download/Sine_Cosine_Table.java>.
However, another possibility for you is to save your results into a
TextPanel.
It's simple to create one new TextPanel and you can write lines easily.
Example:

TextPanel panel = new TextPanel();
panel.appendLine("Results");
panel.appendLine("Original Image \t \t Processed Image");
panel.appendLine("Value \t Old Counts  \t New Counts");

for(int i=0; i< nBins;i++){
   panel.appendLine(i+" \t"+histogram_old[i]+"\t"+histogram_new[i]);
}

panel.saveAs(filename);

Using TextPanel you'll not able to display the results inside of ImageJ but
i'll save the results into a txt file. But, if you want to show the results
and save them, just repeat the previous steps using a TextWindow instead of
a TextPanel.
I've been using these two classes to save/display informations of my
plugins.

I hope this works.
Best regards,
Fernando




On Mon, May 25, 2009 at 9:54 AM, Donny George <[hidden email]> wrote:

> hello fernando
>
> thankyou for the idea.i tried this but i have not been able to get it
> working. however i did it by having two loops
>
> is there also any way to integrate to result table without loosing the info
> from each of them
>
>  nBins = 256;
>  run("Clear Results");
>  row = 0;
>  getHistogram(values, counts, nBins);
>  for (i=0; i<nBins; i++) {
>      setResult("Value", row, values[i]);
>      setResult("Count", row, counts[i]);
>      row++;
>   }
>  updateResults();
>
> run("Measure");
>    title=getTitle();
>           setResult("Label", nResults-1, "True Value "+title);
>           updateResults();
>
> any clue ?
>
>
> don
>
>
> On Fri, May 22, 2009 at 9:01 PM, Fernando Sales <[hidden email]
> >wrote:
>
> > Donny,
> > there's a possible solution using the method ResultsTable.clone(). I
> think
> > you can use the resultstable for the original table and clone it. After
> > this, process the image and uses the first resultsTable to show your
> > results.
> > Try it.
> > Best regards,
> > Fernando
> >
> > On Fri, May 22, 2009 at 6:39 AM, Donny George <[hidden email]>
> wrote:
> >
> > > hello
> > >
> > > for a specific macro that i am writing, i want to save my results into
> 2
> > > results window. one to save the properties of the original image and
> the
> > > other one to save the properties of the image after being manipulated.
> > but
> > > i
> > > am not sure how i could open a new results window,
> > >
> > >
> > > run("Measure");
> > >    title=getTitle();
> > >           setResult("Label", nResults-1, "True Value "+title);
> > >           updateResults();
> > >
> > >    getStatistics(pixels, mean, min, max, std, histogram);
> > >    setMinAndMax(mean*0.6666,mean+0.3333*(255-mean));
> > >    run("Smooth");
> > >
> > >    run("Enhance Contrast", "saturated=0.2");
> > >
> > >
> > >    run("Measure");
> > >    title=getTitle();
> > >           setResult("Label", nResults-1, "Modified "+title);
> > >           updateResults();
> > >
> > >    //run("Histogram");
> > >
> > >        }
> > >
> > > selectWindow("Results");
> > > saveAs("Measurements", "");
> > >
> > >
> > > could some one put in some comments to help me
> > >
> > > thank you
> > >
> > >
> > > --
> > > Donny George
> > >
> >
>
>
>
> --
> Donny George
>