Macro command to subtract background

I want to include the Subtract Background function in a macro, but imageJ won’t recognize run(“Subtract Background”) as a command. Is it possible to include that function in a macro?

Hi jg211,

you should either use :

run("Subtract Background...");

and the window pops-up
or specify the radius you want to use

radius = 20 ;
run("Subtract Background...", "rolling="+radius);

Note that different radius have different results, but you may have notice that already !

Cheers,

Romain

2 Likes

If I wanted to check the “light background” box, how would I include that?

run("Subtract Background...", "rolling=20 light stack");

You can find out see the macro behind every command it by ussing the ‘Record’ macro command in Fiji (under Plugins>>Macros >>Record)

2 Likes

Hi there,
I am trying to perform the Background Substraction using macros on videos but it perform it only on the first image of the video. Have you got a advice?
Here is my macro line: run(“Subtract Background…”, “rolling=20”);