# BraTS
[](https://pypi.org/project/brats/)
[](https://pypi.python.org/pypi/brats/)
[](http://brats.readthedocs.io/?badge=latest)
[](https://github.com/BrainLesion/brats/actions/workflows/tests.yml)
[](https://codecov.io/gh/BrainLesion/BraTS)
[](https://opensource.org/licenses/Apache-2.0)
Providing the top performing algorithms from the Brain Tumor Segmentation (BraTS) challenges, through an easy to use Python API powered by docker.
## Features
- Access to top-performing algorithms from recent BraTS challenges
- Easy-to-use minimal API
- Extensive documentation and examples
## Installation
With a Python 3.8+ environment, you can install `brats` directly from [PyPI](https://pypi.org/project/brats/):
```bash
pip install brats
```
> [!IMPORTANT]
> To run `brats` you require a Docker installation. <br>
> Many algorithms also require GPU support (NVIDIA Docker). <br>
> In case you do not have access to a Cuda-capable GPU, the overview tables in the [Available Algorithms and Usage](#available-algorithms-and-usage) section indicate which algorithms are CPU compatible.
### Docker and NVIDIA Container Toolkit Setup
- **Docker**: Installation instructions on the official [website](https://docs.docker.com/get-docker/)
- **NVIDIA Container Toolkit**: Refer to the [NVIDIA install guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) and the official [GitHub page](https://github.com/NVIDIA/nvidia-container-toolkit)
## Available Algorithms and Usage
### Segmentation
<details>
<summary> <strong> Adult Glioma Segmentation (Pre Treatment) </strong> </summary>
<br>
```python
from brats import AdultGliomaPreTreatmentSegmenter
from brats.constants import AdultGliomaPreTreatmentAlgorithms
segmenter = AdultGliomaPreTreatmentSegmenter(algorithm=AdultGliomaPreTreatmentAlgorithms.BraTS23_1, cuda_devices="0")
# these parameters are optional, by default the winning algorithm of 2023 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.AdultGliomaPreTreatmentSegmenter` ([Docs](https://brats.readthedocs.io/en/latest/core/segmentation_algorithms.html#brats.core.segmentation_algorithms.AdultGliomaPreTreatmentSegmenter))
| Year | Rank | Author | Paper | CPU Support | Key Enum |
| ---- | ---- | --------------------------------- | ------------------------------------------ | ----------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| 2023 | 1st | _André Ferreira, et al._ | [Link](https://arxiv.org/abs/2402.17317v1) | ❌ | [BraTS23_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.**AdultGliomaPreTreatmentAlgorithms**.BraTS23_1) |
| 2023 | 2nd | _Andriy Myronenko, et al._ | N/A | ❌ | [BraTS23_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.**AdultGliomaPreTreatmentAlgorithms**.BraTS23_2) |
| 2023 | 3rd | _Fadillah Adamsyah Maani, et al._ | N/A | ❌ | [BraTS23_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.**AdultGliomaPreTreatmentAlgorithms**.BraTS23_3) |
</details>
<details>
<summary> <strong> Adult Glioma Segmentation Post Treatment </strong> </summary>
<br>
```python
from brats import AdultGliomaPostTreatmentSegmenter
from brats.constants import AdultGliomaPostTreatmentAlgorithms
segmenter = AdultGliomaPostTreatmentSegmenter(algorithm=AdultGliomaPostTreatmentAlgorithms.BraTS23_1, cuda_devices="0")
# these parameters are optional, by default the winning algorithm of 2024 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.AdultGliomaPostTreatmentSegmenter` ([Docs](https://brats.readthedocs.io/en/latest/core/segmentation_algorithms.html#brats.core.segmentation_algorithms.AdultGliomaPostTreatmentSegmenter))
| Year | Rank | Author | Paper | CPU Support | Key Enum |
| ---- | ---- | ------------------------ | ----- | ----------- | --------------------------------------------------------------------------------------------------------------------------------- |
| 2024 | 1st | _André Ferreira, et al._ | N/A | ❌ | [BraTS24_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.AdultGliomaPostTreatmentAlgorithms.BraTS24_1) |
| 2024 | 2nd | _Team kimbab_ | N/A | ❌ | [BraTS24_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.AdultGliomaPostTreatmentAlgorithms.BraTS24_2) |
| 2024 | 3rd | _Adrian Celaya_ | N/A | ✅ | [BraTS24_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.AdultGliomaPostTreatmentAlgorithms.BraTS24_3) |
</details>
<details>
<summary> <strong> BraTS-Africa Segmentation </strong> </summary>
<br>
```python
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](https://brats.readthedocs.io/en/latest/core/segmentation_algorithms.html#brats.core.segmentation_algorithms.AfricaSegmenter))
| Year | Rank | Author | Paper | CPU Support | Key Enum |
| ---- | ---- | -------------------------- | ----- | ----------- | --------------------------------------------------------------------------------------------------------------- |
| 2024 | 1st | _Zhifan Jiang et al._ | N/A | ❌ | [BraTS24_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.AfricaAlgorithms.BraTS24_1) |
| 2024 | 2nd | _Long Bai, et al._ | N/A | ✅ | [BraTS24_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.AfricaAlgorithms.BraTS24_2) |
| 2024 | 1st | _Sarim Hashmi, et al._ | N/A | ❌ | [BraTS24_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.AfricaAlgorithms.BraTS24_3) |
| 2023 | 1st | _Andriy Myronenko, et al._ | TODO | ❌ | [BraTS23_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.AfricaAlgorithms.BraTS23_1) |
| 2023 | 2nd | _Alyssa R Amod, et al._ | N/A | ❌ | [BraTS23_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.AfricaAlgorithms.BraTS23_2) |
| 2023 | 3rd | _Ziyan Huang, et al._ | N/A | ✅ | [BraTS23_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.AfricaAlgorithms.BraTS23_3) |
</details>
<details>
<summary> <strong> Meningioma Segmentation </strong> </summary>
<br>
**Note**
Unlike other segmentation challenges the expected inputs for the Meningioma Segmentation Algorithms differ between years.
- _2023_: All 4 modalities are used (t1c, t1n, t2f, t2w)
- _2024_: Only t1c is used
Therefore the usage differs slightly, depending on which algorithm is used. To understand why, please refer to the [2024 challenge manuscript](https://arxiv.org/abs/2405.18383).
```python
from brats import MeningiomaSegmenter
from brats.constants import MeningiomaAlgorithms
### Example for 2023 algorithms
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_23.nii.gz",
)
### Example for 2024 algorithms
segmenter = MeningiomaSegmenter(algorithm=MeningiomaAlgorithms.BraTS24_1, cuda_devices="0")
segmenter.infer_single(
t1c="path/to/t1c.nii.gz",
output_file="segmentation_24.nii.gz",
)
```
**Class:** `brats.MeningiomaSegmenter` ([Docs](https://brats.readthedocs.io/en/latest/core/segmentation_algorithms.html#brats.core.segmentation_algorithms.MeningiomaSegmenter))
| Year | Rank | Author | Paper | CPU Support | Key Enum |
| ---- | ---- | -------------------------- | ----- | ----------- | ------------------------------------------------------------------------------------------------------------------- |
| 2024 | 1st | _Valeria Abramova_ | N/A | ❌ | [BraTS24_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MeningiomaAlgorithms.BraTS24_1) |
| 2024 | 2nd | _Mehdi Astaraki_ | N/A | ❌ | [BraTS24_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MeningiomaAlgorithms.BraTS24_2) |
| 2024 | 3rd | _Andre Ferreira, et al._ | N/A | ✅ | [BraTS24_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MeningiomaAlgorithms.BraTS24_3) |
| 2023 | 1st | _Andriy Myronenko, et al._ | N/A | ❌ | [BraTS23_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MeningiomaAlgorithms.BraTS23_1) |
| 2023 | 2nd | _Ziyan Huang, et al._ | N/A | ✅ | [BraTS23_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MeningiomaAlgorithms.BraTS23_2) |
| 2023 | 3rd | _Zhifan Jiang et al._ | N/A | ❌ | [BraTS23_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MeningiomaAlgorithms.BraTS23_3) |
</details>
<details>
<summary> <strong> Brain Metastases Segmentation </strong> </summary>
<br>
```python
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](https://brats.readthedocs.io/en/latest/core/segmentation_algorithms.html#brats.core.segmentation_algorithms.MetastasesSegmenter))
| Year | Rank | Author | Paper | CPU Support | Key Enum |
| ---- | ---- | -------------------------- | ----- | ----------- | ------------------------------------------------------------------------------------------------------------------- |
| 2023 | 1st | _Andriy Myronenko, et al._ | N/A | ❌ | [BraTS23_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MetastasesAlgorithms.BraTS23_1) |
| 2023 | 2nd | _Siwei Yang, et al._ | N/A | ❌ | [BraTS23_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MetastasesAlgorithms.BraTS23_2) |
| 2023 | 3rd | _Ziyan Huang, et al._ | N/A | ✅ | [BraTS23_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MetastasesAlgorithms.BraTS23_3) |
</details>
<details>
<summary> <strong> Pediatric Segmentation </strong> </summary>
<br>
```python
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](https://brats.readthedocs.io/en/latest/core/segmentation_algorithms.html#brats.core.segmentation_algorithms.PediatricSegmenter))
| Year | Rank | Author | Paper | CPU Support | Key Enum |
| ---- | ---- | -------------------------- | ----- | ----------- | ------------------------------------------------------------------------------------------------------------------ |
| 2024 | 1st | _Tim Mulvany, et al._ | N/A | ❌ | [BraTS24_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.PediatricAlgorithms.BraTS24_1) |
| 2024 | 2nd | _Mehdi Astaraki_ | N/A | ❌ | [BraTS24_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.PediatricAlgorithms.BraTS24_2) |
| 2024 | 3rd | _Sarim Hashmi, et al._ | N/A | ❌ | [BraTS24_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.PediatricAlgorithms.BraTS24_3) |
| 2023 | 1st | _Zhifan Jiang et al._ | N/A | ❌ | [BraTS23_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.PediatricAlgorithms.BraTS23_1) |
| 2023 | 2nd | _Andriy Myronenko, et al._ | N/A | ❌ | [BraTS23_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.PediatricAlgorithms.BraTS23_2) |
| 2023 | 3rd | _Yubo Zhou_ | N/A | ❌ | [BraTS23_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.PediatricAlgorithms.BraTS23_3) |
</details>
### Inpainting
<details>
<summary> <strong> Inpainting </strong> </summary>
<br>
```python
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](https://brats.readthedocs.io/en/latest/core/inpainting_algorithms.html#brats.core.inpainting_algorithms.Inpainter))
| Year | Rank | Author | Paper | CPU Support | Key Enum |
| ---- | ---- | ---------------------------------- | ----- | ----------- | ------------------------------------------------------------------------------------------------------------------- |
| 2024 | 1st | _Ke Chen, Juexin Zhang, Ying Weng_ | N/A | ✅ | [BraTS24_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.InpaintingAlgorithms.BraTS24_1) |
| 2024 | 2nd | _André Ferreira, et al._ | N/A | ❌ | [BraTS24_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.InpaintingAlgorithms.BraTS24_2) |
| 2024 | 3rd | _Team SMINT_ | N/A | ❌ | [BraTS24_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.InpaintingAlgorithms.BraTS24_3) |
| 2023 | 1st | _Juexin Zhang, et al._ | N/A | ✅ | [BraTS23_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.InpaintingAlgorithms.BraTS23_1) |
| 2023 | 2nd | _Alicia Durrer, et al._ | N/A | ❌ | [BraTS23_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.InpaintingAlgorithms.BraTS23_2) |
| 2023 | 3rd | _Jiayu Huo, et al._ | N/A | ✅ | [BraTS23_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.InpaintingAlgorithms.BraTS23_3) |
</details>
### Missing MRI
<details>
<summary> <strong> Missing MRI </strong> </summary>
<br>
```python
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](https://brats.readthedocs.io/en/latest/core/missing_mri_algorithms.html#brats.core.missing_mri_algorithms.MissingMRI))
| Year | Rank | Author | Paper | CPU Support | Key Enum |
| ---- | ---- | ----------------------------------------- | ----- | ----------- | ------------------------------------------------------------------------------------------------------------------- |
| 2024 | 1st | _Jihoon Cho, Seunghyuck Park, Jinah Park_ | N/A | ❌ | [BraTS24_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MissingMRIAlgorithms.BraTS24_1) |
| 2024 | 2nd | _Haowen Pang_ | N/A | ❌ | [BraTS24_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MissingMRIAlgorithms.BraTS24_2) |
| 2024 | 3rd | _Minjoo Lim, Bogyeong Kang_ | N/A | ❌ | [BraTS24_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MissingMRIAlgorithms.BraTS24_3) |
</details>
---
> [!TIP]
> For a full notebook example with more details please check here:
> [](https://nbviewer.org/github/BrainLesion/tutorials/blob/main/BraTS/tutorial.ipynb)
## Citation
If you use BraTS in your research, please cite it to support the development!
```
TODO: citation will be added asap
```
## Contributing
We welcome all kinds of contributions from the community!
### Reporting Bugs, Feature Requests and Questions
Please open a new issue [here](https://github.com/BrainLesion/BraTS/issues).
### Code contributions
Nice to have you on board! Please have a look at our [CONTRIBUTING.md](CONTRIBUTING.md) file.
Raw data
{
"_id": null,
"home_page": "https://github.com/BrainLesion/BraTS",
"name": "brats",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "brain tumor, glioma, BraTS, brain lesion, segmentation, synthesis, inpainting",
"author": "Marcel Rosier",
"author_email": "marcel.rosier@tum.de",
"download_url": null,
"platform": null,
"description": "# BraTS\n\n[](https://pypi.org/project/brats/)\n[](https://pypi.python.org/pypi/brats/)\n[](http://brats.readthedocs.io/?badge=latest)\n[](https://github.com/BrainLesion/brats/actions/workflows/tests.yml)\n[](https://codecov.io/gh/BrainLesion/BraTS)\n[](https://opensource.org/licenses/Apache-2.0)\n\nProviding the top performing algorithms from the Brain Tumor Segmentation (BraTS) challenges, through an easy to use Python API powered by docker.\n\n## Features\n\n- Access to top-performing algorithms from recent BraTS challenges\n- Easy-to-use minimal API\n- Extensive documentation and examples\n\n## Installation\n\nWith a Python 3.8+ environment, you can install `brats` directly from [PyPI](https://pypi.org/project/brats/):\n\n```bash\npip install brats\n```\n\n> [!IMPORTANT] \n> To run `brats` you require a Docker installation. <br>\n> Many algorithms also require GPU support (NVIDIA Docker). <br>\n> In case you do not have access to a Cuda-capable GPU, the overview tables in the [Available Algorithms and Usage](#available-algorithms-and-usage) section indicate which algorithms are CPU compatible.\n\n\n\n\n### Docker and NVIDIA Container Toolkit Setup\n\n- **Docker**: Installation instructions on the official [website](https://docs.docker.com/get-docker/)\n- **NVIDIA Container Toolkit**: Refer to the [NVIDIA install guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) and the official [GitHub page](https://github.com/NVIDIA/nvidia-container-toolkit)\n\n\n## Available Algorithms and Usage\n\n### Segmentation\n<details>\n\n<summary> <strong> Adult Glioma Segmentation (Pre Treatment) </strong> </summary>\n<br>\n\n\n```python\nfrom brats import AdultGliomaPreTreatmentSegmenter\nfrom brats.constants import AdultGliomaPreTreatmentAlgorithms\n\nsegmenter = AdultGliomaPreTreatmentSegmenter(algorithm=AdultGliomaPreTreatmentAlgorithms.BraTS23_1, cuda_devices=\"0\")\n# these parameters are optional, by default the winning algorithm of 2023 will be used on cuda:0\nsegmenter.infer_single(\n t1c=\"path/to/t1c.nii.gz\",\n t1n=\"path/to/t1n.nii.gz\",\n t2f=\"path/to/t2f.nii.gz\",\n t2w=\"path/to/t2w.nii.gz\",\n output_file=\"segmentation.nii.gz\",\n)\n```\n\n**Class:** `brats.AdultGliomaPreTreatmentSegmenter` ([Docs](https://brats.readthedocs.io/en/latest/core/segmentation_algorithms.html#brats.core.segmentation_algorithms.AdultGliomaPreTreatmentSegmenter))\n\n| Year | Rank | Author | Paper | CPU Support | Key Enum |\n| ---- | ---- | --------------------------------- | ------------------------------------------ | ----------- | ------------------------------------------------------------------------------------------------------------------------------------ |\n| 2023 | 1st | _Andr\u00e9 Ferreira, et al._ | [Link](https://arxiv.org/abs/2402.17317v1) | ❌ | [BraTS23_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.**AdultGliomaPreTreatmentAlgorithms**.BraTS23_1) |\n| 2023 | 2nd | _Andriy Myronenko, et al._ | N/A | ❌ | [BraTS23_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.**AdultGliomaPreTreatmentAlgorithms**.BraTS23_2) |\n| 2023 | 3rd | _Fadillah Adamsyah Maani, et al._ | N/A | ❌ | [BraTS23_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.**AdultGliomaPreTreatmentAlgorithms**.BraTS23_3) |\n\n</details>\n\n<details>\n<summary> <strong> Adult Glioma Segmentation Post Treatment </strong> </summary>\n<br>\n\n\n```python\nfrom brats import AdultGliomaPostTreatmentSegmenter\nfrom brats.constants import AdultGliomaPostTreatmentAlgorithms\n\nsegmenter = AdultGliomaPostTreatmentSegmenter(algorithm=AdultGliomaPostTreatmentAlgorithms.BraTS23_1, cuda_devices=\"0\")\n# these parameters are optional, by default the winning algorithm of 2024 will be used on cuda:0\nsegmenter.infer_single(\n t1c=\"path/to/t1c.nii.gz\",\n t1n=\"path/to/t1n.nii.gz\",\n t2f=\"path/to/t2f.nii.gz\",\n t2w=\"path/to/t2w.nii.gz\",\n output_file=\"segmentation.nii.gz\",\n)\n```\n\n**Class:** `brats.AdultGliomaPostTreatmentSegmenter` ([Docs](https://brats.readthedocs.io/en/latest/core/segmentation_algorithms.html#brats.core.segmentation_algorithms.AdultGliomaPostTreatmentSegmenter))\n\n| Year | Rank | Author | Paper | CPU Support | Key Enum |\n| ---- | ---- | ------------------------ | ----- | ----------- | --------------------------------------------------------------------------------------------------------------------------------- |\n| 2024 | 1st | _Andr\u00e9 Ferreira, et al._ | N/A | ❌ | [BraTS24_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.AdultGliomaPostTreatmentAlgorithms.BraTS24_1) |\n| 2024 | 2nd | _Team kimbab_ | N/A | ❌ | [BraTS24_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.AdultGliomaPostTreatmentAlgorithms.BraTS24_2) |\n| 2024 | 3rd | _Adrian Celaya_ | N/A | ✅ | [BraTS24_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.AdultGliomaPostTreatmentAlgorithms.BraTS24_3) |\n\n</details>\n\n<details>\n<summary> <strong> BraTS-Africa Segmentation </strong> </summary>\n<br>\n\n```python\nfrom brats import AfricaSegmenter\nfrom brats.constants import AfricaAlgorithms\n\nsegmenter = AfricaSegmenter(algorithm=AfricaAlgorithms.BraTS23_1, cuda_devices=\"0\")\n# these parameters are optional, by default the winning algorithm will be used on cuda:0\nsegmenter.infer_single(\n t1c=\"path/to/t1c.nii.gz\",\n t1n=\"path/to/t1n.nii.gz\",\n t2f=\"path/to/t2f.nii.gz\",\n t2w=\"path/to/t2w.nii.gz\",\n output_file=\"segmentation.nii.gz\",\n)\n```\n\n**Class:** `brats.AfricaSegmenter` ([Docs](https://brats.readthedocs.io/en/latest/core/segmentation_algorithms.html#brats.core.segmentation_algorithms.AfricaSegmenter))\n\n| Year | Rank | Author | Paper | CPU Support | Key Enum |\n| ---- | ---- | -------------------------- | ----- | ----------- | --------------------------------------------------------------------------------------------------------------- |\n| 2024 | 1st | _Zhifan Jiang et al._ | N/A | ❌ | [BraTS24_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.AfricaAlgorithms.BraTS24_1) |\n| 2024 | 2nd | _Long Bai, et al._ | N/A | ✅ | [BraTS24_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.AfricaAlgorithms.BraTS24_2) |\n| 2024 | 1st | _Sarim Hashmi, et al._ | N/A | ❌ | [BraTS24_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.AfricaAlgorithms.BraTS24_3) |\n| 2023 | 1st | _Andriy Myronenko, et al._ | TODO | ❌ | [BraTS23_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.AfricaAlgorithms.BraTS23_1) |\n| 2023 | 2nd | _Alyssa R Amod, et al._ | N/A | ❌ | [BraTS23_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.AfricaAlgorithms.BraTS23_2) |\n| 2023 | 3rd | _Ziyan Huang, et al._ | N/A | ✅ | [BraTS23_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.AfricaAlgorithms.BraTS23_3) |\n\n</details>\n\n<details>\n<summary> <strong> Meningioma Segmentation </strong> </summary>\n<br>\n\n**Note** \nUnlike other segmentation challenges the expected inputs for the Meningioma Segmentation Algorithms differ between years. \n- _2023_: All 4 modalities are used (t1c, t1n, t2f, t2w)\n- _2024_: Only t1c is used \n\nTherefore the usage differs slightly, depending on which algorithm is used. To understand why, please refer to the [2024 challenge manuscript](https://arxiv.org/abs/2405.18383).\n\n```python\nfrom brats import MeningiomaSegmenter\nfrom brats.constants import MeningiomaAlgorithms\n\n### Example for 2023 algorithms\nsegmenter = MeningiomaSegmenter(algorithm=MeningiomaAlgorithms.BraTS23_1, cuda_devices=\"0\")\n# these parameters are optional, by default the winning algorithm will be used on cuda:0\nsegmenter.infer_single(\n t1c=\"path/to/t1c.nii.gz\",\n t1n=\"path/to/t1n.nii.gz\",\n t2f=\"path/to/t2f.nii.gz\",\n t2w=\"path/to/t2w.nii.gz\",\n output_file=\"segmentation_23.nii.gz\",\n)\n\n### Example for 2024 algorithms\nsegmenter = MeningiomaSegmenter(algorithm=MeningiomaAlgorithms.BraTS24_1, cuda_devices=\"0\")\nsegmenter.infer_single(\n t1c=\"path/to/t1c.nii.gz\",\n output_file=\"segmentation_24.nii.gz\",\n)\n```\n\n**Class:** `brats.MeningiomaSegmenter` ([Docs](https://brats.readthedocs.io/en/latest/core/segmentation_algorithms.html#brats.core.segmentation_algorithms.MeningiomaSegmenter))\n\n| Year | Rank | Author | Paper | CPU Support | Key Enum |\n| ---- | ---- | -------------------------- | ----- | ----------- | ------------------------------------------------------------------------------------------------------------------- |\n| 2024 | 1st | _Valeria Abramova_ | N/A | ❌ | [BraTS24_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MeningiomaAlgorithms.BraTS24_1) |\n| 2024 | 2nd | _Mehdi Astaraki_ | N/A | ❌ | [BraTS24_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MeningiomaAlgorithms.BraTS24_2) |\n| 2024 | 3rd | _Andre Ferreira, et al._ | N/A | ✅ | [BraTS24_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MeningiomaAlgorithms.BraTS24_3) |\n| 2023 | 1st | _Andriy Myronenko, et al._ | N/A | ❌ | [BraTS23_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MeningiomaAlgorithms.BraTS23_1) |\n| 2023 | 2nd | _Ziyan Huang, et al._ | N/A | ✅ | [BraTS23_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MeningiomaAlgorithms.BraTS23_2) |\n| 2023 | 3rd | _Zhifan Jiang et al._ | N/A | ❌ | [BraTS23_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MeningiomaAlgorithms.BraTS23_3) |\n\n</details>\n\n<details>\n<summary> <strong> Brain Metastases Segmentation </strong> </summary>\n<br>\n\n```python\nfrom brats import MetastasesSegmenter\nfrom brats.constants import MetastasesAlgorithms\n\nsegmenter = MetastasesSegmenter(algorithm=MetastasesAlgorithms.BraTS23_1, cuda_devices=\"0\")\n# these parameters are optional, by default the winning algorithm will be used on cuda:0\nsegmenter.infer_single(\n t1c=\"path/to/t1c.nii.gz\",\n t1n=\"path/to/t1n.nii.gz\",\n t2f=\"path/to/t2f.nii.gz\",\n t2w=\"path/to/t2w.nii.gz\",\n output_file=\"segmentation.nii.gz\",\n)\n```\n\n**Class:** `brats.MetastasesSegmenter` ([Docs](https://brats.readthedocs.io/en/latest/core/segmentation_algorithms.html#brats.core.segmentation_algorithms.MetastasesSegmenter))\n\n| Year | Rank | Author | Paper | CPU Support | Key Enum |\n| ---- | ---- | -------------------------- | ----- | ----------- | ------------------------------------------------------------------------------------------------------------------- |\n| 2023 | 1st | _Andriy Myronenko, et al._ | N/A | ❌ | [BraTS23_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MetastasesAlgorithms.BraTS23_1) |\n| 2023 | 2nd | _Siwei Yang, et al._ | N/A | ❌ | [BraTS23_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MetastasesAlgorithms.BraTS23_2) |\n| 2023 | 3rd | _Ziyan Huang, et al._ | N/A | ✅ | [BraTS23_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MetastasesAlgorithms.BraTS23_3) |\n\n</details>\n\n<details>\n<summary> <strong> Pediatric Segmentation </strong> </summary>\n<br>\n\n```python\nfrom brats import PediatricSegmenter\nfrom brats.constants import PediatricAlgorithms\n\nsegmenter = PediatricSegmenter(algorithm=PediatricAlgorithms.BraTS23_1, cuda_devices=\"0\")\n# these parameters are optional, by default the winning algorithm will be used on cuda:0\nsegmenter.infer_single(\n t1c=\"path/to/t1c.nii.gz\",\n t1n=\"path/to/t1n.nii.gz\",\n t2f=\"path/to/t2f.nii.gz\",\n t2w=\"path/to/t2w.nii.gz\",\n output_file=\"segmentation.nii.gz\",\n)\n```\n\n**Class:** `brats.PediatricSegmenter` ([Docs](https://brats.readthedocs.io/en/latest/core/segmentation_algorithms.html#brats.core.segmentation_algorithms.PediatricSegmenter))\n\n| Year | Rank | Author | Paper | CPU Support | Key Enum |\n| ---- | ---- | -------------------------- | ----- | ----------- | ------------------------------------------------------------------------------------------------------------------ |\n| 2024 | 1st | _Tim Mulvany, et al._ | N/A | ❌ | [BraTS24_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.PediatricAlgorithms.BraTS24_1) |\n| 2024 | 2nd | _Mehdi Astaraki_ | N/A | ❌ | [BraTS24_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.PediatricAlgorithms.BraTS24_2) |\n| 2024 | 3rd | _Sarim Hashmi, et al._ | N/A | ❌ | [BraTS24_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.PediatricAlgorithms.BraTS24_3) |\n| 2023 | 1st | _Zhifan Jiang et al._ | N/A | ❌ | [BraTS23_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.PediatricAlgorithms.BraTS23_1) |\n| 2023 | 2nd | _Andriy Myronenko, et al._ | N/A | ❌ | [BraTS23_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.PediatricAlgorithms.BraTS23_2) |\n| 2023 | 3rd | _Yubo Zhou_ | N/A | ❌ | [BraTS23_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.PediatricAlgorithms.BraTS23_3) |\n\n</details>\n\n### Inpainting\n\n<details>\n<summary> <strong> Inpainting </strong> </summary>\n<br>\n\n```python\nfrom brats import Inpainter\nfrom brats.constants import InpaintingAlgorithms\n\ninpainter = Inpainter(algorithm=InpaintingAlgorithms.BraTS24_1, cuda_devices=\"0\")\ninpainter.infer_single(\n t1n=\"path/to/voided_t1n.nii.gz\",\n mask=\"path/to/mask.nii.gz\",\n output_file=\"inpainting.nii.gz\",\n)\n```\n\n**Class:** `brats.Inpainter` ([Docs](https://brats.readthedocs.io/en/latest/core/inpainting_algorithms.html#brats.core.inpainting_algorithms.Inpainter))\n\n| Year | Rank | Author | Paper | CPU Support | Key Enum |\n| ---- | ---- | ---------------------------------- | ----- | ----------- | ------------------------------------------------------------------------------------------------------------------- |\n| 2024 | 1st | _Ke Chen, Juexin Zhang, Ying Weng_ | N/A | ✅ | [BraTS24_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.InpaintingAlgorithms.BraTS24_1) |\n| 2024 | 2nd | _Andr\u00e9 Ferreira, et al._ | N/A | ❌ | [BraTS24_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.InpaintingAlgorithms.BraTS24_2) |\n| 2024 | 3rd | _Team SMINT_ | N/A | ❌ | [BraTS24_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.InpaintingAlgorithms.BraTS24_3) |\n| 2023 | 1st | _Juexin Zhang, et al._ | N/A | ✅ | [BraTS23_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.InpaintingAlgorithms.BraTS23_1) |\n| 2023 | 2nd | _Alicia Durrer, et al._ | N/A | ❌ | [BraTS23_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.InpaintingAlgorithms.BraTS23_2) |\n| 2023 | 3rd | _Jiayu Huo, et al._ | N/A | ✅ | [BraTS23_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.InpaintingAlgorithms.BraTS23_3) |\n\n</details>\n\n### Missing MRI\n\n<details>\n<summary> <strong> Missing MRI </strong> </summary>\n<br>\n\n```python\nfrom brats import MissingMRI\nfrom brats.constants import MissingMRIAlgorithms\n\nmissing_mri = MissingMRI(algorithm=MissingMRIAlgorithms.BraTS24_1, cuda_devices=\"0\")\n# Example to synthesize t2f modality (whichever modality is missing will be inferred)\nmissing_mri.infer_single(\n t1c=\"path/to/t1c.nii.gz\",\n t1n=\"path/to/t1n.nii.gz\",\n # t2f=\"path/to/t2f.nii.gz\",\n t2w=\"path/to/t2w.nii.gz\",\n output_file=\"inferred_t2f.nii.gz\",\n)\n```\n\n**Class:** `brats.MissingMRI` ([Docs](https://brats.readthedocs.io/en/latest/core/missing_mri_algorithms.html#brats.core.missing_mri_algorithms.MissingMRI))\n\n| Year | Rank | Author | Paper | CPU Support | Key Enum |\n| ---- | ---- | ----------------------------------------- | ----- | ----------- | ------------------------------------------------------------------------------------------------------------------- |\n| 2024 | 1st | _Jihoon Cho, Seunghyuck Park, Jinah Park_ | N/A | ❌ | [BraTS24_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MissingMRIAlgorithms.BraTS24_1) |\n| 2024 | 2nd | _Haowen Pang_ | N/A | ❌ | [BraTS24_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MissingMRIAlgorithms.BraTS24_2) |\n| 2024 | 3rd | _Minjoo Lim, Bogyeong Kang_ | N/A | ❌ | [BraTS24_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.constants.MissingMRIAlgorithms.BraTS24_3) |\n\n</details>\n\n--- \n\n> [!TIP]\n> For a full notebook example with more details please check here: \n> [](https://nbviewer.org/github/BrainLesion/tutorials/blob/main/BraTS/tutorial.ipynb)\n\n## Citation\n\nIf you use BraTS in your research, please cite it to support the development!\n\n```\nTODO: citation will be added asap\n```\n\n## Contributing\n\nWe welcome all kinds of contributions from the community!\n\n### Reporting Bugs, Feature Requests and Questions\n\nPlease open a new issue [here](https://github.com/BrainLesion/BraTS/issues).\n\n### Code contributions\n\nNice to have you on board! Please have a look at our [CONTRIBUTING.md](CONTRIBUTING.md) file.\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "BraTS algorithms",
"version": "0.0.14",
"project_urls": {
"Documentation": "https://brats.readthedocs.io/en/latest/",
"Homepage": "https://github.com/BrainLesion/BraTS",
"Repository": "https://github.com/BrainLesion/BraTS"
},
"split_keywords": [
"brain tumor",
" glioma",
" brats",
" brain lesion",
" segmentation",
" synthesis",
" inpainting"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e9079cbac576eb27f84c2a3246a87e54d23df97209adac8191e995643ac083ad",
"md5": "fe1c2caf31301b499512bef63f53152d",
"sha256": "3ed9a20ab97cd897f116826792c6216bb393031e0ed9a5fd51a4808208e47513"
},
"downloads": -1,
"filename": "brats-0.0.14-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fe1c2caf31301b499512bef63f53152d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 40568,
"upload_time": "2025-01-08T15:01:55",
"upload_time_iso_8601": "2025-01-08T15:01:55.409328Z",
"url": "https://files.pythonhosted.org/packages/e9/07/9cbac576eb27f84c2a3246a87e54d23df97209adac8191e995643ac083ad/brats-0.0.14-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-08 15:01:55",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "BrainLesion",
"github_project": "BraTS",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "brats"
}