Context-Aware MRI Plane Detection

ArXiv Preprint View Code Live Demo
The Motivation

The Ambiguity Problem: Identifying the anatomical plane (Axial, Coronal, Sagittal) of an MRI scan is usually easy—except at the edges. "Near-skull" edge images lack distinct anatomical features, making them inherently ambiguous for AI models and even human experts.

The Consequence: Standard 2D classifiers fail on these ambiguous slices. This leads to corrupted metadata, confusing downstream tasks and causing domain shift when merging heterogeneous datasets.

Our Solution: We introduce a Context-Aware 2.5D Model. By sampling adjacent slices, our model learns the local anatomical flow, providing just enough context to resolve ambiguity. This approach achieves >99% accuracy and corrects misclassifications that purely 2D models cannot solve.

1. Methodology: The 2.5D Context Pipeline

How do we teach a model to "see" context? We construct a 3-channel input where the center slice is the target, flanked by adjacent slices (Sequential) or random slices from the same volume (Random).

Figure 1: System Overview
Figure 1 Overview: (1) We aggregate heterogeneous data (2D & 3D sources). (2) The 2.5D model learns a unified strategy, processing 2D images with static context and 3D images with dynamic context. (3) The trained classifier generates missing metadata for any input slice.
2. Quantitative Impact: Resolving Ambiguity

We compared a standard 2D baseline against our 2.5D approach on a mixed dataset. The 2.5D model effectively eliminates errors in ambiguous classes.

Table 1 Results: While the 2D Baseline achieves 98.74%, it struggles with edge cases. Adding 2.5D context (Random sampling) pushes performance to 99.99% on the IXI test set, reducing misclassifications by 60%.
3. Visual Proof: Removing "Confident" Errors

The chart above shows that the model is better. This visualization shows why. Below shows the "Top-2 Most Confident Errors" made by the 2D model compared to our 2.5D model on the same difficult slices.

Figure 2: Top-2 Confident Errors per Class
Figure 2 Analysis:
Row 1 (Axial): The 2D model is confused by near-skull slices. The 2.5D model completely eliminates these errors.
Row 2 (Coronal): Large tumors cause asymmetry, fooling the 2D model into predicting "Sagittal". The 2.5D model uses context to correctly identify the plane despite the pathology.
4. Ablation Study: The Importance of Sequential Context

To prove that the model is learning anatomical flow rather than just memorizing images, we trained on 3D volumes (IXI) and tested on an unseen 2D dataset (BRISC).

Table 2 Results: In this challenging domain-shift scenario, the 2D model fails (48.7%). However, Sequential Context (73.0%) outperforms Random Context, confirming that learning the sequential order of slices is key to resolving ambiguity.
5. Application: Brain Tumor Detection

A. Qualitative Analysis (Grad-CAM)

Before looking at the statistics, observe how the corrected metadata fixes the model's behavior. Left: Image-Only (Wrong). Right: Metadata-Enhanced (Correct).

Figure 2: Top-2 Confident Errors per Class
Figure 4 Analysis: The Image-Only model (left) focuses on background noise, incorrectly predicting Meningioma. The Metadata-Enhanced model (right) correctly targets the tumor core, fixing the prediction to Glioma.

B. Quantitative Impact: Reducing Misdiagnoses

We applied this corrected attention to the full dataset using a Gated Strategy (filtering uncertain predictions).

Figure 5 Results: The visual corrections translate to real numbers. The Image-Only model made 30 errors. Using our Gated Metadata strategy reduced this to 20 errors—a 33.3% reduction in clinical misdiagnoses.