Reliability of a convolutional neural network in segmenting multiple sclerosis lesions from MRI: Impact of data augmentation, image modality and tolerance with U-Net architecture.
Paper
Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Python · 34 lines · 1.2 KB · CC-BY-4.0
- import nibabel as nib
- import numpy as np
- import os
- from scipy.ndimage import binary_closing, binary_dilation, binary_erosion, label, find_objects
- direc = 'Training_Labels/'
- numberoffiles = len(os.listdir(direc))
- print(numberoffiles)
- data_dir = 'NewDatasets/Training_Labels/Q1'
- # Load the binary NIfTI file
- for filename in os.listdir(direc):
- img = os.path.join(direc, filename)
- img = nib.load(img)
- data = img.get_fdata()
- # Threshold the image
- data_thresh = data < 1 # Holes are represented by 0s
- # Use connected component labeling to identify the holes
- labels, num_labels = label(data_thresh)
- # Calculate the volume of each hole
- for i in range(1, num_labels + 1):
- mask = labels == i
- volume = np.sum(mask)
- if volume > 13.5:
- # Fill the hole using a binary closing operation
- struct = np.ones((5, 5, 5)) # Use a 5x5x5 structuring element
- mask_closed = binary_closing(mask, structure=struct)
- data[mask_closed] = 1
- # Save the filled image as a new binary NIfTI file
- img_filled = nib.Nifti1Image(data.astype(np.uint8), img.affine, img.header)
- nib.save(img_filled, os.path.join(data_dir, filename))
FillholesnewUpload.py, under CC-BY-4.0 · at the source
Overview
- School of Engineering, University of Birmingham, Edgbaston, Birmingham, United Kingdom
- School of Computer Science, University of Birmingham, Edgbaston, Birmingham, United Kingdom
- Institute of Inflammation and Ageing, University of Birmingham, Edgbaston, Birmingham, United Kingdom
- University Hospitals Birmingham NHS Foundation Trust, Edgbaston, Birmingham, United Kingdom
- Royal North Shore Hospital, St Leonards, Sydney, New South Wales, Australia
- School of Neurology, Dudley Group NHS Foundation Trust, Russells Hall Hospital, Birmingham, United Kingdom
- School of Life and Health Sciences, Aston University, Birmingham, United Kingdom
Abstract
Multiple Sclerosis (MS) is an inflammatory demyelinating disease of the central nervous system, typically exhibiting radiologically identifiable lesions within the brain and spinal cord, features key to both diagnosis and clinical disease monitoring. Manually identifying and segmenting lesions is both difficult and time consuming, thus optimising approaches to reliably automate segmentation is highly beneficial. The aim of this study was to assess the impact of data augmentation and manipulation on the accuracy of automated lesion segmentation using MRI scans from MS patients. Factors examined include MRI modalities in both isolation and combination, image augmentation, lesion size and size of testing set relative to training. The MICCAI 2016 MS dataset was used in this study, with U-Net chosen as the algorithmic method for segmentation. Each factor was optimised and then combined to maximise segmentation accuracy; the Dice metric was used as the focal metric to assess the efficacy of any given permutation of the setup. Statistical significance was assessed using the Mann–Whitney U-test, with each permutation repeated five to ten times to ensure robustness. The best Dice score achieved using the testing and training dataset as outlined in the MICCAI 2016 challenge rubric was 0.59, approximately a 2% improvement against controls. To achieve this result whilst adhering to the training and testing distribution as defined in the dataset publication, the optimal imaging sequence was determined to be proton density. The augmentation conditions used included implementing an additional rotation of the dataset (doubling it in size) and excluding lesions < 36.43 mm3 in volume. The impact of data manipulation and augmentation was found to be statistically significant against controls using a Mann-Whitney U-test for lesion segmentation. An ancillary finding of this study was that there was no statistically significant difference between using one MRI modality for training and another for testing.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repositories
Its files are read in the Code ↔ Paper reader above.
Zenodo 16211828
Availability: 1 check, the latest on 28 September 2026: the link answers (HTTP 200)
- 28 September 2026: the link answers (HTTP 200)
9 files
- MSLesionSegmentation/
FillholesnewUpload.py , Python, 34 lines - MSLesionSegmentation/
HolesAndVolumesUpload.py , Python, 59 lines - MSLesionSegmentation/
Losses.py , Python, 984 lines - MSLesionSegmentation/
MW.py , Python, 46 lines - MSLesionSegmentation/
RotateImagesDataset.py , Python, 180 lines - MSLesionSegmentation/
Train.py , Python, 34 lines - MSLesionSegmentation/
View.py , Python, 137 lines - MSLesionSegmentation/
utilities.py , Python, 488 lines - README.md, Text, 69 lines
adamhillingerszekely/unetbrainms
dcd9e39a693ce18df4059617e189cc95c1fbb63e, 5 May 2026Availability: 1 check, the latest on 28 September 2026: the link answers
- 28 September 2026: the link answers
9 files
- MSLesionSegmentation/
FillholesnewUpload.py , Python, 34 lines - MSLesionSegmentation/
HolesAndVolumesUpload.py , Python, 59 lines - MSLesionSegmentation/
Losses.py , Python, 984 lines - MSLesionSegmentation/
MW.py , Python, 46 lines - MSLesionSegmentation/
RotateImagesDataset.py , Python, 180 lines - MSLesionSegmentation/
Train.py , Python, 34 lines - MSLesionSegmentation/
View.py , Python, 137 lines - MSLesionSegmentation/
utilities.py , Python, 488 lines - README.md, Text, 72 lines
The paper's code and data availability statement is in the Data section.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 16 scripts, each with its path and the digest of its content;
- no match between paragraphs and code yet;
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Data Availability
Data used can be found in publicly accessible data repositories: (Shanoir), https://
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 28 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 7 authors, 1 funder, 37 references.
Cite
This paper
Szekely-Kohn, A. C., Castellani, M., Baronti, L., Ahmed, Z., Manifold, W. G. K., Douglas, M., & Espino, D. M. (2026). Reliability of a convolutional neural network in segmenting multiple sclerosis lesions from MRI: Impact of data augmentation, image modality and tolerance with U-Net architecture. PLOS digital health, 5(4), e0001316. https://
BibTeX
@article{szekelykohn2026
author = {Szekely-Kohn, Adam C and Castellani, Marco and Baronti, Luca and Ahmed, Zubair and Manifold, William G K and Douglas, Michael and Espino, Daniel M},
title = {{Reliability of a convolutional neural network in segmenting multiple sclerosis lesions from MRI: Impact of data augmentation, image modality and tolerance with U-Net architecture}},
journal = {PLOS digital health},
year = {2026},
month = apr,
volume = {5},
number = {4},
pages = {e0001316},
publisher = {PLOS},
issn = {2767-3170},
doi = {10.1371/
url = {https://
pmid = {41920815},
pmcid = {PMC13042652}
}
RIS
TY - JOUR
AU - Szekely-Kohn, Adam C
AU - Castellani, Marco
AU - Baronti, Luca
AU - Ahmed, Zubair
AU - Manifold, William G K
AU - Douglas, Michael
AU - Espino, Daniel M
TI - Reliability of a convolutional neural network in segmenting multiple sclerosis lesions from MRI: Impact of data augmentation, image modality and tolerance with U-Net architecture
T2 - PLOS digital health
J2 - PLOS Digit Health
PY - 2026
DA - 2026/
VL - 5
IS - 4
SP - e0001316
SN - 2767-3170
PB - PLOS
DO - 10.1371/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1371/
"type": "article-journal",
"title": "Reliability of a convolutional neural network in segmenting multiple sclerosis lesions from MRI: Impact of data augmentation, image modality and tolerance with U-Net architecture",
"container-title": "PLOS digital health",
"author": [
{
"family": "Szekely-Kohn",
"given": "Adam C"
},
{
"family": "Castellani",
"given": "Marco"
},
{
"family": "Baronti",
"given": "Luca"
},
{
"family": "Ahmed",
"given": "Zubair"
},
{
"family": "Manifold",
"given": "William G K"
},
{
"family": "Douglas",
"given": "Michael"
},
{
"family": "Espino",
"given": "Daniel M"
}
],
"container-title-short":
"volume": "5",
"issue": "4",
"page": "e0001316",
"DOI": "10.1371/
"PMID": "41920815",
"PMCID": "PMC13042652",
"ISSN": "2767-3170",
"publisher": "PLOS",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
1
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1162/imag.a.45 [code]
- Automatic segmentation of spinal cord lesions in MS: A robust tool for axial T2-weighted MRI scans.Journal: Imaging neuroscience (Cambridge, Mass.)In common: MONAI, scikit-image, NiBabel, 5 other tools, multiple sclerosis, methods / tools, structural MRI / diffusion, 5 references
- [2] doi:10.1038/s41467-025-58274-8 [code]
- Enabling new insights from old scans by repurposing clinical MRI archives for multiple sclerosis research.Journal: Nature communicationsIn common: MONAI, scikit-image, NiBabel, 4 other tools, multiple sclerosis, structural MRI / diffusion, 5 references
- [3] doi:10.1038/s41597-026-07184-5 [code]
- A Multiple Sclerosis MRI Dataset with Tri-Mask Annotations for Lesion Segmentation.Journal: Scientific dataIn common: scikit-image, NiBabel, scikit-learn, 3 other tools, multiple sclerosis, methods / tools, structural MRI / diffusion, 6 references
- [4] doi:10.1186/s12880-026-02481-2 [code]
- Deep learning-based neuroanatomical profiling reveals population-specific brain changes in multiple sclerosis: a large-scale Middle Eastern study.Journal: BMC medical imagingIn common: scikit-image, NiBabel, scikit-learn, 3 other tools, multiple sclerosis, structural MRI / diffusion, 6 references
- [5] doi:10.3389/fmed.2021.740248 [code]
- A Clinically-Compatible Workflow for Computer-Aided Assessment of Brain Disease Activity in Multiple Sclerosis Patients.Journal: Frontiers in medicineIn common: scikit-image, NiBabel, PyTorch, 4 other tools, multiple sclerosis, structural MRI / diffusion, 5 references
- [6] doi:10.3389/fmed.2026.1875760 [code]
- Adaptive multi-stage domain unlearning for white-matter lesion segmentation.Journal: Frontiers in medicineIn common: scikit-image, NiBabel, PyTorch, 4 other tools, methods / tools, structural MRI / diffusion, 5 references
- [7] doi:10.1093/gigascience/giaf092 [code]
- HeteroMRI: Robust white matter abnormality classification across multi-scanner MRI data.Journal: GigaScienceIn common: NiBabel, scikit-learn, SciPy, 1 other tool, methods / tools, structural MRI / diffusion, 6 references
- [8] doi:10.1016/j.nicl.2024.103611 [code]
- LST-AI: A deep learning ensemble for accurate MS lesion segmentation.Journal: NeuroImage. ClinicalIn common: scikit-image, NiBabel, PyTorch, 2 other tools, multiple sclerosis, methods / tools, structural MRI / diffusion, 5 references
- [9] doi:10.3389/fneur.2025.1620469 [code]
- Federated learning for lesion segmentation in multiple sclerosis: a real-world multi-center feasibility study.Journal: Frontiers in neurologyIn common: MONAI, scikit-image, NiBabel, 3 other tools, multiple sclerosis, structural MRI / diffusion, 3 references
- [10] doi: [code]
- nnSegNeXt: A 3D Convolutional Network for Brain Tissue Segmentation Based on Quality EvaluationJournal: Bioengineering (Basel, Switzerland)In common: MONAI, scikit-image, NiBabel, 5 other tools, methods / tools, structural MRI / diffusion, 2 references
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 2 repositories of the authors' code, each at its verified commit and with its license, 16 scripts, and 0 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:fde7e8647038c0cc…
Add the badge to the code's README
If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.
Markdown
<!-- oscr-badge:start -->
[](https://openscicode.org/badge/doi/10.1371/journal.pdig.0001316)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.1371/journal.pdig.0001316.svg
:target: https://openscicode.org/badge/doi/10.1371/journal.pdig.0001316
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1371/journal.pdig.0001316"><img src="https://openscicode.org/badge/doi/10.1371/journal.pdig.0001316.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".
If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.
Report a mismatch between the code and the paper · Report a code error (signed in)
Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.
Report a reproduction failure (signed in)
Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
