Skip to main page content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Access keys NCBI Homepage MyNCBI Homepage Main Content Main Navigation
. 2025 Sep 10:3:IMAG.a.147.
doi: 10.1162/IMAG.a.147. eCollection 2025.

Automated generation of epilepsy surgery resection masks: The RAMPS pipeline

Affiliations

Automated generation of epilepsy surgery resection masks: The RAMPS pipeline

Callum Simpson et al. Imaging Neurosci (Camb). .

Abstract

MRI-based delineation of brain tissue removed by epilepsy surgery can be challenging due to post-operative brain shift. In consequence, most studies use manual approaches which are prohibitively time-consuming for large sample sizes, require expertise, and can be prone to errors. We propose RAMPS (Resections And Masks in Preoperative Space), an automated pipeline to generate a 3D resection mask of pre-operative tissue. Our pipeline leverages existing software including FreeSurfer, SynthStrip, Sythnseg and ANTs to generate a mask in the same space as the patient's pre-operative T1 weighted MRI. We compare our automated masks against manually drawn masks and two other existing pipelines (Epic-CHOP and ResectVol). Comparing to manual masks (N = 87), RAMPS achieved a median (IQR) dice similarity of 0.86 (0.078) in temporal lobe resections, and 0.72 (0.32) in extratemporal resections. In comparison to other pipelines, RAMPS had higher dice similarities (N = 62) (RAMPS: 0.86, Epic-CHOP: 0.72, ResectVol: 0.72). We release a user-friendly, easy-to-use pipeline, RAMPS, open source for accurate delineation of resected tissue.

Keywords: epilepsy; mask; resection; surgery; volume.

PubMed Disclaimer

Conflict of interest statement

The authors declare no competing interests.

Figures

Fig. 1.
Fig. 1.
The need to generate resection masks in preoperative space. Illustrated is the axial aligned (A) post-operative and (B) the pre-operative T1w images for a frontal lobe resection. Following surgery, sagging is noted within the resected cavity. (C) shows a manually drawn mask following the resection cavity seen in the post-operative image. (D) shows a manually drawn resection mask that indicates the pre-operative tissue that is shown to be resected in the post-operative image. (E) Highlights the difference between these two resection cavity interpretations.
Fig. 2.
Fig. 2.
Overview of the RAMPS pipeline. Using a T1w pre- and post-operative image, as well as hemisphere and lobe of resection, RAMPS generates a mask of resected pre-operative tissue in 3 steps. Step 1 is data preparation, in which a series of steps are undertaken to remove noise from the image, extract the brain tissue, and create a lobe atlas map of the brain. Step 2 uses ANTs registration to align the post-operative brain to the pre-operative. Step 3 is mask creation which involves delineating the resection cavity in the post-operative space resection and then expanding to the pre-operative tissue boundary.
Fig. 3.
Fig. 3.
Similarity of manual and RAMPS generated masks. Using the Dice similarity coefficient for mask comparison, the TLE cohort (A) achieved a median similarity of 0.86 (IQR, 0.078) and the ETLE cohort (B) achieved a median similarity of 0.71 (IQR, 0.32). Example images, along with generated masks are shown in right panels.
Fig. 4.
Fig. 4.
Performance metrics to analyze mask similarity besides DSC. (A) Example of a possible manual and an automated mask. This overlay can be divided into three categories: true positive, which are voxels included in both masks; false negatives, which are voxels included only in the manual mask; and false positives, which are voxels included only in the automated mask. (B) Using these metrics, the following may be calculated: overlap, which measures how effective the automation is at capturing the manual mask; miss rate, representing the percentage of the manual mask not captured; and False discovery rate (FDR), indicating the percentage of voxels identified by automation that fall outside the Manual mask. (C) Shows the results of the comparison of RAMPS to manual under these metrics.
Fig. 5.
Fig. 5.
Pipeline comparison. The automated masks produced by RAMPS with lobe and hemisphere information, RAMPS without this optional information, and Epic-CHOP and ResectVol compared against a cohort of manual masks (N = 62). Each data point represents an individual patient. The median (IQR) were: (A) DSC metrics: RAMPS with 86% (7%), RAMPS without 86% (10%), Epic-CHOP 72% (16%), and ResectVol 72% (21%), (B) overlap metrics: RAMPS with 76% (11%), RAMPS without 75% (15%), Epic-CHOP 56% (21%), and ResectVol 56% (24%), (C) miss rate: RAMPS with 7% (9%), RAMPS without 6% (8%), Epic-CHOP 38% (21%), and ResectVol 38% (25%), (D) False discovery rate: RAMPS with 17% (12%), RAMPS without 18% (17%), Epic-CHOP 4% (12%), and ResectVol 7% (8%).
Fig. 6.
Fig. 6.
Visualization of resection mask output. The Pre and Post-operative images with the corresponding manually drawn mask and the automated resections masks produced RAMPS with lobe and hemisphere information, RAMPS without this optional information, Epic-CHOP and ResectVol to illustrate differing pipeline Dice similarity coefficient (DSC) performance across examples. (A) All pipelines yield high DSC (RAMPS with – 0.89, RAMPS without – 0.89, Epic-CHOP – 0.89, ResectVol – 0.86), (B) ResectVol yields lower DSC (RAMPS with – 0.82, RAMPS without – 0.77, Epic-CHOP – 0.82, ResectVol – 0.69), (C) Epic-CHOP yields lower DSC (RAMPS with – 0.88, RAMPS without – 0.87, Epic-CHOP – 0.71, ResectVol – 0.88), (D) RAMPS outperforms (RAMPS with – 0.88, RAMPS without – 0.87, Epic-CHOP – 0.62, ResectVol – 0.63), (E) RAMPS yields lower DSC (RAMPS with – 0.48, RAMPS without – 0.48, Epic-CHOP – 0.65, ResectVol – 0.59), (F) RAMPS with lobe and hemisphere information outperforms RAMPS without (RAMPS with – 0.85, RAMPS without – 0., Epic-CHOP – 0.65, ResectVol – 0.62), (G) All pipelines performed poorly (RAMPS with – 0.48, RAMPS without – 0.44, Epic-CHOP – 0.54, ResectVol – 0.45).
Fig. 7.
Fig. 7.
Demonstrating RAMPS’ DSC performance under nonstandard situations. Here, we visualize the automated masks produced for (A) a small lesionectomy (DSC = 0.8), (B) a second surgery (DSC = 0.8), (C) preoperative cavernoma (DSC = 0.83), (D) extreme sagging into the CSF cavity (DSC = 0.85), and (E) contrast agent injection (DSC = 0.85).

References

    1. Ahmed, B., Brodley, C. E., Blackmon, K. E., Kuzniecky, R., Barash, G., Carlson, C., Quinn, B. T., Doyle, W., French, J., Devinsky, O., & Thesen, T. (2015). Cortical feature analysis and machine learning improves detection of “MRI-negative” focal cortical dysplasia. Epilepsy & Behavior, 48, 21–28. 10.1016/j.yebeh.2015.04.055 - DOI - PMC - PubMed
    1. Arnold, T. C., Muthukrishnan, R., Pattnaik, A. R., Sinha, N., Gibson, A., Gonzalez, H., Das, S. R., Litt, B., Englot, D. J., Morgan, V. L., Davis, K. A., & Stein, J. M. (2022). Deep learning-based automated segmentation of resection cavities on postsurgical epilepsy MRI. NeuroImage: Clinical, 36, 103154. 10.1016/j.nicl.2022.103154 - DOI - PMC - PubMed
    1. Avants, B. B., Tustison, N. J., Wu, J., Cook, P. A., & Gee, J. C. (2011). An open source multivariate framework for n-tissue segmentation with evaluation on public data. Neuroinformatics, 9, 381–400. 10.1007/s12021-011-9109-y - DOI - PMC - PubMed
    1. Billardello, R., Ntolkeras, G., Chericoni, A., Madsen, J. R., Papadelis, C., Pearl, P. L., Grant, P. E., Taffoni, F., & Tamilia, E. (2022). Novel user-friendly application for MRI segmentation of brain resection following epilepsy surgery. Diagnostics, 12, 1017. 10.3390/diagnostics12041017 - DOI - PMC - PubMed
    1. Billot, B., Greve, D. N., Puonti, O., Thielscher, A., Van Leemput, K., Fischl, B., Dalca, A. V., Iglesias, J. E., & ADNI. (2023). SynthSeg: Segmentation of brain MRI scans of any contrast and resolution without retraining. Medical Image Analysis, 86, 102789. 10.1016/j.media.2023.102789 - DOI - PMC - PubMed

LinkOut - more resources