Abstract
Medical image segmentation is a critical task in radiology that often challenges standard Convolutional Neural Networks (CNNs) due to their localized receptive fields. While Transformers offer long-range dependency modeling, their reliance on rigid grid-based tokenization can miss subtle anatomical boundaries. We present CASTformer, a novel adversarial transformer framework that utilizes a hierarchical pyramid structure and a class-aware sampling module. By adaptively focusing on discriminative anatomical regions and employing a GAN-based training strategy, CASTformer achieves state-of-the-art performance, notably outperforming TransUNet by 5.88% in Dice score on the Synapse multi-organ CT dataset.
Introduction
Accurate digital labeling of organs and tumors is essential for modern diagnostic workflows. Traditional CNNs struggle with the "big picture," while first-generation vision transformers often fail to capture fine-grained details at organ boundaries because they split images into fixed 16x16 patches. This "hard splitting" can break apart small anatomical structures. Furthermore, many models lack a high-level understanding of anatomical realism, leading to mathematically accurate but physically impossible segmentation results.
Methodology
CASTformer addresses these limitations through a three-pronged architectural approach integrated into a Generative Adversarial Network (GAN) framework.
Hierarchical Pyramid Structure
Instead of a single resolution, the model constructs multi-scale representations ($F_1$ to $F_4$). This hierarchical approach allows the network to simultaneously process broad global context and fine-grained local details, which is vital for medical imaging where targets like tumors vary significantly in size.
Class-Aware Transformer (CAT) Module
The CAT module is the core innovation of CASTformer. Moving beyond static patches, it iteratively updates sampling locations. Starting from a regular grid, the module uses learnable offsets to "shift" its attention toward the most discriminative regions, such as the edges of a liver or the core of a tumor. This process uses bilinear interpolation to maintain differentiability across multiple iterations (typically $M=4$).
Adversarial Training Framework
The system is structured as a GAN where the Generator (the CATformer) produces segmentation masks and a Discriminator (a transformer-based classifier) evaluates "class-aware" images—the original scan multiplied by the predicted mask. The discriminator attempts to distinguish between real and generated anatomy, forcing the generator to produce masks that are both anatomically and texturally convincing.
Experiments and Results
The model was evaluated on three diverse benchmarks: the Synapse Multi-organ CT dataset, the LiTS (Liver Tumor Segmentation) challenge, and MP-MRI for prostate analysis.
Quantitative Performance
CASTformer established new state-of-the-art benchmarks across all tested datasets:
- Synapse: Achieved an 82.55% Dice score, a significant jump over the previous state-of-the-art, TransUNet (77.48%).
- LiTS: Reached 73.82% Dice, showing a nearly 6% absolute improvement over other transformer models.
- Small Organ Segmentation: The model demonstrated substantial gains in challenging areas, such as a +10.91% improvement for the pancreas and significant gains for the aorta.
Qualitative Analysis
Visualizations demonstrate that CASTformer produces much smoother and more anatomically accurate boundaries compared to the "blocky" or fragmented outputs of earlier models. The adversarial loss acts as a high-level semantic regularizer, ensuring the entire shape of the predicted organ makes physical sense.
Conclusion
CASTformer represents a significant advancement in medical image segmentation by treating image patches as flexible, "aware" entities rather than static blocks. By combining hierarchical feature learning with adversarial regularization, the framework provides a level of nuance that brings automated diagnostic tools closer to clinical utility. Future work will focus on extending the CAT module to 3D volumetric data and optimizing the computational overhead of the iterative sampling process.
Summary updated