Bayes’ theorem-based binary algorithm for fast reference-less calibration of a multimode fiber

: In this paper, we present a Bayes’ theorem-based high-speed algorithm to measure the binary transmission matrix of a multimode fiber using a digital micromirror device in a reference-less multimode fiber imaging system. Based on conditional probability, we define a preset threshold to locate those digital-micromirror-device pixels that can be switched ‘ON’ to form a focused spot at the output. This leads to a binary transmission matrix consisting of ‘0’ and ‘1’ elements. High-enhancement-factor light focusing and raster-scanning at the distal end of the fiber are demonstrated experimentally. The key advantage of our algorithm is its capability for fast calibration of a MMF to form a tightly focused spot. In our experiment, for 5000 input-output pairs, we only need 0.26 s to calibrate one row of the transmission matrix to achieve a focused spot with an enhancement factor of 28. This is more than 10 times faster than the prVBEM algorithm. The proposed Bayes’ theorem-based binary algorithm can be applied not only in multimode optical fiber focusing but also to other disordered media. Particularly, it will be valuable in fast multimode fiber calibration for endoscopic imaging.


Introduction
Focusing light through a multimode fiber (MMF) and raster-scanning the focusing spot at the fiber distal end holds promise in developing ultrathin endoscopes for biomedical imaging. Controlling light through multimode optical fibers (MMF) has been a great challenge due to the strong mode coupling in the fiber. Typically, a series of modes with different phase velocities are excited and coupled with each other during light propagation, which results in noise-like speckle patterns at the fiber end facet [1]. Recently, spatial light modulation achieved control of the transmitted light field through scattering media [2][3][4][5][6][7] and MMFs [8][9][10][11][12][13][14][15][16][17][18]. Vellekoop et al. pioneered light focusing through scattering media using a liquid-crystalbased spatial light modulator (SLM), by shaping the incident light wavefront to compensate the scattering effect of the medium [2]. By decomposing and modulating the phase and amplitude of incident light field into SLM pixels, the transmitted field at the output can form desirable images or patterns such as a tightly focused spot.
There are a number of approaches to calibrate disordered media when using SLM, including digital optical phase conjugation [13][14]19], iterative algorithms [2,3,9,20] and transmission matrix (TM) measurements [10][11][12]21,22]. Digital optical phase conjugation requires a prior focused light spot at the target position in the output plane. Subsequently, a camera records both amplitudes and phases of the transmitted light field holographically. By projecting the reversed amplitudes and phases onto an SLM placed in the same optical plane, the same focused spot can be achieved. The digital optical phase conjugation method has been demonstrated in fluorescence imaging [13] and photoacoustic imaging [14]. In contrast, a prior focused spot is not needed for iterative algorithms and TM methods. Iterative algorithms sequentially change the phase delay at each SLM pixel and select the phase that leads to the desirable pattern at the MMF distal end. By recording the optimized phase masks for light focusing at each output location and projecting the masks for desired output patterns, Čižmár et al. achieved micro-particle manipulation and image transmission through MMFs [8,9,23]. The measurement of a TM decomposes both input and output fields into pixels, linking input and output pixels with a complex amplitude. Based on the measured TM of the disordered medium, the optimal input field or the target output can be determined if one of these fields is known. Popoff et al. measured the TM of diffuse media using a 'four phase' approach [21,22], which was also applied to a MMF [12]. Choi et al. calibrated the TM of a MMF by measuring both the input and output light fields and achieved image reconstruction through a single MMF [10].
Recently, digital micromirror devices (DMD) operating at frequencies over 20 kHz, were used as fast alternatives to SLMs [3,10,24,25]. As a binary amplitude modulator, each DMD pixel provides two states, 'ON' or 'OFF'. Turning 'ON' a DMD pixel allows projecting light from this pixel to the medium. DMDs have been used in iterative methods [3] and TM measurements [10] as well as being used as a phase modulator based on Lee holograms [26] and in super-pixel methods [27]. Additionally, binary TM measurements [28] and millisecond digital optical phase conjugations [29] were achieved, by dividing DMD pixels into two categories according to whether the DMD pixel leads to constructive or destructive interference with reference beams. Recently, DMDs were used with phase retrieval algorithms for reference-less TM measurements, leading to a simplified experimental configuration [30,31].
In this work, we develop a high-speed algorithm based on Bayes' theorem using conditional probability, to measure the binary TM for a reference-less DMD-based MMF imaging system. We note that with the measured complex elements (t mn ) in a row of a complex TM, turning 'ON' only those DMD pixels corresponding to Re(t mn ) > 0 or Re(t mn ) < 0 respectively, leads to light focusing at the corresponding output location. When focusing light through a disordered medium with a binary DMD, a complex TM that requires extra computing time may not be necessary. In our algorithm, we use conditional probability to find a group of DMD pixels that can form a sharp focus at a certain output location when being switched 'ON', leading to a binary TM We show that iteration optimization is unnecessary in our binary calculation, and therefore high-speed MMF calibration is achieved. We experimentally demonstrate light focusing through a MMF and raster-scan the focused spot across the fiber distal end. The enhancement factor and the computing time of our algorithm are compared to those provided the prVBEM algorithm, and our algorithm is more than 10 times faster to achieve the same enhancement factor.

Binary amplitude modulation
When a DMD fills the entrance pupil of a MMF, the transmitted field measured by a camera at the MMF output is a linear superposition of the output fields from all input DMD pixels. Here we define a DMD pixel as an 'input' pixel (the total number is N) and a camera pixel as an 'output' p superposition where t mn is t the number o the field at the can be consid uniform illum the complex a different t mn statistically ac is applicable same real-par focused spot positive real p dividing t mn i simplified to t Fig (2) ).
In our case, the probability for a TM element t mn that leads to higher output intensity as a result of constructive interference is expressed as: Assuming the total number of measured input-output pairs is K, for the mth output pixel, there are K intensity values. We define a preset intensity threshold H m for the mth output pixel, to separate its K measured intensity values into two categories: a higher-intensity category (C) with K c intensity values greater than H m and a lower-intensity category (D) with K d intensity values smaller than H m . P(C) m = K c /K and P(D) m = K d /K are the fractions of higher and lower-intensity categories for the mth output pixel, respectively. We assume the nth DMD pixel is in the 'ON' state k c times for the K c higher-intensity outputs, and is in the 'ON' state k d times for the K d destructive outputs. P(T|C) mn = k c /K c is the fraction of times the nth DMD pixel is 'ON' for the K c higher-intensity values of the mth output camera pixel. Similarly P(T|D) mn = k d /K d is the fraction of times the nth DMD pixel is 'ON for the K d lower-intensity values of the mth output camera pixel. P(C|T) mn is the probability for the nth DMD pixel corresponding to the higher-intensity category (C) at the mth output pixel when it is 'ON' (T).
The preset threshold H m is specific to the mth output pixel and can be determined by analyzing the K measured intensity values. We found in our experiment that the 80th percentile of the K measured intensity values for the mth output pixel is the most efficient when being used as the threshold to generate a sharp focused spot ( Fig. 4(a) in Section 4.1). We therefore used the 80th percentile of K measured intensity values for the mth output pixel as the preset threshold H m in the following calculations unless stated otherwise.
Similarly, the probability for a TM element t mn belonging to the lower-intensity category is expressed as: where P(D|T) mn is the probability for the nth DMD pixels corresponding to the lower-intensity category (D) at the mth output pixel when it is 'ON' (T). For the mth output camera pixel determined by the mth row of the TM, we have obtained two probabilities P(C|T) mn and P(D|T) mn for the nth input DMD pixel. Here we use these two probabilities to determine a group of DMD pixels (G m ) that need to be turned 'ON' to form a focused spot at the mth output pixel. The asymmetric feature of a real fiber results in slight deviations of the probabilities from their ideal values and this forms the basis of our approach. We consider the nth DMD pixel belongs to G m , if P(C|T) mn is greater than the median of all P(C|T) m , and the P(D|T) mn is less than the median of all P(D|T) m . The reason we choose the medians of probability groups, namely P(D|T) m and P(C|T) m , to determine G m is because the TM elements in one row obey an approximately circular Gaussian distribution [2], i.e. roughly half of elements have positive real parts. This choice is also proved experimentally in Fig. 4(b) in Section 4.2. By turning 'ON' all DMD pixels of the above-determined DMD pixel group G m , the resulting output fields from all input pixels lead to a sharp focused spot at the mth output pixel. The mth row of the binary TM is obtained by setting t nm corresponding to G m as '1' and the rest as '0'. By evaluating the probabilities for all output camera pixels using Eqs. (3) and (4), a binary TM can be obtained row by row.
Note that our probability-based approach described above cannot precisely determine the real-part signs of the TM elements, or the constructive elements. However, our method ensures that only a small fraction of TM elements with opposite signs are included in G m , and the probability calculation in our approach is to minimize this fraction. This is verified in Fig.  4(a) in Section 4.1, as we show a higher enhancement on the intensity of the focused spot by increasing the total input-output pairs.
Our binary algorithm is suitable for multi-spot focusing, in which the K measured intensity values of each target output pixel are compared with the preset threshold. When the intensities at all target locations are higher than the preset threshold, the corresponding input is considered to be in the constructive category.
To briefly sum up the principle, our binary algorithm using the conditional probabilities [Eqs. (3) and (4)] to estimate whether an input DMD pixel should be turned "ON" or "OFF" in order to form a sharp focus at a certain output location at the MMF distal end.

Experimental methods
The experimental setup is shown in Fig. 2 and another tube lens (AC254-100-A-ML, Thorlabs) before captured by a CMOS camera (C1140-22CU, Hamamatsu). 2 × 2 micro-mirrors were combined as a single macro-pixel to enhance the difference between an 'ON' pixel and an 'OFF' pixel. We used N = 1296 macropixels for the input basis and M = 9216 pixels for the output in this case.
Different numbers (K) of random DMD inputs were generated by MATLAB at an 'ON'-'OFF' ratio of 50:50. This led to K input-output pairs, and we used K = 5000, 7500, 10000, 12500, 15000, 17500 and 20000 in our experiment for binary TM calibration. The mth row of the binary TM was then used as the DMD input mask to generate a focusing spot at the mth output pixel. We compared the binary algorithm with the prVBEM algorithm [30, 32]. Stability of our experimental system was monitored during binary TM measurement, and a high correlation above 98% was obtained for two outputs with the same input mask projected at the beginning and the end of the calibration (approximately 1 hour). Intensity enhancement factors were measured for quantitatively estimating the focusing effect. The focusing region is defined as the area with intensity higher than FWHM intensity around the target pixel (3 × 3 pixels in our case). The intensity contrast between the focusing region and the background is defined as the enhancement factor: where I foc is the average intensity inside the focusing region and I back is the average background intensity (including the focusing region).

Single-spot focusing
The binary TM of the MMF was calibrated by using our Bayes' Theorem-based fast binary TM algorithm as described in Section 2. Using the binary TM and turning 'ON' corresponding DMD pixels, we achieved focusing and raster-scanning of the focused spot across the fiber distal end. The experimental results for 9 focused spots at different output locations are shown in Fig. 3. The simulated outputs for 3 focused spots were also calculated with the binary TM by switching 'ON' all DMD pixels in the corresponding G m . The FWHM of the focused spots in both experimental and simulation results is 3 pixels (approximately 1.7 μm). The comp algorithm. We Pro (2.3 GHz rows. As show measurements 3. Examples of ligh th, (b) 4632 th , (c) h output camera p ons as (c), (g) an bar for experiment mulation results sp ncement factor output pixel, w alculated the e ution for 100 r ensity value is focused spot in lso demonstrat the input DM at the mth out t pixels for diff e. the x axis groups, P(C|T) factors are ach ncement factor xplot. Figure 4 output-pair me m a sharp focu varying focusi Fig. 4(a)-(c)) 0, 32]. puting time is e used the bina z Intel Core i5 wn in Fig. 4(c) s. We also us ht focusing throug 6936 th , (e) 2352 th pixels. (d), (h) an nd (k). The numb tal results spans th pans arbitrary inten r as a function we vary H m by u enhancement f randomly chos s the most effic n this system. te that the choi MD pixel group tput pixel. The ferent probabil in Fig. 4(b), ) m and P(D|T) hieved when th rs for different 4(c) shows that easurement nu used spot due ing strength at . These are co s another imp ary algorithm i 5), and calcula , the calculatio ed prVBEM a We also ncing the

Conclusion
In summary, we developed a high-speed binary TM calibration algorithm based on Bayes' theorem, to achieve raster scanning of a high-contrast focal spot via a MMF, eliminating the needs of phase retrieval and a reference beam. To the best of our knowledge, it is the first time a conditional probability theory was used for TM measurement. This work is also the first to present a binary TM in a reference-less MMF imaging system and our algorithm is promising for light focusing and raster-scanning through other disordered media. The highspeed and simplicity offered in both calibration and measurements hold promise for single MMF based endoscopic imaging.