Writing to ResultsTable

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

Writing to ResultsTable

Michal Lijowski-2
Hello,

I need help or hint where I can find hint how to write statistics into the
results table inside the plugin.

Here is my code.

import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.*;
import ij.plugin.filter.PlugInFilter;
import ij.measure.ResultsTable;

// writes statistics into the results table

public class MyPlugin_ implements PlugInFilter {

        public int setup(String arg, ImagePlus imp) {
                if (arg.equals("about"))
                        {showAbout(); return DONE;}
                return DOES_ALL;
        }

        public void run(ImageProcessor ip) {
                int width = ip.getWidth();
                Rectangle r = ip.getRoi();

                ImagePlus imp = IJ.getImage();
                ImageStatistics stat = imp.getStatistics();
                int mean = (int) stat.mean;
                int stdDev = (int) stat.stdDev;
                ResultsTable rt = ResultsTable.getResultsTable();
                rt.show("Results");
                ????????????????????????????????????????
        }
        void showAbout() {
                IJ.showMessage("About My_Plugin...",
                      "Test plugin"
                );
        }
}

Thank you for your attention.

  Michal
Reply | Threaded
Open this post in threaded view
|

Re: Writing to ResultsTable

Wayne Rasband
There is an example plugin at

      http://rsb.info.nih.gov/ij/plugins/sine-cosine.html

that demonstrates how to add values to the Results table.

-wayne

On Oct 12, 2006, at 1:16 PM, Lijowski, Michal wrote:

> Hello,
>
> I need help or hint where I can find hint how to write statistics into
> the
> results table inside the plugin.
>
> Here is my code.
>
> import ij.*;
> import ij.process.*;
> import ij.gui.*;
> import java.awt.*;
> import ij.plugin.*;
> import ij.plugin.filter.PlugInFilter;
> import ij.measure.ResultsTable;
>
> // writes statistics into the results table
>
> public class MyPlugin_ implements PlugInFilter {
>
>         public int setup(String arg, ImagePlus imp) {
>                 if (arg.equals("about"))
>                         {showAbout(); return DONE;}
>                 return DOES_ALL;
>         }
>
>         public void run(ImageProcessor ip) {
>                 int width = ip.getWidth();
>                 Rectangle r = ip.getRoi();
>
>                 ImagePlus imp = IJ.getImage();
>                 ImageStatistics stat = imp.getStatistics();
>                 int mean = (int) stat.mean;
>                 int stdDev = (int) stat.stdDev;
>                 ResultsTable rt = ResultsTable.getResultsTable();
>                 rt.show("Results");
>                 ????????????????????????????????????????
>         }
>         void showAbout() {
>                 IJ.showMessage("About My_Plugin...",
>                       "Test plugin"
>                 );
>         }
> }
>
> Thank you for your attention.
>
>   Michal
>