ImageJ Inconsistency

Hi everyone!

I recently came across a strange inconsistency that I found when I was running some test cases.

As shown below, when I run a simple macro to quantify the cells in this image, ImageJ goes crazy and starts drawing in random lines everywhere. The strange thing is that I have had this macro for a while, and whenever I ran this macro in the past, it would always produce images with ROIs drawn neatly around each cell, and not all over the place like this. I have not changed any settings in ImageJ, nor have I touched the macro one bit, so I was hoping to figure out why this is happening.
This macro I am using is pasted below:

setOption("ScaleConversions", true);
run("Auto Local Threshold...", "method=Bernsen radius=15 parameter_1=40 parameter_2=0 white");
run("Analyze Particles...", "size=10-Infinity clear summarize add");

Thanks so much!

1 Like

Hi Joseph,

This looks like your image is back-to-front. Is your LUT inverted of your starting image inverted? The watershed always segments the black region on the image. If you want to split the white regions, you need to invert your thresholded image.


Did you check if the Black background setting in Process › Binary › Options… is selected?

Even if you didn’t change that setting manually, there are some macros/plugins that do so without telling you, leaving you in fact with changed settings.

That’s incorrect. The behavior depends on above option (Black background).


Thanks Jan,
I thought there was a setting somewhere that changed this behaviour (I was checking the settings for the background and foreground colours, which don’t have any effects), but overlooked the Binary > Options setting. Thanks for correcting my oversight.

1 Like

Ah I see, that seems to be the problem! I just ran another test and it’s working perfectly now! Thank you so much for everyone’s help!!!