## 5 Discussion  
To address the challenging problem of liver and tumor segmentation in HCC patients, we developed a Swin-Transformer-based segmentation framework with a multitask and attention strategy for liver and tumor segmentation. In contrast to CNN-based segmentation models, the Swin-Transformer leverages self-attention mechanisms, enabling it to capture contextual information and long-range dependencies across the entire CE-MRI. The \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \multirow{2}{*}{**Methods**} & \multicolumn{2}{c}{**DSC**} & \multicolumn{2}{c}{**95 HD**} & \multicolumn{2}{c}{**ASD**} \\ \cline{2-7}  & **Liver** & **Tumor** & **Liver** & **Tumor** & **Liver** & **Tumor** \\ \hline Arterial phase & \(0.968\pm 0.025\) & \(0.878\pm 0.066\) & \(3.93\pm 1.49\) & \(4.11\pm 1.33\) & \(0.91\pm 0.27\) & \(1.01\pm 0.30\) \\ Venous phase & \(0.967\pm 0.022\) & \(0.868\pm 0.065\) & \(4.53\pm 3.74\) & \(6.74\pm 2.28\) & \(1.82\pm 0.54\) & \(2.97\pm 0.88\) \\ Delayed phase & \(0.963\pm 0.023\) & \(0.851\pm 0.074\) & \(4.16\pm 3.64\) & \(5.81\pm 2.73\) & \(1.61\pm 0.93\) & \(2.46\pm 1.07\) \\ Combined & \(0.966\pm 0.022\) & \(0.865\pm 0.026\) & \(3.62\pm 1.91\) & \(4.12\pm 1.55\) & \(0.92\pm 0.28\) & \(1.02\pm 0.32\) \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Qualitative comparison of our method on different MRI phases. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \multirow{2}{*}{**Weight (\(\alpha\))**} & \multicolumn{2}{c}{**DSC**} & \multicolumn{2}{c}{**95 HD**} & \multicolumn{2}{c}{**ASD**} \\ \cline{2-7}  & **Liver** & **Tumor** & **Liver** & **Tumor** & **Liver** & **Tumor** \\ \hline \(\alpha=0.9\) & \(0.958\pm 0.025\) & \(0.848\pm 0.066\) & \(6.03\pm 4.00\) & \(6.20\pm 3.33\) & \(1.52\pm 0.44\) & \(1.86\pm 0.69\) \\ \(\alpha=0.7\) & \(0.957\pm 0.022\) & \(0.858\pm 0.025\) & \(5.53\pm 3.74\) & \(5.74\pm 2.28\) & \(1.75\pm 0.31\) & \(1.97\pm 0.44\) \\ \(\alpha=0.5\) & \(0.963\pm 0.023\) & \(0.851\pm 0.024\) & \(5.16\pm 2.64\) & \(5.81\pm 2.73\) & \(1.62\pm 0.39\) & \(1.67\pm 0.45\) \\ \(\alpha=0.3\) & \(0.965\pm 0.022\) & \(0.862\pm 0.026\) & \(4.24\pm 1.64\) & \(4.62\pm 1.86\) & \(0.90\pm 0.26\) & \(1.43\pm 0.36\) \\ \(\alpha=\mathbf{0.1}\) & \(0.966\pm 0.022\) & \(0.865\pm 0.026\) & \(3.62\pm 1.91\) & \(4.12\pm 1.55\) & \(0.92\pm 0.28\) & \(1.02\pm 0.32\) \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Ablation study on the impact of the SDM loss coefficient on model performance. global attention capability enhances the model's understanding of the spatial relationships between the liver and tumor in MRI scans, thereby improving the segmentation accuracy for both regions. To further enhance the attention mechanism, the liver and tumor segmentation model showed significant performance improvements following the integration of the attention gate mechanism, as shown in Table 5. Specifically, the DSC scores for liver and tumor segmentation increased by approximately 0.59% and 1.39%, respectively, highlighting the model's enhanced ability to accurately delineate the boundaries and shapes of the target regions. Additionally, the 95 HD for both liver and tumor decreased by approximately 0.2 and 0.25, respectively, indicating a marked improvement in boundary prediction accuracy, particularly in the context of small or complex tumors. These results underscore the effectiveness of the attention gate mechanism in improving the model's focus on critical regions, thereby boosting both segmentation accuracy and robustness. We introduced the SDM regression branch in the proposed method, which realized the simultaneous learning of the segmentation and SDM regression tasks. At the same time, introducing the SDM regression branch added additional shape constraints to the segmentation task, further improving the robustness and stability. To evaluate the effectiveness of the proposed method, we conducted comprehensive experiments on ablation analysis. Table 1 and Figure 9 show the comparison results with other methods.