# Resolving Gas Bubbles Ascending in Liquid Metal from Low-SNR Neutron Radiography Images
## 3 Image Processing
### Multi-Scale Recursive Interrogation Filter (MRIF)
#### 3.4.1 MRIF Core
Especially for images with lower SNR and with closely packed bubbles, it may be the case that the initial segmentation is poor, i.e., two or more bubbles have been segmented as one due to the surrounding artefacts, or a bubble was connected to large-scale artifact structures, forming a large segment that obscures the true object. This means that an appropriate local filtering algorithm must be devised for IWs. However, a single local filtering pass may not be enough for various reasons, e.g., what might appear visually as a poorly segmented bubble at the scale of the current IW might actually turn out to be, after local filtering, multiple bubbles--these would then each require another pass at a finer scale. This means that in general a series of consecutive interrogation passes could take place. Thus, MRIF performs object filtering at different scales, effectively checking that the segments have been properly resolved by the global filter and/or in the preceding local filtering iterations. A stopping criterion based on the IW size similarity between iterations makes sure that MRIF recognizes that it only makes sense to re-filter an image patch if the object is significantly smaller than the previous IW, since in this case the finer shape features may have been under-resolved. MRIF consists of several components: an IW generator that centers the IW at the segment location and adjusts its size according to the segment size; a local filter that is responsible for filtering within IWs; a recursive routine that performs a \"scale descent\" and converges to the \"true\" segment scale starting from the first estimates; a procedure that collects the final, updates segments and maps them onto the original bubble segment mask, substituting the first estimates. The \(\epsilon\) criterion is the stopping factor that controls recursion depth, i.e., the lower IW scale threshold. In our case \(\epsilon=2\) yielded good results. The MRIF core components are described in detail in Sections 3.4.2-3.4.4. #### 3.4.2. Interrogation Windows (IWs)

IWs are square windows with side length \(L\) which is determined for segments as follows:

\[L=\lfloor s\cdot\sqrt{S/\pi}\rceil \tag{8}\]

where \(S\) is the segment area in pixels and \(s\) is a user-defined scale factor, i.e., \(L\) scales with the equivalent radii of segments. Given \(L\) and the segment centroid \(\vec{r}=(x,y)\), an IW is defined by pixel coordinate intervals:

\[\text{IW}:\left\{\left[\lfloor x\rceil-\frac{L}{2};\lfloor x\rceil+\frac{L}{ 2}\right],\left[\lfloor y\rceil-\frac{L}{2};\lfloor y\rceil+\frac{L}{2}\right]\right\} \tag{9}\]

Figure 4: A schematic illustration for the MRIF algorithm. The gray domains represent detected segments. Since \(L\) for the entire image is required for the first iteration of MRIF and one should always perform local filtering at least once for every initial segment, here one can set \(L=s_{0}\cdot\max\dim(z)\) where \(z\) is the SCCM-filtered FOV image (Algorithm 3, Step 3) and \(s_{0}\geq 1\) is an arbitrary scaling factor such that \(L^{\prime}/L>\varepsilon\) is always true for the first MRIF iteration. Note that in general, an IW may be out of the image bounds--for this reason, two IWs are generated for a segment at every MRIF iteration: a _virtual IW_ defined by (9), and a _real IW_ given by

\[\text{IW}^{\prime}=z\cap\text{IW} \tag{10}\]

so IW\({}^{\prime}\) is not necessarily square. To reiterate: the current filtering scale is defined by the IW scale \(L\) and the SSCF filter output is mapped onto IW\({}^{\prime}\). For simplicity, IW\({}^{\prime}\) will be referred to as IW from this point, as in Algorithm 4, unless stated otherwise later. We observed that for our images \(s\in[2;2.5]\) yielded better results. #### 3.4.3 Local Segment Updates

The local filter used for recursive filtering in MRIF (Algorithm 4, Step 3) has elements similar to the global filter, but with important distinctions.