Ok, The code below accesses the pixels in a stack and if they are >0 sets them to a new value. This should help get you started.
Regards
import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.filter.*;
public class StackAccess_Plugin implements PlugInFilter
{
ImagePlus imp;
public int setup(String arg, ImagePlus imp)
{
this.imp = imp;
return DOES_ALL+STACK_REQUIRED;
}
public void run(ImageProcessor ip)
{
ImageStack stack;
int width,height,depth;
int i,j,k;
stack = imp.getStack();
width = stack.getWidth();
height = stack.getHeight();
depth = stack.getSize();
for(k=0;k<depth;k++)
{
for(j=0;j<height;j++)
{
for(i=0;i<width;i++)
{
if(stack.getVoxel(i,j,k)>0) stack.setVoxel(i,j,k,i+j+k);
}
}
}
}
}
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html