https://github.com/brainlesion/preprocessing
preprocessing tools for multi-modal 3D brain imaging
Science Score: 49.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 2 DOI reference(s) in README -
✓Academic publication links
Links to: arxiv.org, zenodo.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.2%) to scientific vocabulary
Keywords
Repository
preprocessing tools for multi-modal 3D brain imaging
Basic Info
- Host: GitHub
- Owner: BrainLesion
- License: apache-2.0
- Language: C
- Default Branch: main
- Homepage: https://arxiv.org/abs/2507.09036
- Size: 1.19 GB
Statistics
- Stars: 20
- Watchers: 1
- Forks: 6
- Open Issues: 6
- Releases: 0
Topics
Metadata Files
README.md
BrainLes-Preprocessing
BrainLes preprocessing is a comprehensive tool for preprocessing tasks in biomedical imaging, with a focus on (but not limited to) multi-modal brain MRI. It can be used to build modular preprocessing pipelines:
This includes normalization, co-registration, atlas registration, skullstripping / brain extraction, N4 Bias correction and defacing. We provide means to transform images and segmentations in both directions between native and atlas space.
BrainLes is written modular and backend-agnostic meaning it allows to skip or swap registration, brain extraction, N4 bias correction and defacing tools.
Installation
With a Python 3.10+ environment you can install directly from pypi.org:
pip install brainles-preprocessing
We recommend using Python 3.10 / 3.11 / 3.12.
[!NOTE]
For python3.13the installation can currently fail with the errorFailed to build antspyx. This usually means that there is no pre-built wheel for the package and it has to be build locally. This will require cmake (install e.g. withpip install cmake) and quite some time. Rerunning the installation with cmake installed should fix the error.
Usage
A minimal example to register (to the standard atlas using ANTs) and skull strip (using HDBet) a t1c image (center modality) with 1 moving modality (flair) could look like this: ```python from pathlib import Path from brainlespreprocessing.modality import Modality, CenterModality from brainlespreprocessing.normalization.percentilenormalizer import ( PercentileNormalizer, ) from brainlespreprocessing.preprocessor import Preprocessor
patient_folder = Path("/home/marcelrosier/preprocessing/patient")
specify a normalizer
percentilenormalizer = PercentileNormalizer( lowerpercentile=0.1, upperpercentile=99.9, lowerlimit=0, upper_limit=1, )
define center and moving modalities
center = CenterModality( modalityname="t1c", inputpath=patientfolder / "t1c.nii.gz", normalizer=percentilenormalizer, # specify the output paths for the raw and normalized images of each step - here only for atlas registered and brain extraction rawskulloutputpath="patient/rawskulldir/t1cskullraw.nii.gz", rawbetoutputpath="patient/rawbetdir/t1cbetraw.nii.gz", rawdefacedoutputpath="patient/rawdefaceddir/t1cdefacedraw.nii.gz", normalizedskulloutputpath="patient/normskulldir/t1cskullnormalized.nii.gz", normalizedbetoutputpath="patient/normbetdir/t1cbetnormalized.nii.gz", normalizeddefacedoutputpath="patient/normdefaceddir/t1cdefacednormalized.nii.gz", # specify output paths for the brain extraction and defacing masks betmaskoutputpath="patient/masks/t1cbetmask.nii.gz", defacingmaskoutputpath="patient/masks/t1cdefacingmask.nii.gz", )
movingmodalities = [ Modality( modalityname="flair", inputpath=patientfolder / "flair.nii.gz", normalizer=percentilenormalizer, # specify the output paths for the raw and normalized images of each step - here only for atlas registered and brain extraction rawskulloutputpath="patient/rawskulldir/flaskullraw.nii.gz", rawbetoutputpath="patient/rawbetdir/flabetraw.nii.gz", rawdefacedoutputpath="patient/rawdefaceddir/fladefacedraw.nii.gz", normalizedskulloutputpath="patient/normskulldir/flaskullnormalized.nii.gz", normalizedbetoutputpath="patient/normbetdir/flabetnormalized.nii.gz", normalizeddefacedoutputpath="patient/normdefaceddir/fladefaced_normalized.nii.gz", ) ]
instantiate and run the preprocessor using defaults for backends (registration, brain extraction, bias correction, defacing)
preprocessor = Preprocessor( centermodality=center, movingmodalities=moving_modalities, )
preprocessor.run()
```
The package allows to choose registration backends, brain extraction tools and defacing methods.
An example notebook with 4 modalities and further outputs and customizations can be found following these badges:
For further information please have a look at our Jupyter Notebook tutorials in our tutorials repo (WIP).
Citation
[!IMPORTANT] If you use
brainles-preprocessingin your research, please cite it to support the development!
Kofler, F., Rosier, M., Astaraki, M., Möller, H., Mekki, I. I., Buchner, J. A., Schmick, A., Pfiffer, A., Oswald, E., Zimmer, L., Rosa, E. de la, Pati, S., Canisius, J., Piffer, A., Baid, U., Valizadeh, M., Linardos, A., Peeken, J. C., Shit, S., … Menze, B. (2025). BrainLesion Suite: A Flexible and User-Friendly Framework for Modular Brain Lesion Image Analysis arXiv preprint arXiv:2507.09036
@misc{kofler2025brainlesionsuiteflexibleuserfriendly,
title={BrainLesion Suite: A Flexible and User-Friendly Framework for Modular Brain Lesion Image Analysis},
author={Florian Kofler and Marcel Rosier and Mehdi Astaraki and Hendrik Möller and Ilhem Isra Mekki and Josef A. Buchner and Anton Schmick and Arianna Pfiffer and Eva Oswald and Lucas Zimmer and Ezequiel de la Rosa and Sarthak Pati and Julian Canisius and Arianna Piffer and Ujjwal Baid and Mahyar Valizadeh and Akis Linardos and Jan C. Peeken and Surprosanna Shit and Felix Steinbauer and Daniel Rueckert and Rolf Heckemann and Spyridon Bakas and Jan Kirschke and Constantin von See and Ivan Ezhov and Marie Piraud and Benedikt Wiestler and Bjoern Menze},
year={2025},
eprint={2507.09036},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2507.09036},
}
Documentation
We provide a (WIP) documentation. Have a look here
FAQ
Please credit the authors by citing their work.
Registration
We currently fully support: - ANTs (default) - Niftyreg (Linux)
We also offer basic support for:
- greedy (Optional dependency, install via: pip install brainles_preprocessing[picsl_greedy])
- elastix (Optional dependency, install via: pip install brainles_preprocessing[itk-elastix])
As of now we do not offer inverse transforms for greedy and elastix. Please resort to ANTs or Niftyreg for this.
Atlas Reference
We provide a range of different atlases via zenodo, namely: - SRI24 and its skull-stripped version - MNI152: MNIICBM2009cNonlinearSymmetric - Slightly modified MNI152 and SRI24 atlas versions as employed for the BraTS challenge algorithms
[!NOTE]
Custom atlases of your choice in NIfTI format are also supported
N4 Bias correction
We currently provide support for N4 Bias correction based on SimpleITK
Brain extraction
We currently support:
- HD-BET
- SynthStrip (Optional dependency, install via: pip install brainles_preprocessing[synthstrip])
Defacing
We currently provide support for Quickshear.
Owner
- Name: BrainLesion
- Login: BrainLesion
- Kind: organization
- Repositories: 1
- Profile: https://github.com/BrainLesion
GitHub Events
Total
- Create event: 32
- Release event: 13
- Issues event: 54
- Watch event: 6
- Delete event: 23
- Issue comment event: 100
- Push event: 112
- Pull request review comment event: 50
- Pull request event: 59
- Pull request review event: 82
- Fork event: 3
Last Year
- Create event: 32
- Release event: 13
- Issues event: 54
- Watch event: 6
- Delete event: 23
- Issue comment event: 100
- Push event: 112
- Pull request review comment event: 50
- Pull request event: 59
- Pull request review event: 82
- Fork event: 3
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 46
- Total pull requests: 51
- Average time to close issues: about 1 month
- Average time to close pull requests: 4 days
- Total issue authors: 9
- Total pull request authors: 7
- Average comments per issue: 0.72
- Average comments per pull request: 0.78
- Merged pull requests: 41
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 32
- Pull requests: 36
- Average time to close issues: 14 days
- Average time to close pull requests: 1 day
- Issue authors: 5
- Pull request authors: 6
- Average comments per issue: 0.31
- Average comments per pull request: 1.03
- Merged pull requests: 27
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- neuronflow (23)
- MarcelRosier (11)
- sarthakpati (5)
- LMZimmer (2)
- evamariie (1)
- Astarakee (1)
- Niko-k98 (1)
- min9kwak (1)
- LennartPhil (1)
Pull Request Authors
- MarcelRosier (30)
- neuronflow (13)
- sarthakpati (3)
- evamariie (2)
- IsraMekki0 (1)
- yasinzaii (1)
- CCaredda (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 973 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 48
- Total maintainers: 1
pypi.org: brainles-preprocessing
Tool for preprocessing tasks in biomedical imaging, with a focus on (but not limited to) multi-modal brain MRI
- Documentation: https://brainles-preprocessing.readthedocs.io/
- License: Apache-2.0
-
Latest release: 0.6.6
published 6 months ago