macro 'Subtract Background Image from an NIH-Image Stack' var i:integer; begin if nSlices=0 then begin {Check if there is a stack open} PutMessage('Sorry, this macro only works on stacks.'); exit; end; PutMessage('Open the background image you wish subtracted from the stack.'); Open(''); {Lets you go and find the background image} SelectAll; {Selects the Background image} Copy; {Copies the Background image to the clipboard} Dispose; for i:= 1 to nSlices do begin SelectSlice(i); ShowPasteControl; Paste; SetOption; Subtract; {Subtract the stored background from each slice in the stack} end; PutMessage('Save the subtracted stack as a new stack.'); SaveAs(''); {Allows you to save the new stack under a new name, keeping the} Dispose; {original intact} end;