Skip to main page content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Access keys NCBI Homepage MyNCBI Homepage Main Content Main Navigation
. 2025 Jun 18;11(6):202.
doi: 10.3390/jimaging11060202.

MedSAM/MedSAM2 Feature Fusion: Enhancing nnUNet for 2D TOF-MRA Brain Vessel Segmentation

Affiliations

MedSAM/MedSAM2 Feature Fusion: Enhancing nnUNet for 2D TOF-MRA Brain Vessel Segmentation

Han Zhong et al. J Imaging. .

Abstract

Accurate segmentation of brain vessels is critical for diagnosing cerebral stroke, yet existing AI-based methods struggle with challenges such as small vessel segmentation and class imbalance. To address this, our study proposes a novel 2D segmentation method based on the nnUNet framework, enhanced with MedSAM/MedSAM2 features, for arterial vessel segmentation in time-of-flight magnetic resonance angiography (TOF-MRA) brain slices. The approach first constructs a baseline segmentation network using nnUNet, then incorporates MedSAM/MedSAM2's feature extraction module to enhance feature representation. Additionally, focal loss is introduced to address class imbalance. Experimental results on the CAS2023 dataset demonstrate that the MedSAM2-enhanced model achieves a 0.72% relative improvement in Dice coefficient and reduces HD95 (mm) and ASD (mm) from 48.20 mm to 46.30 mm and from 5.33 mm to 4.97 mm, respectively, compared to the baseline nnUNet, showing significant enhancements in boundary localization and segmentation accuracy. This approach addresses the critical challenge of small vessel segmentation in TOF-MRA, with the potential to improve cerebrovascular disease diagnosis in clinical practice.

Keywords: MedSAM; MedSAM2; TOF-MRA; brain vessel segmentation; nnUNet.

PubMed Disclaimer

Conflict of interest statement

The authors declare no conflict of interest.

Figures

Figure 1
Figure 1
Framework overview. MedSAM/MedSAM2 embeddings fuse with the nnUNet encoder‘s specific stages, then progress through the decoder (D0Dn) with skip connections for mask prediction. The green arrow indicates the impending initiation of feature fusion.
Figure 2
Figure 2
Encoder architectures comparison: (a) MedSAM image encoder includes patch processing, embedding, multi-layer transformer blocks (with LayerNorm, multi-head self-attention, and MLP), and feature output. (b) MedSAM2 image encoder uses a Hiera backbone with hierarchical attention (e.g., Q-Pooling and window attention) for multi-scale feature extraction.
Figure 3
Figure 3
Architecture overview of nnUNet. The model processes 640×640 input images through stacked convolutional blocks (E0E7) for hierarchical feature extraction, with skip connections and transposed convolutions enabling precise segmentation through U-Net encoder–decoder structure. Deep supervision (L0Ln) is applied at multiple levels.
Figure 4
Figure 4
Schematic of nnUNet’s stacked convolutional blocks in encoder–decoder architecture. (Top) Encoder’s downsampling StackedConvBlocks (En). (Bottom) Decoder’s StackedConvBlocks (Dn). Blue dashed frames demarcate modular units, with arrows indicating feature flow directions.
Figure 5
Figure 5
Comparison of two feature fusion methods for MedSAM2 and nnUNet. (Top) MedSAM2 features fused at both E3 and E7 encoder stages of nnUNet. (Bottom) MedSAM features fused only at E7 stage. Both pipelines process input images (640×640) through independent encoding paths with downsampling, channel adjustment (Channel Up), and feature enhancement (FrequencyLoRA), followed by CAT and projection operations.
Figure 6
Figure 6
Schematic of the FrequencyLoRA module. (Left) FrequencyAdapter processes input (B,C,H,W) through FFT2 spectrum analysis and MLP-based feature enhancement (green dashed frame). (Right) LoRAAdapter performs low-rank adaptation via channel down/up operations (yellow dashed frame). Both modules employ residual connections (dotted arrows) to maintain original features (see Section 2.4 for implementation details).
Figure 7
Figure 7
Architecture of the AttentionGate module. The input tensor (B,C,H,W) undergoes parallel processing: (1) channel attention (blue path) via global average pooling and two-layer MLP and (2) spatial attention (orange path) through feature compression and spatial modeling. Both branches output broadcast-compatible weights that are fused through element-wise multiplication, preserving the original tensor dimensions. Dashed frames distinguish processing stages while arrows indicate data flow.
Figure 8
Figure 8
TOF-MRA slices and their spatial attention heatmaps in the AttentionGate module.
Figure 9
Figure 9
Preprocessing pipeline for MRA images in nnUNet.
Figure 10
Figure 10
The segmentation performance of nnUNet and nnUNet-MedSAM/MedSAM2: correctly segmented pixels are shown in green, false negative pixels are in light purple, and false positive pixels are in yellow.

Similar articles

References

    1. Feigin V.L., Abate M.D., Abate Y.H., ElHafeez S.A., Abd-Allah F., Abdelalim A., Abdelkader A., Abdelmasseh M., Abd-Elsalam S., Abdi P., et al. Global, regional, and national burden of stroke and its risk factors, 1990–2021: A systematic analysis for the Global Burden of Disease Study 2021. Lancet Neurol. 2024;23:973–1003. doi: 10.1016/S1474-4422(24)00369-7. - DOI - PubMed
    1. Liu M., Wang D., Qi C., Zou M., Song J., Li L., Xie H., Ren H., Hao H., Yang G., et al. Brain ischemia causes systemic Notch1 activity in endothelial cells to drive atherosclerosis. Immunity. 2024;57:2157–2172. doi: 10.1016/j.immuni.2024.07.002. - DOI - PubMed
    1. Xu R., Zhao Q., Wang T., Yang Y., Luo J., Zhang X., Feng Y., Ma Y., Dmytriw A.A., Yang G., et al. Optical coherence tomography in cerebrovascular disease: Open up new horizons. Transl. Stroke Res. 2023;14:137–145. doi: 10.1007/s12975-022-01023-6. - DOI - PubMed
    1. Coppenrath E.M., Lummel N., Linn J., Lenz O., Habs M., Nikolaou K., Reiser M.F., Dichgans M., Pfefferkorn T., Saam T. Time-of-flight angiography: A viable alternative to contrast-enhanced MR angiography and fat-suppressed T1w images for the diagnosis of cervical artery dissection? Eur. Radiol. 2013;23:2784–2792. doi: 10.1007/s00330-013-2891-1. - DOI - PubMed
    1. Bash S., Villablanca J.P., Jahan R., Duckwiler G., Tillis M., Kidwell C., Saver J., Sayre J. Intracranial vascular stenosis and occlusive disease: Evaluation with CT angiography, MR angiography, and digital subtraction angiography. Am. J. Neuroradiol. 2005;26:1012–1021. - PMC - PubMed

LinkOut - more resources