Stack Sorter in a Fiji macro

Dear all,

I am writing a macro for image analysis. To help me to understand and verify the results later on, I am creating and saving a stack of all the in-between steps at the end of the macro. The order of the images within the stack is the order of creating them in the macro. However, it would be useful to change the order for retracability. This can be done manually with the Stack Sorter, but when I use the macro recorder, only this appears:
run(“Stack Sorter”);

Is there a way to automate it? The images always have the same names (e.g. dapi, dapi-mask, …). I tried selecting them in the order I want them to have, but this didn’t help.

Thanks a lot!

Hi Theresa, welcome to the forum.

I’m having a bit of trouble understanding what you are trying to accomplish here. Sounds like you want to rename and/or reorder images within your stack?

I recommend the Built In Macro Functions page for ImageJ. This, in combination with the recording tool, can usually help you figure out exactly what you want to do. Try ctrl+F searching ‘stack’ functions and see if any of the ones that come up are helpful.