Merging Context Clustering With Visual State Space Models for Medical Image Segmentation

Yun Zhu, Dong Zhang, Yi Lin, Yifei Feng, Jinhui Tang

Abstract

Medical image segmentation (MedISeg) requires a delicate balance between global anatomical context and fine-grained local detail. While Vision Mamba (ViM) has emerged as a linear-complexity alternative to Transformers for global modeling, its reliance on 1D scanning patterns often neglects the complex spatial relationships inherent in 2D medical images. We present CCViM (Context Clustering Vision Mamba), a novel U-shaped architecture that integrates Context Clustering (CC) with selective state space models (S6). By treating image patches as dynamic clusters rather than fixed sequences, CCViM adapts to irregular biological shapes and boundaries. Evaluated across five diverse benchmarks, CCViM achieves state-of-the-art performance, including a 82.65% Dice Similarity Coefficient on the Synapse dataset, while maintaining real-time inference speeds.

Introduction

Precise segmentation of organs, lesions, and nuclei is a cornerstone of computer-aided diagnosis. However, medical images present a unique challenge: models must capture the "big picture" to identify anatomical structures while maintaining high sensitivity to the "fine-grained" boundaries of small or irregularly shaped objects.

Existing architectures face significant trade-offs. Convolutional Neural Networks (CNNs) are proficient at local feature extraction but struggle with long-range dependencies. Vision Transformers (ViTs) excel at global context but suffer from quadratic computational complexity, making them inefficient for high-resolution medical scans. Recently, Vision Mamba (ViM) models have utilized State Space Models (SSMs) to provide global reach with linear complexity. Despite their efficiency, ViM models often possess a "spatial blind spot" because they flatten 2D images into 1D sequences, potentially destroying local spatial correlations and relying on rigid scanning patterns that do not align with the irregular morphology of medical features.

Methodology

CCViM addresses these limitations by introducing the CCS6 layer (Context Clustering Selective State Space Model), which marries the efficiency of Mamba with the adaptive nature of Context Clustering.

The CCS6 Layer

The core innovation of CCViM is the integration of Context Clustering (CC) directly into the selective state space framework. Instead of processing pixels in a fixed grid or window, the CC layer treats image patches as a set of data points that are dynamically grouped into clusters based on similarity. This allows the model to develop a "dynamic receptive field" that can wrap around the actual shape of a structure, such as a jagged tumor boundary or a cluster of cells, regardless of orientation.

In each block, the model selects from six distinct processing paths:

  1. Four Cross-Scans: Horizontal, vertical, and their respective flips to maintain global sequence awareness.
  2. Two Context Clustering Paths: Utilizing different numbers of cluster centers (4 and 25) to capture multi-scale local relationships.

Architecture

CCViM adopts a U-shaped encoder-decoder structure, following the successful UNet paradigm. This design utilizes skip connections to pass low-level spatial details from the encoder directly to the decoder, ensuring that high-resolution features are not lost during the downsampling process. This hierarchical approach allows the model to build high-level semantic understanding while preserving the precise boundary information necessary for medical accuracy.

Experimental Results

The model was evaluated on five public medical imaging benchmarks covering various modalities and scales:

  • Nuclei Segmentation: Kumar and CPM17 datasets (histopathology).
  • Skin Lesion Segmentation: ISIC17 and ISIC18 datasets (dermoscopy).
  • Multi-Organ Segmentation: Synapse dataset (CT scans).

Performance Metrics

CCViM consistently outperformed state-of-the-art (SOTA) models, including TransUNet, Swin-Unet, and VM-UNet.

  • Synapse (Multi-organ): Achieved a Dice Similarity Coefficient (DSC) of 82.65%, representing a 1.57% improvement over the previous leading Mamba model (VM-UNet).
  • Skin Lesions (ISIC17): Improved the mean Intersection over Union (mIoU) to 81.40%.
  • Nuclei (Kumar): Reached a Panoptic Quality (PQ) of 58.83%.

Efficiency and Qualitative Analysis

Despite the addition of clustering mechanisms, CCViM remains highly efficient. It achieves a throughput of 41.16 FPS, which is faster than the standard UNet (34.86 FPS) and comparable to other Mamba-based architectures. Qualitatively, CCViM demonstrates a superior ability to separate overlapping nuclei and delineate "wiggly" or irregular edges where traditional models tend to over-smooth or merge distinct objects.

Discussion and Conclusion

The success of CCViM highlights the importance of moving beyond fixed scanning patterns in medical imaging. By incorporating Context Clustering, the model gains the ability to adapt its receptive field to the data, effectively bridging the gap between 1D sequence modeling and 2D spatial reality.

While highly effective, current limitations include the fixed number of clusters and scan directions determined during the design phase. Future research will explore automated searching methods (e.g., "Auto-CCViM") to allow the model to dynamically optimize its configuration for specific tasks. Additionally, the authors plan to extend this architecture to 3D medical image registration and other volumetric tasks.

Summary updated

BibTeX
@article{zhu2025merging,
  author = {Yun Zhu and Dong Zhang and Yi Lin and Yifei Feng and Jinhui Tang},
  title = {{Merging Context Clustering With Visual State Space Models for Medical Image Segmentation}},
  journal = {IEEE Trans. Medical Imaging},
  year = {2025},
  doi = {10.1109/tmi.2025.3525673},
}
Figure