Measure voiding in solder alloys of electronic devices


I am investigating the voiding in solder alloys of electronic devices with x-ray images.
The basic task is to measure (size, number, histogram) the bright voids within the dark solder balls. What makes things difficult is the underlying structure of the board, because of which I cannot simply threshold the image.
My approach was to use mathematical filters to get rid of the background and then bandpass filter the image. It works OK I guess, but some voids are not detected (e.g. because of overlap with edges from the background) and I have to manually “cut open” the surrounding circles of the solderballs so Analyze Particles is able to find the voids.
The original image, my result and the code I used are shown below.

Is there a way to improve the detection of the voids and maybe get rid of the manual step of “opening” the solderball circles?

Thanks in advance,

run("Duplicate...", "title=original");
run("Duplicate...", "title=duplicate");
run("Min...", "value=100");
imageCalculator("Subtract create", "duplicate","original");
run("Bandpass Filter...", "filter_large=10 filter_small=0 suppress=None tolerance=5 autoscale saturate");
run("Auto Local Threshold", "method=Contrast radius=15 parameter_1=0 parameter_2=0 white");
run("Remove Outliers...", "radius=5 threshold=1 which=Dark");
run("Make Binary");
setForegroundColor(0, 0, 0);
waitForUser("Open the circles using the paint brush tool.");
run("Analyze Particles...", "size=10-infinity circularity=0.8-1.00 show=Masks exclude include add");

Let’s see if I understand correctly. The issue with basic thresholding is that you will caption the strcture outside the balls because they are even brighter than the voids?

Okay first, ImageJ has an erode/dilate/close/open built-in and it can be called from a script. You might want to see if you can use that instead of manually opening the voids.

I am not sure how accurate it will be, but I would have tried to do thresholding. Yes you get the outside, but you should be able to use the wand selection tool (which can also be automated in a script) to select the outer structure. Once you do that, you can change the pixel values in that selection from 255 to 0 using changeValues.

Off-topic: It seems like there are a lot of first-time posters on this site. Was there some sort of meeting that promoted these software? Just curious.

Hello Andrew,

thanks for your answer.
The problem with basic thresholding is mainly the influence of the background within the balls:
I am not getting a suitable result here from thresholding.

Erode/Dilate cause more problems than they help, see example below:
Original binary image:
The voids within the balls are circles, artefacts from the background I couldn’t get rid of are “worm like” structures, I can neglect them within Analyze Particles by adjusting the circularity.

After performing Open:
First of all, the surrounding circle of the ball edge is still here, it is simply too thick I would say.
Secondly, the “worm like” structures of the background become circles now, too, falsifying my result.

Regarding your off-topic question:
We are using ImageJ within our company for quite a time now, but were just recently going more into detail and especially automation. We are always trying to improve our analysis results and by now this means for us going from a qualitative statement as “medium voiding within the balls” to a quantitative statement saying “the distribution of void number and size is xyz”.


I see. You said that adjusting circularity for Analyze Particles helps. What is it that prevents you from using those results?

Hello Andrew,

I’m sorry for the very delayed response.

Well my procedure as described above works to some extend, but the success rate in detecting the voids correctly is only at ~75%. There are some voids that are not detected and some features of the background that are counted as voids.
My original question was if it is possible to improve my method.
For example a possible procedure a colleague thought of would be to segment by shape:
The dark solder balls are circular, as are the bright voids within the solder balls. I.e. if there was a way to search for circular objects one would find the solderballs (and therfor the reference area) and then search within the solderballs for circular objects and find the voids.

I thought of a solution for removing the outer borders of the balls so I can get rid of the manual step of “opening” the circles before running Analyze Particles:
Inverting the image, filling the outside with the Flood Fill tool and then substracting from the original binary image should get me rid of the border, but it doesn’t…what I get as a result is the original image again, but I don’t understand why.
Original binary:


Flood Fill outside black:


Any ideas on that?

Thanks and regards,