To process all the slices in a stack you need to add the stack option, so it
IJ.run("Image Calculator...", "image1="+img1.getTitle()+" operation=Subtract
>image2="+img2.getTitle()+" create stack");
A useful tool is the macro recorder - Plugins->Macro->Record
If you record the successful operation of a command in imagej you get the
correct syntax to use in a plugin - just change "run(..." to "IJ.run(..."
>I am trying to subtract 2 images from each other in a plugin using Image
>Calculator. After looking in the ImageJ archives I found that I could use
>IJ.run("Image Calculator...", "image1="+img1.getTitle()+" operation=Subtract
>image2="+img2.getTitle()+" create");. The only problem I have with this is
>that the output is only one slice thick and I would like the result to be done
>to each slice in my images. Does anyone have a suggestion for what I can do?