## 3 Methodology
### Segmentation Network Based on Swin-Transformer  
Our proposed architecture is built around an encoder based on the Swin-Transformer architecture that processes patches linked to a decoder based on the Swin-Transformer architecture through skip connections at multiple stages. The overall workflow of the architecture is depicted in Figure 2, and we will provide further details in this section. Swin-Transformer Encoder: To hierarchically capture global features, we employ a four-stage Swin-Transformer that progressively reduces the resolution of the input images for segmentation. The input is a patch with dimensions \((H,W,D,1)\), where \(H\), \(W\), and \(D\) represent the height, width, and depth of the MRI, and the last dimension corresponds to the single input channel. The input is initially divided into non-overlapping 3D tokens of size \((S,S,S)\) by a patch partitioning layer, resulting in \(\frac{H}{S}\times\frac{W}{S}\times\frac{D}{S}\times 1\) tokens. This step reduces computation costs while preserving local characteristics in each patch. In our approach, \(S\) is set to 2, which results in a feature size of \(M=S^{3}=8\) per token, and the token dimension becomes \((\frac{H}{2}\times\frac{W}{2}\times\frac{D}{2},8)\). A linear embedding layer then projects this feature into a hidden dimension \(C\). To achieve multiscale feature extraction and hierarchical representation, a patch merging layer groups tokens with a \(2\times 2\times 2\) resolution, concatenating them and producing the feature map with 4C dimensions at each stage. The linear layer follows downsample resolution and reduces dimension to 2C. The process generates feature maps at stage 2, stage 3, and stage 4 with dimensions \(\frac{H}{4}\times\frac{D}{4}\times\frac{W}{4}\times 2C\), \(\frac{H}{8}\times\frac{D}{8}\times\frac{W}{8}\times 4C\), and \(\frac{H}{16}\times\frac{D}{16}\times\frac{W}{16}\times 8C\), respectively. For modeling token interactions efficiently, self-attention is computed for each token through Swin-Transformer blocks. In Figure 3, we illustrate that each Swin-Transformer block applies a Window-based Multi-head Self-Attention (W-MSA) module followed by a Shifted Window-based Multi-head Self-Attention (SW-MSA) module. The self-attention is computed by these two modules using both regular and shifted window partitioning strategies. Between the attention modules, the two-layer MLP incorporating GELU activation functions is utilized. LayerNorm is introduced before each MSA module, and residual connections are added after each module to enhance stability and efficiency during training. To lessen the computational burden, W-MSA partitions tokens into non-overlapping windows, computing self-attention (SA) within each window. To maintain computational efficiency while enabling cross-window interactions and global attention, SW-MSA adjusts the window positions by shifting them \((\frac{M}{2},\frac{M}{2},\frac{M}{2})\) pixels from their original locations. Figure 4 illustrates the 3D multi-head self-attention mechanism in Swin-Transformer. Swin-Transformer Decoder: To transform the global information obtained by the encoding into a segmentation map, the 3-stage Swin-Transformer decoder is employed, which gradually upsamples the features. At each decoder stage \(i\), an upsampling layer first increases the resolution of \(H\), \(W\), and \(D\) by a factor of two while concurrently decreasing the channel dimensions via deconvolution. After upsampling, the resulting features are combined with the output from the previous encoder stage \(i-1\), denoted as \(y^{e(i-1)}\), which acts as a skip connection to mitigate any information loss during the encoder's downsampling. The concatenated features are then input into a Swin-Transformer block, which captures long-range dependencies throughout the feature map. In this architecture, the deconvolution layer is solely responsible for upsampling, while the Swin-Transformer block handles the decoding of the features.