# Multi-Focus Microscopy Image Fusion Based on Swin Transformer Architecture
## 1 Introduction  
All optical imaging systems, especially for light microscopy, have a limited depth of field. Three-dimensional objects under investigation are often thicker than the depth of field of the imaging system, meaning that it is impossible to acquire a whole object completely in focus in one single image; only those portions that lie within the depth of field appear in focus and sharp, whereas the remaining regions are blurred by the system's point spread function (PSF) [1]. To overcome this limitation, multi-focus image fusion (MFIF) is an effective way to generate an all-in-focus image from a set of partially focused images, extending the depth of field of cameras. Compared with other methods to extend the depth of field of cameras, multi-focus image fusion tries to ensure the accuracy of the information, which is quite important for medical images. However, it takes some time to collect a set of partially focused images. MFIF has been applied to various applications, such as micro-image fusion [2], visual sensor networks [3], visual power patrol inspection [4] and optical microscopy [5]. Image fusion technology has been developed for more than 30 years, during which various methods have been published. Conventional MFIM methods can be divided into spatial-based methods and transform-domain-based methods. Spatial-based methods fuse the image in the spatial domain directly, which can be further divided into pixel-based [6], block-based [7] and region-based [8] methods. In contrast, transform-domain-based methodstransform images into another domain firstly. Then, the transformed coefficients are merged by a pre-designed fusion rule. Finally, the fused image is reconstructed by applying the corresponding inverse transform based on the fused coefficients. Many transform-domain-based methods have been proposed so far, such as parse representation (SR) methods [9; 10; 11], multi-scale methods [12; 13; 14; 15; 16], gradient domain-based methods [17; 18] and hybrid methods [19]. In recent years, with the advancement of deep learning, machine learning algorithms have been widely employed for various image fusion tasks, achieving remarkable success in the image fusion field. Various deep learning models, such as CNNs [20; 21], GANs [22] and ensemble learning [23], have demonstrated their capability to attain state-of-the-art (SOTA) results in MFIF tasks. Recently, the transformer, a prominent architecture in natural language processing (NLP) [24], has been introduced into the computer vision domain to address the limitation of the long-range dependencies for CNN-based models [25; 26; 27; 28; 29; 30]. Furthermore, models based on the Swin Transformer [31] achieved SOTA performance in various tasks, such as image classification, object detection and semantic segmentation. Swin-Unet, a novel pure transformer-based U-shaped encoder-decoder architecture, was proven to have excellent performance and generalization ability for medical image segmentation [32]. In summary, the transformer architecture based on the self-attention mechanism has achieved great success in the natural language processing domain. Recently, many transformer architectures have been introduced into the computer vision domain and achieved SOTA performance for various of computer vision tasks. In these studies, the Swin Transformer is an excellent work, which achieved perfect performance with linear computational complexity concerning image size. Therefore, we propose end-to-end image fusion models based on the Swin Transformer backbone to leverage the capabilities of a transformer for multi-focus image fusion in microscope images in this study. The main contributions of this paper can be summarized as follows:  
1. Propose end-to-end models that use the Swin Transformer as a backbone to directly generate the fully focused images from multi-focus microscope images. Unlike existing CNN-based methods, this approach can extract long-range dependencies to generate naturally fully focused images. 2.