Z-stack adding slices

Dear all,
I have a Z-stack and I would like to include one black slice at the beggining, another at slice 10, and another at the end. I want to type number 1 on black slice 1, number 2 on slice number 10 and number 3 on the last black slice.
Can anyone help me? I would like to have some IJ1 macro lines to add to my macro that does the job.

Ideally I would like also to flatten/overlay the text so it stays when I save the timelapse movie.

Best regards,

To add a slice at position 1 you have to add it at position 2 and exchange the content of slice 1 and 2. The rest is straight foreward:

run("Add Slice");
run("Select All");
run("Select All");
setBackgroundColor(0, 0, 0);
run("Clear", "slice");

run("Add Slice");

run("Add Slice");

setFont("SansSerif", 100, " antialiased");

Overlay.drawString("1", 66, 168, 0.0);
Overlay.setPosition( 1 );	

Overlay.drawString("2", 66, 168, 0.0);
Overlay.setPosition( 12 );	

Overlay.drawString("3", 67, 168, 0.0);
Overlay.setPosition( nSlices );	


//run("Flatten", "stack");
1 Like

Many thanks it worked.

I was wondering, when I type a string and do overlay in the z-stack, if I add afterwards another black slice, the string appears in that new black slice and disappear in the last slice. Is there any way to add a string over the whole Z-stack but without overlaying it?

The overlay portions are linked with the slice number.
If you add a slice the following slice numbers are incremented and the overlay portions look as if they are shifted.

What do you mean with ‘add but not overlaying’?