CAPE: Connectivity-Aware Path Enforcement Loss for Curvilinear Structure Delineation.

Elyar Esmaeilzadeh, Ehsan Garaaghaji, Farzad Hallaji Azad, Doruk Öner

TL;DR

This paper introduces CAPE, a novel loss function for semantic segmentation that specifically addresses the challenge of accurately delineating curvilinear structures like blood vessels and neurons. By enforcing topological correctness through path-based connectivity, CAPE significantly improves segmentation quality, especially in complex structures where traditional pixel-wise losses fail.

What Problem Does This Paper Address?

Accurately segmenting curvilinear structures, such as neuronal processes in brain scans or blood vessels in CT images, is crucial for many applications in medical imaging and biological research. While deep learning models have achieved impressive pixel-level segmentation accuracy, they often struggle with maintaining the topological integrity of these structures. Traditional loss functions, like cross-entropy or Dice loss, focus on individual pixel accuracy and fail to capture the high-level connectivity required for accurate representation of these elongated, branching structures. This can lead to broken segments, false connections, and an overall unreliable representation, necessitating tedious manual correction by experts.

Methods

The core innovation of this paper is the CAPE (Connectivity-Aware Path Enforcement) loss function. CAPE operates by comparing the connectivity of the ground truth structure with the predicted segmentation. It leverages a graph representation of the ground truth, where nodes represent key points and edges represent connections. For each ground truth path between two connected nodes, CAPE:

  1. Projects ground truth nodes to the predicted distance map: This accounts for minor spatial deviations in the prediction.
  2. Computes the shortest path in the predicted distance map: Using Dijkstra's algorithm, it finds the path between the projected nodes in the predicted segmentation.
  3. Calculates a cost for the predicted path: This cost is based on the sum of squared distance values along the predicted path. Higher distance values (indicating disconnections) contribute more significantly to the cost.
  4. Penalizes deviations: The loss is the absolute difference between the cost of the ground truth path (effectively zero, assuming perfect connectivity) and the predicted path.

A key aspect of CAPE is its use of a distance map instead of a probability map. Distance maps are more sensitive to disconnections, leading to stronger gradients and better enforcement of connectivity. Additionally, a masking strategy is employed to constrain the search for the predicted path, ensuring it stays close to the ground truth and preventing the algorithm from choosing alternative, incorrect paths, especially in the presence of loops.

CAPE is integrated into the training framework by combining it with a standard Mean Squared Error (MSE) loss. This hybrid approach ensures both dense pixel-wise supervision and robust topological correctness.

Datasets

The paper evaluates CAPE on both 2D and 3D datasets:

  • 2D Datasets:
    • CREMI: Contains neurons from the Drosophila melanogaster brain.
  • DRIVE: Contains digital retinal images of blood vessels.
  • 3D Datasets:
    • Brain dataset: Light microscopy scans of the mouse brain.

Key Insights and Ideas

  • Connectivity is more than pixel accuracy: The paper strongly emphasizes that for curvilinear structures, topological correctness is paramount and cannot be achieved by pixel-wise losses alone.
  • Distance maps are better than probability maps for connectivity: Using distance maps as the network output for CAPE leads to more sensitive gradients and better penalization of disconnections.
  • Path-based comparison is key: Directly comparing paths between corresponding nodes in the ground truth and prediction is a more effective way to enforce global connectivity than local pixel-wise penalties.
  • Masking prevents erroneous path selection: The masking strategy is crucial for guiding the shortest path algorithm and ensuring it captures actual disconnections rather than finding alternative, incorrect paths, especially in complex, loopy structures.

Key Results

  • State-of-the-art topology-aware metrics: CAPE significantly improves performance on topology-aware metrics like APLS (Average Path Length Similarity) and TLTS (Too-Long-Too-Short). For instance, on the CREMI dataset, CAPE achieved 93.6 APLS and 93.5 TLTS, outperforming other methods.
  • Competitive pixel-wise performance: While prioritizing connectivity, CAPE also maintains comparable performance on pixel-wise metrics like CCQ (Correctness, Completeness, and Quality) and Dice score.
  • Qualitative improvements: Visual comparisons highlight that CAPE successfully connects regions that remain disconnected in alternative methods, leading to more complete and accurate segmentations.

Limitations and Future Work

  • Limitations: The paper acknowledges that while CAPE improves connectivity, it still relies on pixel-wise distance maps as output. The authors note that this can lead to sparse gradients in some cases.
  • Future Work: The authors plan to explore having the network directly output graph representations, allowing CAPE to operate entirely in the graph domain. This unified approach is expected to further enhance topological accuracy and connectivity enforcement.

Summary updated

BibTeX
@inproceedings{esmaeilzadeh2025cape,
  author = {Elyar Esmaeilzadeh and Ehsan Garaaghaji and Farzad Hallaji Azad and Doruk Öner},
  title = {{CAPE: Connectivity-Aware Path Enforcement Loss for Curvilinear Structure Delineation.}},
  booktitle = {International Conference on Medical Image Computing and Computer-Assisted Intervention},
  year = {2025},
  url = {https://openreview.net/forum?id=TqKDZTHEL5},
}
Figure