A very useful simple plugin that takes an image stack and creates one image which contains max projections along all three axes. It uses .getPixelValue() to find the brightest pixel.
My code is below. Dr. Kota Miura has made a modified "library" version that also includes a scaling feature. His can be found here.
/* * XYZ_MaxProject.java * * Makes a composite image with x,y, and z projections. Comparisons * were were made using the getPixelValue() method to compare. * * Created on July 30, 2005, 2:28 PM * */ /** * * @author Peter */ import ij.*; import ij.io.*; import ij.process.*; import ij.gui.*; import java.awt.*; import java.io.File; import ij.plugin.*; public class XYZ_MaxProject implements PlugIn { final static int FRAME_WIDTH = 10; public void run(String arg) { // Get image info and setups ImagePlus img = WindowManager.getCurrentImage(); ImageStack stk = img.getStack(); int x = stk.getWidth(); int y = stk.getHeight(); int z = stk.getSize(); // Create xy Processor with room for xz and yz ImageProcessor output = stk.getProcessor(1).createProcessor(x+z+FRAME_WIDTH,y+z+FRAME_WIDTH); for (int iz = 1; iz <= z; iz++){ ImageProcessor currentPlane = stk.getProcessor(iz); for (int ix = 0; ix < x; ix++){ for (int iy = 0; iy < y; iy++){ float pixel = currentPlane.getPixelValue(ix,iy); /*if (iz == 1) { output.copyBits(pixelImp,ix,iy,Blitter.COPY); output.copyBits(pixelImp,ix,iz+y+FRAME_WIDTH,Blitter.COPY); output.copyBits(pixelImp,iz+x+FRAME_WIDTH,iy,Blitter.COPY); } else { output.copyBits(pixelImp,ix,iy,COPY_MODE); output.copyBits(pixelImp,ix,iz+y+FRAME_WIDTH,COPY_MODE); output.copyBits(pixelImp,iz+x+FRAME_WIDTH,iy,COPY_MODE); } */ if ((pixel > output.getPixelValue(ix,iy)) || (iz ==1)){ output.putPixel(ix,iy,currentPlane.getPixel(ix,iy)); } if ((pixel > output.getPixelValue(ix,iz+y+FRAME_WIDTH)) || (iy ==0)){ output.putPixel(ix,iz+y+FRAME_WIDTH,currentPlane.getPixel(ix,iy)); } if ((pixel > output.getPixelValue(iz+x+FRAME_WIDTH,iy)) || (ix ==0)) { output.putPixel(iz+x+FRAME_WIDTH,iy,currentPlane.getPixel(ix,iy)); } } } } ImagePlus xyzimp = new ImagePlus("XYZ Max Projection", output); xyzimp.show(); } }