From 6e2feda097d5eacbb761291c5f0f046f72f8963c Mon Sep 17 00:00:00 2001 From: Marcel Rosier Date: Wed, 27 Nov 2024 17:51:59 +0100 Subject: [PATCH 1/8] Add 24 Inpainting algorithms Add metadata Add param file for 3rd algorithm Add algorithm constants --- brats/data/meta/inpainting.yml | 53 +++++++++++++++++++ .../parameters/brats24_inpainting_smint.yml | 37 +++++++++++++ brats/utils/constants.py | 12 +++-- 3 files changed, 99 insertions(+), 3 deletions(-) create mode 100644 brats/data/parameters/brats24_inpainting_smint.yml diff --git a/brats/data/meta/inpainting.yml b/brats/data/meta/inpainting.yml index 6ea3722..85abfe0 100644 --- a/brats/data/meta/inpainting.yml +++ b/brats/data/meta/inpainting.yml @@ -1,5 +1,58 @@ algorithms: + ######## 2024 Algorithms ######## + + BraTS24_1: + meta: + authors: Ke Chen, Juexin Zhang, Ying Weng + paper: N/A + challenge: BraTS24 Inpainting + rank: 1st + year: 2024 + run_args: + docker_image: brainles/brats24_inpainting_ying_weng:latest + input_name_schema: "BraTS-GLI-{id:05d}-000" + requires_root: true + parameters_file: true + cpu_compatible: true + weights: + record_id: "14230865" + param_name: "checkpoint_path" + + BraTS24_2: + meta: + authors: André Ferreira, et al. + paper: N/A + challenge: BraTS24 Inpainting + rank: 2nd + year: 2024 + run_args: + docker_image: brainles/brats24_inpainting_faking_it:latest + input_name_schema: "BraTS-GLI-{id:05d}-000" + requires_root: true + parameters_file: false + shm_size: "4gb" + + BraTS24_3: + meta: + authors: Team SMINT + paper: N/A + challenge: BraTS24 Inpainting + rank: 3rd + year: 2024 + run_args: + docker_image: brainles/brats24_inpainting_smint:latest + input_name_schema: "BraTS-GLI-{id:05d}-000" + requires_root: true + parameters_file: true + cpu_compatible: true + weights: + record_id: "14231079" + param_name: "weights" + checkpoint_path: "savedmodel395000.pt" + + ######## 2023 Algorithms ######## + BraTS23_1: meta: authors: Juexin Zhang, et al. diff --git a/brats/data/parameters/brats24_inpainting_smint.yml b/brats/data/parameters/brats24_inpainting_smint.yml new file mode 100644 index 0000000..a567d3c --- /dev/null +++ b/brats/data/parameters/brats24_inpainting_smint.yml @@ -0,0 +1,37 @@ +attention_resolutions: '16' +batch_size: 1 +channel_mult: '' +class_cond: False +clip_denoised: True +diffusion_steps: 1000 +dropout: 0.0 +ema_rate: '0.9999' +fp16_scale_growth: 0.001 +image_size: 256 +learn_sigma: True +log_interval: 1000 +lr: 0.0001 +lr_anneal_steps: 0 +microbatch: -1 +noise_schedule: 'linear' +num_channels: 128 +num_head_channels: -1 +num_heads: 1 +num_heads_upsample: -1 +num_res_blocks: 2 +predict_xstart: False +resblock_updown: False +rescale_learned_sigmas: False +rescale_timesteps: False +resume_checkpoint: '' +save_interval: 5000 +schedule_sampler: 'uniform' +subbatch: 16 +timestep_respacing: '' +use_checkpoint: False +use_ddim: False +use_fp16: False +use_kl: False +use_new_attention_order: False +use_scale_shift_norm: False +weight_decay: 0.0 \ No newline at end of file diff --git a/brats/utils/constants.py b/brats/utils/constants.py index 360ccd0..2a7d02a 100644 --- a/brats/utils/constants.py +++ b/brats/utils/constants.py @@ -81,12 +81,18 @@ class MetastasesAlgorithms(Algorithms): class InpaintingAlgorithms(Algorithms): """Constants for the available BraTS Inpainting algorithms.""" + BraTS24_1 = "BraTS24_1" + """ BraTS24 Inpainting 1st place """ + BraTS24_2 = "BraTS24_2" + """ BraTS24 Inpainting 2nd place """ + BraTS24_3 = "BraTS24_3" + """ BraTS24 Inpainting 3rd place """ BraTS23_1 = "BraTS23_1" - """BraTS23 Inpainting 1st place (GPU only)""" + """ BraTS23 Inpainting 1st place """ BraTS23_2 = "BraTS23_2" - """BraTS23 Inpainting 2nd place (GPU only) (Very Slow)""" + """ BraTS23 Inpainting 2nd place (Very Slow) """ BraTS23_3 = "BraTS23_3" - """BraTS23 Inpainting 3rd place (GPU only)""" + """ BraTS23 Inpainting 3rd place """ # DIRECTORIES From 97bcdffecc805001e67b3199eed16d39478f6d7e Mon Sep 17 00:00:00 2001 From: Marcel Rosier Date: Wed, 27 Nov 2024 21:01:21 +0100 Subject: [PATCH 2/8] Add error replacing for docker output decoding --- brats/core/docker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brats/core/docker.py b/brats/core/docker.py index 41456b7..90e7615 100644 --- a/brats/core/docker.py +++ b/brats/core/docker.py @@ -231,7 +231,7 @@ def _observe_docker_output(container: docker.models.containers.Container) -> str # Wait for the container to finish exit_code = container.wait() container_output = "\n\r".join( - [line.decode("utf-8") for line in container_output] + [line.decode("utf-8", errors="replace") for line in container_output] ) # Check if the container exited with an error if exit_code["StatusCode"] != 0: From 19e251138e1a35de84a9211f12d451f0b2bfd4d5 Mon Sep 17 00:00:00 2001 From: Marcel Rosier Date: Thu, 28 Nov 2024 15:22:23 +0100 Subject: [PATCH 3/8] Correct root requirements and cpu compatibility --- brats/data/meta/inpainting.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/brats/data/meta/inpainting.yml b/brats/data/meta/inpainting.yml index 85abfe0..cd61544 100644 --- a/brats/data/meta/inpainting.yml +++ b/brats/data/meta/inpainting.yml @@ -12,7 +12,7 @@ algorithms: run_args: docker_image: brainles/brats24_inpainting_ying_weng:latest input_name_schema: "BraTS-GLI-{id:05d}-000" - requires_root: true + requires_root: false parameters_file: true cpu_compatible: true weights: @@ -29,7 +29,7 @@ algorithms: run_args: docker_image: brainles/brats24_inpainting_faking_it:latest input_name_schema: "BraTS-GLI-{id:05d}-000" - requires_root: true + requires_root: false parameters_file: false shm_size: "4gb" @@ -43,9 +43,8 @@ algorithms: run_args: docker_image: brainles/brats24_inpainting_smint:latest input_name_schema: "BraTS-GLI-{id:05d}-000" - requires_root: true + requires_root: false parameters_file: true - cpu_compatible: true weights: record_id: "14231079" param_name: "weights" @@ -63,7 +62,7 @@ algorithms: run_args: docker_image: brainles/brats23_inpainting_ying_weng:latest input_name_schema: "BraTS-GLI-{id:05d}-000" - requires_root: true + requires_root: false parameters_file: true cpu_compatible: true weights: From e1074897bbb32a9a938d41501511bbb27ea0b8f1 Mon Sep 17 00:00:00 2001 From: Marcel Rosier Date: Thu, 28 Nov 2024 15:51:18 +0100 Subject: [PATCH 4/8] Move constants file and update imports --- brats/{utils => }/constants.py | 2 +- brats/core/brats_algorithm.py | 2 +- brats/core/docker.py | 2 +- brats/core/inpainting_algorithms.py | 2 +- brats/core/segmentation_algorithms.py | 2 +- brats/utils/zenodo.py | 2 +- tests/core/test_brats_algorithm.py | 2 +- tests/core/test_docker.py | 2 +- tests/core/test_inpainting_algorithms.py | 2 +- tests/core/test_segmentation_algorithms.py | 2 +- tests/utils/test_algorithm_config.py | 2 +- tests/utils/test_zenodo.py | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) rename brats/{utils => }/constants.py (98%) diff --git a/brats/utils/constants.py b/brats/constants.py similarity index 98% rename from brats/utils/constants.py rename to brats/constants.py index 2a7d02a..b282a3a 100644 --- a/brats/utils/constants.py +++ b/brats/constants.py @@ -96,7 +96,7 @@ class InpaintingAlgorithms(Algorithms): # DIRECTORIES -DATA_DIR = Path(__file__).parent.parent / "data" +DATA_DIR = Path(__file__).parent / "data" META_DIR = DATA_DIR / "meta" PARAMETERS_DIR = DATA_DIR / "parameters" ADDITIONAL_FILES_FOLDER = DATA_DIR / "additional_files" diff --git a/brats/core/brats_algorithm.py b/brats/core/brats_algorithm.py index f2571b2..427ff99 100644 --- a/brats/core/brats_algorithm.py +++ b/brats/core/brats_algorithm.py @@ -10,7 +10,7 @@ from brats.core.docker import run_container from brats.utils.algorithm_config import load_algorithms -from brats.utils.constants import OUTPUT_NAME_SCHEMA, Algorithms, Task +from brats.constants import OUTPUT_NAME_SCHEMA, Algorithms, Task from brats.utils.data_handling import InferenceSetup # Remove the default logger and add one with level INFO diff --git a/brats/core/docker.py b/brats/core/docker.py index 90e7615..590fad3 100644 --- a/brats/core/docker.py +++ b/brats/core/docker.py @@ -15,7 +15,7 @@ from rich.progress import Progress from brats.utils.algorithm_config import AlgorithmData -from brats.utils.constants import DUMMY_PARAMETERS, PARAMETERS_DIR +from brats.constants import DUMMY_PARAMETERS, PARAMETERS_DIR from brats.utils.exceptions import ( AlgorithmNotCPUCompatibleException, BraTSContainerException, diff --git a/brats/core/inpainting_algorithms.py b/brats/core/inpainting_algorithms.py index 741335e..665a0e5 100644 --- a/brats/core/inpainting_algorithms.py +++ b/brats/core/inpainting_algorithms.py @@ -8,7 +8,7 @@ from loguru import logger from brats.core.brats_algorithm import BraTSAlgorithm -from brats.utils.constants import INPAINTING_ALGORITHMS, InpaintingAlgorithms, Task +from brats.constants import INPAINTING_ALGORITHMS, InpaintingAlgorithms, Task from brats.utils.data_handling import input_sanity_check diff --git a/brats/core/segmentation_algorithms.py b/brats/core/segmentation_algorithms.py index 4913c5f..e514299 100644 --- a/brats/core/segmentation_algorithms.py +++ b/brats/core/segmentation_algorithms.py @@ -8,7 +8,7 @@ from loguru import logger from brats.core.brats_algorithm import BraTSAlgorithm -from brats.utils.constants import ( +from brats.constants import ( ADULT_GLIOMA_SEGMENTATION_ALGORITHMS, AFRICA_SEGMENTATION_ALGORITHMS, MENINGIOMA_SEGMENTATION_ALGORITHMS, diff --git a/brats/utils/zenodo.py b/brats/utils/zenodo.py index f99c817..8fa5a90 100644 --- a/brats/utils/zenodo.py +++ b/brats/utils/zenodo.py @@ -11,7 +11,7 @@ from loguru import logger from rich.progress import Progress, SpinnerColumn, TextColumn -from brats.utils.constants import ADDITIONAL_FILES_FOLDER, ZENODO_RECORD_BASE_URL +from brats.constants import ADDITIONAL_FILES_FOLDER, ZENODO_RECORD_BASE_URL def get_dummy_path() -> Path: diff --git a/tests/core/test_brats_algorithm.py b/tests/core/test_brats_algorithm.py index be6b4b0..41f7305 100644 --- a/tests/core/test_brats_algorithm.py +++ b/tests/core/test_brats_algorithm.py @@ -5,7 +5,7 @@ import shutil from brats import AdultGliomaSegmenter -from brats.utils.constants import OUTPUT_NAME_SCHEMA +from brats.constants import OUTPUT_NAME_SCHEMA class TestBraTSAlgorithm(unittest.TestCase): diff --git a/tests/core/test_docker.py b/tests/core/test_docker.py index bbb88d9..faaf1bd 100644 --- a/tests/core/test_docker.py +++ b/tests/core/test_docker.py @@ -23,7 +23,7 @@ run_container, ) from brats.utils.algorithm_config import AlgorithmData -from brats.utils.constants import PARAMETERS_DIR +from brats.constants import PARAMETERS_DIR from brats.utils.exceptions import ( AlgorithmNotCPUCompatibleException, BraTSContainerException, diff --git a/tests/core/test_inpainting_algorithms.py b/tests/core/test_inpainting_algorithms.py index 1e15dae..7b7a2fe 100644 --- a/tests/core/test_inpainting_algorithms.py +++ b/tests/core/test_inpainting_algorithms.py @@ -7,7 +7,7 @@ from loguru import logger from brats import Inpainter -from brats.utils.constants import InpaintingAlgorithms +from brats.constants import InpaintingAlgorithms class TestInpaintingAlgorithms(unittest.TestCase): diff --git a/tests/core/test_segmentation_algorithms.py b/tests/core/test_segmentation_algorithms.py index 0c2d85d..e27f2ec 100644 --- a/tests/core/test_segmentation_algorithms.py +++ b/tests/core/test_segmentation_algorithms.py @@ -13,7 +13,7 @@ MetastasesSegmenter, PediatricSegmenter, ) -from brats.utils.constants import ( +from brats.constants import ( AdultGliomaAlgorithms, AfricaAlgorithms, MeningiomaAlgorithms, diff --git a/tests/utils/test_algorithm_config.py b/tests/utils/test_algorithm_config.py index 2a116ba..1f15eb4 100644 --- a/tests/utils/test_algorithm_config.py +++ b/tests/utils/test_algorithm_config.py @@ -2,7 +2,7 @@ from pathlib import Path from brats.utils.algorithm_config import load_algorithms -from brats.utils.constants import META_DIR +from brats.constants import META_DIR class TestAlgorithmConfig(unittest.TestCase): diff --git a/tests/utils/test_zenodo.py b/tests/utils/test_zenodo.py index 438023e..30fa613 100644 --- a/tests/utils/test_zenodo.py +++ b/tests/utils/test_zenodo.py @@ -6,7 +6,7 @@ import requests # Import the module that contains the functions -from brats.utils.constants import ADDITIONAL_FILES_FOLDER +from brats.constants import ADDITIONAL_FILES_FOLDER from brats.utils.zenodo import ( _extract_archive, check_additional_files_path, From b0cea3e792d830966c12abd54119556b644d811d Mon Sep 17 00:00:00 2001 From: Marcel Rosier Date: Fri, 29 Nov 2024 09:53:36 +0100 Subject: [PATCH 5/8] Readme update Add code example per algorithm Add nb viewer badge Add Inpainting 2024 algos to table --- README.md | 132 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 104 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index a201368..6126fc5 100644 --- a/README.md +++ b/README.md @@ -36,13 +36,19 @@ pip install brats - **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) -## Use Cases and Tutorials -A minimal example to create a segmentation could look like this: +## Available Algorithms and Usage + +### Segmentation +
+ + Adult Glioma Segmentation +
+ ```python from brats import AdultGliomaSegmenter -from brats.utils.constants import AdultGliomaAlgorithms +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 @@ -55,19 +61,10 @@ segmenter.infer_single( ) ``` -For more examples and details please refer to our extensive Notebook tutorials here [NBViewer](https://nbviewer.org/github/BrainLesion/tutorials/blob/main/BraTS/tutorial.ipynb) ([GitHub](https://github.com/BrainLesion/tutorials/blob/main/BraTS/tutorial.ipynb)). For the best experience open the notebook in Colab. - -## Algorithms - -
- - Adult Glioma Segmentation -
- **Class:** `brats.AdultGliomaSegmenter` ([Docs](https://brats.readthedocs.io/en/latest/core/segmentation_algorithms.html#brats.core.segmentation_algorithms.AdultGliomaSegmenter)) -| Year | Rank | Author | Paper | CPU Support | Key Enum | -| ---- | ---- | --------------------------------- | ------------------------------------------ | ----------- | ------------------------------------------------------------------------------------------------------------------------ | +| 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.utils.constants.AdultGliomaAlgorithms.BraTS23_1) | | 2023 | 2nd | _Andriy Myronenko, et al._ | N/A | ❌ | [BraTS23_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.utils.constants.AdultGliomaAlgorithms.BraTS23_2) | | 2023 | 3rd | _Fadillah Adamsyah Maani, et al._ | N/A | ❌ | [BraTS23_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.utils.constants.AdultGliomaAlgorithms.BraTS23_3) | @@ -78,10 +75,25 @@ For more examples and details please refer to our extensive Notebook tutorials h BraTS-Africa Segmentation
+```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 | -| ---- | ---- | -------------------------- | ----- | ----------- | ------------------------------------------------------------------------------------------------------------------- | +| Year | Rank | Author | Paper | CPU Support | Key Enum | +| ---- | ---- | -------------------------- | ----- | ----------- | --------------------------------------------------------------------------------------------------------------------- | | 2023 | 1st | _Andriy Myronenko, et al._ | TODO | ❌ | [BraTS23_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.utils.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.utils.constants.AfricaAlgorithms.BraTS23_2) | | 2023 | 3rd | _Ziyan Huang, et al._ | N/A | ✅ | [BraTS23_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.utils.constants.AfricaAlgorithms.BraTS23_3) | @@ -92,10 +104,25 @@ For more examples and details please refer to our extensive Notebook tutorials h Meningioma Segmentation
+```python +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](https://brats.readthedocs.io/en/latest/core/segmentation_algorithms.html#brats.core.segmentation_algorithms.MeningiomaSegmenter)) -| Year | Rank | Author | Paper | CPU Support | Key Enum | -| ---- | ---- | -------------------------- | ----- | ----------- | ----------------------------------------------------------------------------------------------------------------------- | +| 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.utils.constants.MeningiomaAlgorithms.BraTS23_1) | | 2023 | 2nd | _Ziyan Huang, et al._ | N/A | ✅ | [BraTS23_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.utils.constants.MeningiomaAlgorithms.BraTS23_2) | | 2023 | 3rd | _Zhifan Jiang et al._ | N/A | ❌ | [BraTS23_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.utils.constants.MeningiomaAlgorithms.BraTS23_3) | @@ -106,10 +133,25 @@ For more examples and details please refer to our extensive Notebook tutorials h Brain Metastases Segmentation
+```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 | -| ---- | ---- | -------------------------- | ----- | ----------- | ----------------------------------------------------------------------------------------------------------------------- | +| 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.utils.constants.MetastasesAlgorithms.BraTS23_1) | | 2023 | 2nd | _Siwei Yang, et al._ | N/A | ❌ | [BraTS23_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.utils.constants.MetastasesAlgorithms.BraTS23_2) | | 2023 | 3rd | _Ziyan Huang, et al._ | N/A | ✅ | [BraTS23_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.utils.constants.MetastasesAlgorithms.BraTS23_3) | @@ -120,32 +162,66 @@ For more examples and details please refer to our extensive Notebook tutorials h Pediatric Segmentation
+```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 | -| ---- | ---- | -------------------------- | ----- | ----------- | ---------------------------------------------------------------------------------------------------------------------- | +| Year | Rank | Author | Paper | CPU Support | Key Enum | +| ---- | ---- | -------------------------- | ----- | ----------- | ------------------------------------------------------------------------------------------------------------------------ | | 2023 | 1st | _Zhifan Jiang et al._ | N/A | ❌ | [BraTS23_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.utils.constants.PediatricAlgorithms.BraTS23_1) | | 2023 | 2nd | _Andriy Myronenko, et al._ | N/A | ❌ | [BraTS23_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.utils.constants.PediatricAlgorithms.BraTS23_2) | | 2023 | 3rd | _Yubo Zhou_ | N/A | ❌ | [BraTS23_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.utils.constants.PediatricAlgorithms.BraTS23_3) |
---- +### Inpainting
Inpainting
+```python +from brats import Inpainter +from brats.constants import InpaintingAlgorithms + +inpainter = Inpainter(algorithm=InpaintingAlgorithms.BraTS24_1) +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 | -| ---- | ---- | ----------------------- | ----- | ----------- | ----------------------------------------------------------------------------------------------------------------------- | -| 2023 | 1st | _Juexin Zhang, et al._ | N/A | ✅ | [BraTS23_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.utils.constants.InpaintingAlgorithms.BraTS23_1) | -| 2023 | 2nd | _Alicia Durrer, et al._ | N/A | ❌ | [BraTS23_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.utils.constants.InpaintingAlgorithms.BraTS23_2) | -| 2023 | 3rd | _Jiayu Huo, et al._ | N/A | ✅ | [BraTS23_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.utils.constants.InpaintingAlgorithms.BraTS23_3) | +| 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.utils.constants.InpaintingAlgorithms.BraTS24_1) | +| 2024 | 2nd | _André Ferreira, et al._ | N/A | ❌ | [BraTS24_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.utils.constants.InpaintingAlgorithms.BraTS24_2) | +| 2024 | 3rd | _Team SMINT_ | N/A | ❌ | [BraTS24_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.utils.constants.InpaintingAlgorithms.BraTS24_3) | +| 2023 | 1st | _Juexin Zhang, et al._ | N/A | ✅ | [BraTS23_1](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.utils.constants.InpaintingAlgorithms.BraTS23_1) | +| 2023 | 2nd | _Alicia Durrer, et al._ | N/A | ❌ | [BraTS23_2](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.utils.constants.InpaintingAlgorithms.BraTS23_2) | +| 2023 | 3rd | _Jiayu Huo, et al._ | N/A | ✅ | [BraTS23_3](https://brats.readthedocs.io/en/latest/utils/utils.html#brats.utils.constants.InpaintingAlgorithms.BraTS23_3) |
+>[!TIP] +>For a full notebook examples with more details please check here: +> [![nbviewer](https://raw.githubusercontent.com/jupyter/design/master/logos/Badges/nbviewer_badge.svg)](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! From f16a39ddb85b0e803acba7d4239d2c05f7f61f77 Mon Sep 17 00:00:00 2001 From: Marcel Rosier Date: Fri, 29 Nov 2024 09:54:51 +0100 Subject: [PATCH 6/8] Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6126fc5..117142a 100644 --- a/README.md +++ b/README.md @@ -219,7 +219,7 @@ inpainter.infer_single(
>[!TIP] ->For a full notebook examples with more details please check here: +>For a full notebook example with more details please check here: > [![nbviewer](https://raw.githubusercontent.com/jupyter/design/master/logos/Badges/nbviewer_badge.svg)](https://nbviewer.org/github/BrainLesion/tutorials/blob/main/BraTS/tutorial.ipynb) ## Citation From edf44fb0f4879a524efa586f83207ecfc56a400f Mon Sep 17 00:00:00 2001 From: Marcel Rosier Date: Fri, 29 Nov 2024 10:00:34 +0100 Subject: [PATCH 7/8] Fix broken link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 117142a..9a90765 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ 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 [Algorithms](#algorithms) section indicate which algorithms are CPU compatible. +> 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. From 5bd4c2ce436afe891fea73ca13148e48f828b0da Mon Sep 17 00:00:00 2001 From: Marcel Rosier Date: Fri, 29 Nov 2024 17:21:04 +0100 Subject: [PATCH 8/8] Add cuda device arg to inpainting example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9a90765..75dae60 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ segmenter.infer_single( from brats import Inpainter from brats.constants import InpaintingAlgorithms -inpainter = Inpainter(algorithm=InpaintingAlgorithms.BraTS24_1) +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",