Error: dont find symbol imp

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

Error: dont find symbol imp

smfmazz
Hi. The imageJ compiler show me this messages:

java.lang.ArrayIndexOutOfBoundsException: 262144
        at Filter_Plugin.run(Filter_Plugin.java:24)
        at ij.plugin.filter.PlugInFilterRunner.processOneImage(PlugInFilterRunner.java:249)
        at ij.plugin.filter.PlugInFilterRunner.<init>(PlugInFilterRunner.java:102)
        at ij.IJ.runUserPlugIn(IJ.java:186)
        at ij.ImageJ.runUserPlugIn(ImageJ.java:257)
        at ij.plugin.PlugInExecuter.run(Compiler.java:264)
        at java.lang.Thread.run(Thread.java:619)

why? The code of my plugins should be correct:


import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.filter.*;

public class Filter_Plugin implements PlugInFilter {
       
        protected ImageStack stack;

        public int setup(String arg, ImagePlus imp) {
                stack = imp.getStack();
                return DOES_ALL + STACK_REQUIRED;
        }

        public void run(ImageProcessor ip) {
                 byte[] pixels;
        int dimension = stack.getWidth()*stack.getHeight();
        int[] sum = new int[dimension];

        for (int i=1; i<=stack.getSize(); i++){
            pixels = (byte[]) stack.getPixels(i);
            for (int j=1; j<=dimension; j++){
                sum[j] +=0xff & pixels[j];
            }
        }

        byte[] average = new byte[dimension];

        for (int j=1; j<=dimension; j++) {
            average[j] =(byte) ((sum[j]/stack.getSize()) &0xff);
        }

        stack.addSlice("Average Plugin", average);


        }

}

can you help me?