Providing the top performing algorithms from the Brain Tumor Segmentation (BraTS) challenges, through an easy to use Python API powered by docker.
- Access to top-performing algorithms from recent BraTS challenges
- Easy-to-use minimal API
- Extensive documentation and examples
With a Python 3.8+ environment, you can install brats
directly from PyPI:
pip install brats
Important
To run brats
you require a Docker installation.
Many algorithms also require GPU support (NVIDIA Docker).
In case you do not have access to a Cuda-capable GPU, the overview tables in the Available Algorithms and Usage section indicate which algorithms are CPU compatible.
- Docker: Installation instructions on the official website
- NVIDIA Container Toolkit: Refer to the NVIDIA install guide and the official GitHub page
Adult Glioma Segmentation
from brats import AdultGliomaSegmenter
from brats.constants import AdultGliomaAlgorithms
segmenter = AdultGliomaSegmenter(algorithm=AdultGliomaAlgorithms.BraTS23_1, cuda_devices="0")
# these parameters are optional, by default the winning algorithm will be used on cuda:0
segmenter.infer_single(
t1c="path/to/t1c.nii.gz",
t1n="path/to/t1n.nii.gz",
t2f="path/to/t2f.nii.gz",
t2w="path/to/t2w.nii.gz",
output_file="segmentation.nii.gz",
)
Class: brats.AdultGliomaSegmenter
(Docs)
Year | Rank | Author | Paper | CPU Support | Key Enum |
---|---|---|---|---|---|
2023 | 1st | André Ferreira, et al. | Link | ❌ | BraTS23_1 |
2023 | 2nd | Andriy Myronenko, et al. | N/A | ❌ | BraTS23_2 |
2023 | 3rd | Fadillah Adamsyah Maani, et al. | N/A | ❌ | BraTS23_3 |
BraTS-Africa Segmentation
from brats import AfricaSegmenter
from brats.constants import AfricaAlgorithms
segmenter = AfricaSegmenter(algorithm=AfricaAlgorithms.BraTS23_1, cuda_devices="0")
# these parameters are optional, by default the winning algorithm will be used on cuda:0
segmenter.infer_single(
t1c="path/to/t1c.nii.gz",
t1n="path/to/t1n.nii.gz",
t2f="path/to/t2f.nii.gz",
t2w="path/to/t2w.nii.gz",
output_file="segmentation.nii.gz",
)
Class: brats.AfricaSegmenter
(Docs)
Year | Rank | Author | Paper | CPU Support | Key Enum |
---|---|---|---|---|---|
2023 | 1st | Andriy Myronenko, et al. | TODO | ❌ | BraTS23_1 |
2023 | 2nd | Alyssa R Amod, et al. | N/A | ❌ | BraTS23_2 |
2023 | 3rd | Ziyan Huang, et al. | N/A | ✅ | BraTS23_3 |
Meningioma Segmentation
from brats import MeningiomaSegmenter
from brats.constants import MeningiomaAlgorithms
segmenter = MeningiomaSegmenter(algorithm=MeningiomaAlgorithms.BraTS23_1, cuda_devices="0")
# these parameters are optional, by default the winning algorithm will be used on cuda:0
segmenter.infer_single(
t1c="path/to/t1c.nii.gz",
t1n="path/to/t1n.nii.gz",
t2f="path/to/t2f.nii.gz",
t2w="path/to/t2w.nii.gz",
output_file="segmentation.nii.gz",
)
Class: brats.MeningiomaSegmenter
(Docs)
Year | Rank | Author | Paper | CPU Support | Key Enum |
---|---|---|---|---|---|
2023 | 1st | Andriy Myronenko, et al. | N/A | ❌ | BraTS23_1 |
2023 | 2nd | Ziyan Huang, et al. | N/A | ✅ | BraTS23_2 |
2023 | 3rd | Zhifan Jiang et al. | N/A | ❌ | BraTS23_3 |
Brain Metastases Segmentation
from brats import MetastasesSegmenter
from brats.constants import MetastasesAlgorithms
segmenter = MetastasesSegmenter(algorithm=MetastasesAlgorithms.BraTS23_1, cuda_devices="0")
# these parameters are optional, by default the winning algorithm will be used on cuda:0
segmenter.infer_single(
t1c="path/to/t1c.nii.gz",
t1n="path/to/t1n.nii.gz",
t2f="path/to/t2f.nii.gz",
t2w="path/to/t2w.nii.gz",
output_file="segmentation.nii.gz",
)
Class: brats.MetastasesSegmenter
(Docs)
Year | Rank | Author | Paper | CPU Support | Key Enum |
---|---|---|---|---|---|
2023 | 1st | Andriy Myronenko, et al. | N/A | ❌ | BraTS23_1 |
2023 | 2nd | Siwei Yang, et al. | N/A | ❌ | BraTS23_2 |
2023 | 3rd | Ziyan Huang, et al. | N/A | ✅ | BraTS23_3 |
Pediatric Segmentation
from brats import PediatricSegmenter
from brats.constants import PediatricAlgorithms
segmenter = PediatricSegmenter(algorithm=PediatricAlgorithms.BraTS23_1, cuda_devices="0")
# these parameters are optional, by default the winning algorithm will be used on cuda:0
segmenter.infer_single(
t1c="path/to/t1c.nii.gz",
t1n="path/to/t1n.nii.gz",
t2f="path/to/t2f.nii.gz",
t2w="path/to/t2w.nii.gz",
output_file="segmentation.nii.gz",
)
Class: brats.PediatricSegmenter
(Docs)
Year | Rank | Author | Paper | CPU Support | Key Enum |
---|---|---|---|---|---|
2023 | 1st | Zhifan Jiang et al. | N/A | ❌ | BraTS23_1 |
2023 | 2nd | Andriy Myronenko, et al. | N/A | ❌ | BraTS23_2 |
2023 | 3rd | Yubo Zhou | N/A | ❌ | BraTS23_3 |
Inpainting
from brats import Inpainter
from brats.constants import InpaintingAlgorithms
inpainter = Inpainter(algorithm=InpaintingAlgorithms.BraTS24_1, cuda_devices="0")
inpainter.infer_single(
t1n="path/to/voided_t1n.nii.gz",
mask="path/to/mask.nii.gz",
output_file="inpainting.nii.gz",
)
Class: brats.Inpainter
(Docs)
Year | Rank | Author | Paper | CPU Support | Key Enum |
---|---|---|---|---|---|
2024 | 1st | Ke Chen, Juexin Zhang, Ying Weng | N/A | ✅ | BraTS24_1 |
2024 | 2nd | André Ferreira, et al. | N/A | ❌ | BraTS24_2 |
2024 | 3rd | Team SMINT | N/A | ❌ | BraTS24_3 |
2023 | 1st | Juexin Zhang, et al. | N/A | ✅ | BraTS23_1 |
2023 | 2nd | Alicia Durrer, et al. | N/A | ❌ | BraTS23_2 |
2023 | 3rd | Jiayu Huo, et al. | N/A | ✅ | BraTS23_3 |
Missing MRI
from brats import MissingMRI
from brats.constants import MissingMRIAlgorithms
missing_mri = MissingMRI(algorithm=MissingMRIAlgorithms.BraTS24_1, cuda_devices="0")
# Example to synthesize t2f modality (whichever modality is missing will be inferred)
missing_mri.infer_single(
t1c="path/to/t1c.nii.gz",
t1n="path/to/t1n.nii.gz",
# t2f="path/to/t2f.nii.gz",
t2w="path/to/t2w.nii.gz",
output_file="inferred_t2f.nii.gz",
)
Class: brats.MissingMRI
(Docs)
Year | Rank | Author | Paper | CPU Support | Key Enum |
---|---|---|---|---|---|
2024 | 1st | Jihoon Cho, Seunghyuck Park, Jinah Park | N/A | ❌ | BraTS24_1 |
2024 | 2nd | Haowen Pang | N/A | ❌ | BraTS24_2 |
2024 | 3rd | Minjoo Lim, Bogyeong Kang | N/A | ❌ | BraTS24_3 |
If you use BraTS in your research, please cite it to support the development!
TODO: citation will be added asap
We welcome all kinds of contributions from the community!
Please open a new issue here.
Nice to have you on board! Please have a look at our CONTRIBUTING.md file.