ImageProcessor.setValue() or .setColor() not affecting FloodFiller

Hi all,

I am currently developing a headless running image processing tool and getting nuts because my flood-filling in a binary image is not working and I have no idea why.

This is what I do:

I cycle through ROIs and run AnalyzeParticles. Thereafter, I would like to eliminate specific particles (in each ROI) which meet some consitions. I have done this before using the FloodFiller.fill8 method and it was running. I am defining the fill color beforehand by ImageProcessor.setValue(0.0) (I also tried

The part which should eliminate the particles looks basically like follows

FloodFiller ff = new FloodFiller(ip);
ff.fill8(x, y);

x and y are the “XStart” and “YStart” coordinated retrieved from the results table created during ROI analysis. Those coordinates are also retrieved correctly.

Everything works except that my flood filler floods some particles in the first ROI with a gray value of 64. Thereafter, the image is obviously no binary image any more and the second ROI cannot be analyzed using AnalyzeParticles.

I tried negative values like -127.0 because I thought it somehow works with signed values, but nothing changes. The fill color stays at a gray value of 64.
Since everything else works it has to be linked to the definition of the fill color.

Did anybody else face this problem and potentially found/has a solution for it?

Thanks in advance

Ok, kind of solved it.

putting the FloodFiller more downstream after an ImagePlus.setRoi(roi) and ImagePlus.killRoi() sequence instead of before it somehow solved the problem, while I actually still don’t understand why :blush:

1 Like