help me with creating cells/tabeles names in result window

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

help me with creating cells/tabeles names in result window

tescik
This post was updated on .
Dear IJ users,

I have problem with my function. I writing my results to 'result window' but there is no tabeles/cells(like min,max, x , y) - nothing. I using 3 string but its only 1 column. Here is similar function (i cant publish my) , can u show me how to edit it, for exp. 3 tabeles on top menu in result window ?

  import ij.*;
        import ij.process.*;
        import ij.gui.*;
        import java.awt.*;
        import ij.plugin.*;
       
        public class Calculate_Mean implements PlugIn {

                public void run(String arg) {
                        ImagePlus imp = IJ.getImage();
                        Roi roi = imp.getRoi();
                        if (roi!=null && !roi.isArea()) roi = null;
                        ImageProcessor ip = imp.getProcessor();
                        ImageProcessor mask = roi!=null?roi.getMask():null;
                        Rectangle r = roi!=null?roi.getBounds():new Rectangle(0,0,ip.getWidth(),ip.getHeight());
                        double sum = 0;
                        int count = 0;
                        for (int y=0; y<r.height; y++) {
                                for (int x=0; x<r.width; x++) {
                                        if (mask==null||mask.getPixel(x,y)!=0) {
                                                count++;
                                                sum += ip.getPixelValue(x+r.x, y+r.y);
                                        }
                                }
                        }
                        IJ.write("count: "+count);
                        IJ.write("mean: "+IJ.d2s(sum/count,4));
                }

        }