void avg_col(ImageProcessor ip) { float sum; // sum of pixel values column float avg; // average pixel value of a column float[] sliceavgs = new float[width]; // means across columns of one slice int sliceNumber = ip.getSliceNumber() - 1; // slice number for (int x = 0; x < width; x += 1) { sum = 0; // reset with each column avg = 0; // reset with each column for (int y = 0; y < height; y += 1) { sum = sum + ip.getPixelValue(x, y); } avg = sum / height; sliceavgs[x] = avg; // building array of means } this.slicecols[sliceNumber] = sliceavgs; // add this slice's means to array }