# 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  
The filtering methods utilized in Algorithm 3 are rather aggressive. Testing revealed that, while bubble detection rates are indeed significantly higher than before and bubbles are detected everywhere within the FOV, it comes at the cost of decreased shape resolution precision and a higher false positive rate. The former is very important for a more in-depth analysis of the effects of varying flow rate and MF on the behavior of bubble chains. It was decided to fine-tune the global filter such that the bubble detection rates are maximized and good first estimates of bubble shapes/sizes are obtained, and complement it with a routine that would use the first estimates to generate more precise bubble shapes and efficiently filter out false positives. To this end, we have developed an algorithm for iterative segmentation refinement--the _multi-scale recursive interrogation filter_ (MRIF) outlined in Algorithm 4 and schematically illustrated in Figure 4.  
```
Input: \(\bullet\) An image mask with first segment estimates (Algorithm 3, Step 12)  The global SSCF filter output (Algorithm 3, Step 3)  Define square (side length \(L^{\prime}\)) interrogation windows (IWs) for segments based on their areas and centroids (8) and (9)  Define the FOV image as an IW with scale \(L\) based on FOV dimensions  For every initial segment and updated segments: while\(L^{\prime}/L<\epsilon\), \(\epsilon>1\) (user-defined)do  Map the global SSCF filter output onto the segment IW  Perform local filtering (Algorithm 5) if updated segments were foundthen  Define new IWs (side length \(L^{\prime}\)) for the updated segments based on their areas and centroids (8) and (9)  Redefine preceding IW scales as \(L^{\prime}\to L\) else Break end if  Memoize converged IWs for all segments  Map the centroid coordinates of the resulting segments from converged IWs onto the original image  Map the updated segment masks onto the original image and build an updated global mask Output: \(\bullet\) Updated bubble shape masks for the FOV  Converged IWs for later use in Algorithm 6
```  
**Algorithm 4**Multi-scale recursive interrogation filter (MRIF)  
```
Input: \(\bullet\) An image mask with first segment estimates (Algorithm 3, Step 12)  The global SSCF filter output (Algorithm 3, Step 3)  Define square (side length \(L^{\prime}\)) interrogation windows (IWs) for segments based on their areas and centroids (8) and (9)  Define the FOV image as an IW with scale \(L\) based on FOV dimensions  For every initial segment and updated segments: while\(L^{\prime}/L<\epsilon\), \(\epsilon>1\) (user-defined)do  Map the global SSCF filter output onto the segment IW  Perform local filtering (Algorithm 5) if updated segments were foundthen  Define new IWs (side length \(L^{\prime}\)) for the updated segments based on their areas and centroids (8) and (9)  Redefine preceding IW scales as \(L^{\prime}\to L\) else Break end if  Memoize converged IWs for all segments  Map the centroid coordinates of the resulting segments from converged IWs onto the original image  Map the updated segment masks onto the original image and build an updated global mask Output: \(\bullet\) Updated bubble shape masks for the FOV  Converged IWs for later use in Algorithm 6
```  
**Algorithm 5**Multi-scale recursive interrogation filter (MRIF)  
```
Input: \(\bullet\) An image mask with first segment estimates (Algorithm 3, Step 12)  The global SSCF filter output (Algorithm 3, Step 3)  Define square (side length \(L^{\prime}\)) interrogation windows (IWs) for segments based on their areas and centroids (8) and (9)  Define the FOV image as an IW with scale \(L\) based on FOV dimensions  For every initial segment and updated segments: while\(L



The key idea is to define _interrogation windows_ (IWs) about the initially detected bubbles to exclude irrelevant parts of the image and its intensity histogram from the analysis. This also helps to reduce the influence of any remaining artefacts left over from the global filtering.