Simple Macros for Image Processing of Stacks

Hi, Im new to using Macro in ImageJ and what I want to do is dead simple.

  1. Split channels
  2. close DIC/transmission image
  3. Z-stack the FL channel
  4. close the stack

I used:

run("Split Channels");
close();
run("Z Project...", "projection=[Max Intensity]");
selectWindow("C...")
run("Close");

It works til the last part, where it closes the MAX projection instead of the C1 stack.
Is there anyway to do selectionwindow (“C1…”) something and then close the selected window?
Would appreciate any help.

Cheers,

Eric

Hi Eric, welcome to the forum!

Have a look at the macro function documentation, you can use:

  • selectImage(title) using the image name,
  • selectImage(id) using an image ID that you can get via getImageID()

and you can also close all images whose title matches a given pattern:

  • close(pattern)
3 Likes