## 2 Materials and Methods
### Loss Function and Double Regularization Constraint  
In this paper, we trained the two registration subnetworks as a whole and minimized the loss function in an end-to-end training manner to achieve the highest registration accuracy. The loss function usually consists of two parts: one is the similarity loss between the fixed image and the moving image, and the other is the regularization of the DVF. In this paper, normalized cross-correlation (NCC) [31] was used to measure the similarity between the deformed image and the fixed image, and its negative value is taken as the similarity loss. The relevant calculation can be performed according to Equation (6):  
\[\begin{split} L_{sin}&=-NCC(F,M\circ\varphi)\\ &=\sum_{p\in\Omega}\frac{\left(\sum_{p_{i}}(F(p_{i})-\bar{F}(p))( [M\circ\varphi](p_{i})-[\bar{M}\circ\varphi](p))\right)^{2}}{\left(\sum_{p_{i}} (F(p_{i})-\bar{F}(p))^{2}\right)\left(\sum_{p_{i}}([M\circ\varphi](p_{i})-[ \bar{M}\circ\varphi](p))^{2}\right)},\end{split} \tag{6}\]  
where \(p\) represents the voxel point in the image and \(\Omega\) represents the image domain. \(F(p)\) and \([\bar{M}\circ\varphi](p)\) denote the average voxel intensity within a local window centered at \(p\) in the fixed and deformed images, respectively. In this paper, the window size is 93.  
If the network is optimized only with similarity loss, the network parameters are updated towards making the deformed image infinitely close to the fixed image. But at this time, the DVF predicted by CNN will be excessively warped, and even the voxels in the DVF will be folded. Therefore, it is necessary to carry out some spatial regularization on the DVF. Considering that the dual-subnetwork registration model used in this study may produce large deformation predictions, imposing a single regularization constraint is not enough to meet the smooth requirements of the deformation field, so double regularization  
Figure 3: Structural diagram of the attention gate module.  
constraints are implemented. The first regularization term is diffusion regularization, which penalizes the spatial gradient of the DVF:  
\[R_{diffusion}(\varphi)=\sum_{p\in\Omega}\|\
abla\varphi(p)\|^{2}=\sum_{p\in \Omega}[(\frac{\partial\varphi(p)}{\partial x})^{2}+(\frac{\partial\varphi(p)} {\partial y})^{2}+(\frac{\partial\varphi(p)}{\partial z})^{2}], \tag{7}\]  
The second regularization is the bending energy [32], which penalizes severe bending deformation by applying a loss to the second derivative of the voxel displacement in the DVF. It is defined as:  
\[R_{\text{dending}}(\varphi)=\sum_{p\in\Omega}\left\|\
abla^{2}\varphi(p)\right\| ^{2}, \tag{8}\]  
The double regularization constraint in this paper can be expressed as:  
\[R=\gamma R_{diffusion}(\varphi)+\beta R_{bending}(\varphi), \tag{9}\]  
where \(\gamma\) and \(\beta\) represent the trade-off coefficients between the two regularization terms.  
The diffusion regularization term is used to punish the spatial gradient of the displacement field, so as to promote the smoother displacement field, which helps to avoid overly complex local deformation and maintain the continuity of the overall deformation. The bending energy regularization term can not only promote the smoothness of the displacement field and inhibit the serious bending deformation at the same time but also effectively control the complexity of the model and reduce the risk of overfitting. With the increase of the \(\beta\) of the weight coefficient of bending energy, the degree of voxel folding decreases significantly, but the Dice score also decreases, so when using double regularization constraints, the voxel folding problem can be effectively alleviated by adjusting the weight coefficient and ensuring smooth deformation.