This artifact is a consequence of the adaptive thresholding method. This approach tiles the image into non-overlapping block and thresholds each individually. Unfortunately, if the block has no foreground, the threshold can becomes too low and end up identifying false positives, as you discovered.
One straightforward way to avoid this is to set the lower threshold bound to the lowest grayscale value that you think represents the foreground. However, I think a better way to improve identification in general for your images is the following:
- Insert an EnhanceOrSupressFeatures module prior to the IdentifyPrimaryObject module. Set the filter size to approximately the typical pixel width the bacillus objects (perhaps 15-20 pixels)
- Use the output of this module as the input into the IdentifyPrimaryObject module.
- Change the IdentifyPrimaryObject module threshold settings to Otsu global, three class thresholding, with the middle class set to “Background”
You can use the object diameter settings to get rid of the remaining spurious false positives.