What Lumina Does
A radiologist can mark a tumor on a CT scan by drawing a straight line across it—the RECIST measurement. Creating a complete 3D segmentation, however, requires outlining the tumor across every slice where it appears, which is far more time-consuming.
This tutorial explains how Lumina works: a system that takes a CT scan and a single RECIST line and produces a 3D segmentation mask of the marked tumor.
Lumina was developed for the FLARE 2026 pan-cancer segmentation challenge. The system was designed to run on a CPU with an 8 GB memory limit and a 60-second inference limit.
This tutorial covers the main design decisions, implementation details, and experiments that shaped the final system.
What We'll Cover:
- What Lumina Does
- Prerequisites
- Step 1: Review Your Data Before Coding
- Step 2: Turn the RECIST Line into Network Input
- Step 3: Align All Tumors on a Common Grid
- Step 4: Build the 3D Segmentation Network
- Step 5: Use a Loss Function That Includes Boundary Information
Lumina Pipeline Overview
At a high level, Lumina transforms a single RECIST line into a full 3D mask through the following steps:
- Preprocess the CT volume and the RECIST annotation.
- Convert the line into a spatial prompt compatible with the network input.
- Align all tumors to a common grid using a learned canonical space.
- Run a 3D segmentation network that predicts the tumor mask.
- Optimize with a loss that incorporates boundary information.
The rest of this tutorial walks through each step in detail, sharing the rationale and practical implementation choices.
Prerequisites
To follow along, you should be comfortable with:
- Python and PyTorch (or a similar deep learning framework).
- Basic medical imaging concepts (CT volumes, voxels, Hounsfield units).
- 3D convolutional neural networks and segmentation losses (Dice, cross-entropy).
- Familiarity with the FLARE 2026 challenge setup (CPU-only, 8 GB RAM, 60 s inference) is helpful but not required.
Step 1: Review Your Data Before Coding
Before writing any code, it’s crucial to inspect the dataset. Two observations from the FLARE 2026 data shaped the entire pipeline.
The Scans Were Already Brightness-Adjusted
Many CT datasets require windowing or intensity clipping. In this case, the provided scans had already been brightness-adjusted—likely normalized to a consistent range. Applying additional windowing would have discarded useful information. Instead, we skipped windowing and applied only mild intensity normalization (see Step 3).
Coordinate Order Matters
RECIST lines are typically stored as (x, y) coordinates in the image plane, but 3D volumes use (z, y, x) or (x, y, z) depending on the library. Misinterpreting the order leads to misaligned prompts. We verified the convention by visualizing the line over the CT slice and ensured consistency throughout the pipeline.
Step 2: Turn the RECIST Line into Network Input
The network expects a spatial prompt that indicates the tumor’s location and extent. We convert the RECIST line into a binary mask on the same grid as the CT volume.
Draw the Line at the Required Resolution
We rasterize the line into a 3D volume where the line’s slice is marked, and optionally dilate it slightly to provide a more robust signal. The result is a binary volume that is concatenated with the CT as a second input channel.
This simple representation proved effective and kept the memory footprint low—critical for the 8 GB CPU constraint.
Step 3: Align All Tumors on a Common Grid
Tumors vary widely in size and location. To make learning easier, we align all tumors to a common grid by cropping a region around the RECIST line and resampling to a fixed size (e.g., 128×128×128). This standardization reduces variability and allows the network to focus on shape rather than absolute position.
Intensity Normalization
We normalized intensities per volume using z-score normalization (subtract mean, divide by standard deviation) computed over the cropped region. This step is lightweight and respects the original brightness adjustments.
Step 4: Build the 3D Segmentation Network
We used a 3D U-Net architecture with residual blocks, chosen for its balance of accuracy and efficiency. The network takes two channels: the normalized CT crop and the binary line mask. It outputs a single-channel probability map.
To meet the 60-second inference limit on CPU, we kept the model compact (≈2M parameters) and used depthwise separable convolutions. We also implemented sliding-window inference with 50% overlap, which fits within the memory budget.
Step 5: Use a Loss Function That Includes Boundary Information
Standard Dice loss alone can produce blobby masks that miss fine boundaries. We combined Dice loss with a boundary loss term that penalizes misalignment along the tumor edge. Specifically, we used a distance-transform-based boundary loss (Kervadec et al., 2019), which significantly improved contour accuracy in our experiments.
The total loss is: L = L_Dice + λ * L_Boundary, with λ set to 0.5.
These five steps form the core of Lumina. In the full implementation, we also added test-time augmentation and a lightweight post-processing step to remove small false positives. The system achieved competitive results on the FLARE 2026 validation set while adhering to the strict CPU and memory constraints.
via FreeCodeCamp
