Reduced background reoccurs

Hi!
I’m having an issue with Image Analysis as the Background I tried to reduce in several steps reoccurs as shown below between step 3 and 4, even though it seems clear which signals should be counted. Thats the macro I wrote:

originalImageName=getTitle();
run(“Split Channels”);
selectWindow(“C1-”+originalImageName);
run(“Duplicate…”, “duplicate channels=1”);
close(“C4-”+originalImageName);
close(“C2-”+originalImageName);
close(“C3-”+originalImageName);
close(“C5-”+originalImageName);
close(“C6-”+originalImageName);
run(“Subtract Background…”, “rolling=10”);
run(“Duplicate…”, " ");
setMinAndMax(14, 255); //Brightness and Contrast
run(“Duplicate…”);
setAutoThreshold(“Moments dark”);
//setThreshold(100, 255);
setOption(“BlackBackground”, true);
run(“Convert to Mask”);
run(“Duplicate…”);
run(“Remove Outliers…”, “radius=0.5 threshold=50 which=Bright”);
run(“Duplicate…”);
run(“Watershed”);
run(“Duplicate…”);
//Analyze
run(“Analyze Particles…”, “size=7-Infinity pixel circularity=0.50-1.00 show=Outlines display exclude clear summarize add”);

If i apply each step manually it works perfectly fine. Also with other Images I didnt have any issues.

Thanks you for any advice!

Hi @marieschulte,

Welcome to the forum. You have a problem with backgrounds that reappear between step 3 and 4. Do you mean lines 3 and 4 or do you mean between the third and fourth image of your collage? By the looks of it, you have a 6-channel source image. My hunch is that you set a minimum and maximum but that you don’t apply this in time, but only after the Duplicate, which may reset the limits.

Could you post the original tiff file for us? Then we can apply your macro and see what happens.

PS. when posting code, select the </> tool in the edit window, then paste your code in between the two lines with three single left qoutes replacing the type or paste code here; your code will then be colour-coded and properly formatted. Currently the run("Duplicate..."); (with three full stops and straight double quotes) is displayed as run(“Duplicate…”); with inverted comma’s and ellipses, which is no longer recognised by our macro language interpreter.

Hi @eljonco,

thank you for your comment and your recommendation regarding posting the code, I will do it this way for any further questions I might have.

Also you were right with not applying the min/max, I hadn’t correctly added this. Now it works fine! :slight_smile: Thank you!