Skip to content

Integrate baselines from CNMC_PAI (organizer baseline) - #143

Open
zjiang0529 wants to merge 9 commits into
BrainLesion:mainfrom
zjiang0529:main
Open

Integrate baselines from CNMC_PAI (organizer baseline)#143
zjiang0529 wants to merge 9 commits into
BrainLesion:mainfrom
zjiang0529:main

Conversation

@zjiang0529

Copy link
Copy Markdown
Contributor

In response to Issue #116, add baselines from CNMC_PAI for 7 tasks.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds BraTS25_B (organizer baseline) entries for seven BraTS25 task algorithms — Adult Glioma Pre/Post, Africa, Meningioma, Meningioma RT, Metastases, Pediatric, and Inpainting — plumbing them through enums, YAML metadata, README tables, and updating the rank-integrity test to recognize the new B suffix.

Changes:

  • Add BraTS25_B enum members in brats/constants.py and matching YAML entries (with aparida12/brats2025:* Docker images) in seven task metadata files, including a new Baseline rank anchor in each.
  • Update tests/utils/test_algorithm_config.py rank parser to map suffix BBaseline while preserving existing tie-suffix handling.
  • Add README rows and an explanatory footnote for each new baseline, plus a BraTS-PEDs 2026 dataset paper link.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
brats/constants.py Adds BraTS25_B enum entries with docstrings to seven *Algorithms enums
brats/data/meta/adult_glioma_pre_and_post_treatment.yml New baseline anchor and BraTS25_B entry using aparida12/brats2025:gli
brats/data/meta/africa.yml New baseline anchor and BraTS25_B entry using aparida12/brats2025:ssa (requires_root)
brats/data/meta/meningioma.yml New baseline anchor and BraTS25_B entry using aparida12/brats2025:men
brats/data/meta/meningioma_rt.yml New baseline anchor and BraTS25_B entry using aparida12/brats2025:menrt (requires_root)
brats/data/meta/metastases.yml New baseline anchor and BraTS25_B entry using aparida12/brats2025:met (requires_root)
brats/data/meta/pediatric.yml New baseline anchor and BraTS25_B entry using aparida12/brats2025:peds (requires_root)
brats/data/meta/inpainting.yml New baseline anchor and BraTS25_B entry using aparida12/brats2025:inpt
tests/utils/test_algorithm_config.py Extends rank parsing to map suffix B to Baseline
README.md Adds Baseline* rows and footnotes for seven task sections, plus a PEDs 2026 dataset paper link

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@neuronflow neuronflow linked an issue May 28, 2026 that may be closed by this pull request
@neuronflow
neuronflow requested a review from Astarakee May 28, 2026 16:32
@neuronflow

Copy link
Copy Markdown
Contributor

@Astarakee as I understand it your baseline is not integrated here?

Should we integrate these into this same PR?

Probably the Enums should account for the two Baselines, maybe by going for BraTS25_Baseline_A, BraTS25_Baseline_B or is there a more elegant solution?

@neuronflow neuronflow added the enhancement New feature or request label May 28, 2026
@zjiang0529

Copy link
Copy Markdown
Contributor Author

@Astarakee as I understand it your baseline is not integrated here?

Should we integrate these into this same PR?

Probably the Enums should account for the two Baselines, maybe by going for BraTS25_Baseline_A, BraTS25_Baseline_B or is there a more elegant solution?

I used BraTS25_B to be consistent with the format for the other Enums. We could use BraTS25_B1, B2... for Baseline 1, Baseline 2 etc.?

@Astarakee

Copy link
Copy Markdown
Collaborator

@Astarakee as I understand it your baseline is not integrated here?

Should we integrate these into this same PR?

Probably the Enums should account for the two Baselines, maybe by going for BraTS25_Baseline_A, BraTS25_Baseline_B or is there a more elegant solution?

I will follow the same way that Zhifan applied; for GLI, METs, MENpre, and MENrt all in 2025.

@neuronflow

Copy link
Copy Markdown
Contributor

@Astarakee as I understand it your baseline is not integrated here?
Should we integrate these into this same PR?
Probably the Enums should account for the two Baselines, maybe by going for BraTS25_Baseline_A, BraTS25_Baseline_B or is there a more elegant solution?

I will follow the same way that Zhifan applied; for GLI, METs, MENpre, and MENrt all in 2025.

Okay, I suggest having both baselines in the same PR, so please build upon @zjiang0529 's work and extend this PR. Would that work for you?

@neuronflow

Copy link
Copy Markdown
Contributor

@MarcelRosier should we download the docker images and reupload them to our repo, or keep it as it is?

@neuronflow

Copy link
Copy Markdown
Contributor

@Astarakee as I understand it your baseline is not integrated here?
Should we integrate these into this same PR?
Probably the Enums should account for the two Baselines, maybe by going for BraTS25_Baseline_A, BraTS25_Baseline_B or is there a more elegant solution?

I used BraTS25_B to be consistent with the format for the other Enums. We could use BraTS25_B1, B2... for Baseline 1, Baseline 2 etc.?

For me that suggests some kind of ranking between the baselines, hence I proposed A/B to differentiate from the ranked algorithms. If @Astarakee is okay with having it portrayed like that I am also fine with B1/2.

@zjiang0529

Copy link
Copy Markdown
Contributor Author

@Astarakee as I understand it your baseline is not integrated here?
Should we integrate these into this same PR?
Probably the Enums should account for the two Baselines, maybe by going for BraTS25_Baseline_A, BraTS25_Baseline_B or is there a more elegant solution?

I used BraTS25_B to be consistent with the format for the other Enums. We could use BraTS25_B1, B2... for Baseline 1, Baseline 2 etc.?

For me that suggests some kind of ranking between the baselines, hence I proposed A/B to differentiate from the ranked algorithms. If @Astarakee is okay with having it portrayed like that I am also fine with B1/2.

Have we decided on the name yet? A/B is clearer than 1/2, but using BraTS25_Baseline_A and B could make the columns wider and have three parts. Maybe BraTS25_BaselineA/B or BraTS25_BA/BB?

@MarcelRosier

Copy link
Copy Markdown
Collaborator

@MarcelRosier should we download the docker images and reupload them to our repo, or keep it as it is?

we could do that for control and consistency, but it's not strictly necessary

@MarcelRosier MarcelRosier left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not get the chance to actually test it, but it looks solid. Just settle on a naming convention and ensure it does not break the tests (might be the case currently if we want to support multiple baselines). Also, I would advise moving images to the brainles repo for consistency. I can support with that if we agree on that

@PaulaTBz

Copy link
Copy Markdown
Collaborator

@zjiang0529
I think I found a small problem in the inpainting.yml file. I ran the code you provided with BraTS25_B and got an error regarding writing permissions ("Not enough output files were created by the algorithm. Expected: 1 Got: 0."). I added the key "requires_root" under run_args in the yaml file and set it to true (as is the case for some of the other algorithms ). Now it seems to work. I never had this issue on my laptop, it came up on a remote server where I am testing the baseline. I will check the output and try with other models as well.

@PaulaTBz

PaulaTBz commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

@zjiang0529
I was able to run all baseline algorithms, except for one: Meningioma RT. I always used the example glioma data from the tutorials repo (either segmentation or inpainting data, depending on the task) and it worked for all algorithms, but for Meningioma RT.
There seems to be an issue with the renaming of the data within the container. Apparently, the container expects data of naming convention "BraTS-MEN-RT-0000-1_t1c.nii.gz", i.e. with an underscore before the modality, while in reality, the data is being renamed to something else. Most likely, there should be a hyphen ("-") instead of an underscore ("_") inside the name.

I get this error:

⠋ Running inference...Container finished with an error:
Traceback (most recent call last):
File "/project/runner.py", line 190, in
batch_processor(args.input, args.output)
File "/project/runner.py", line 160, in batch_processor

infer_single(input_path, Path(output_folder))

File "/project/runner.py", line 104, in infer_single

Running inference for task: MEN-RT
Setting up model weights for task: MEN-RT
storing artifacts in tmp dir /tmp/tmp9pwx4fre
BraTS-MEN-RT-0000-1

os.rename(input_folder_raw / name/ f'{name}{key}', input_folder_raw / name/ f'{name}{val}')

FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp9pwx4fre/inp/BraTS-MEN-RT-0000-1/BraTS-MEN-RT-0000-1_t1c.nii.gz' -> '/tmp/tmp9pwx4fre/inp/BraTS-MEN-RT-0000-1/BraTS-MEN-RT-0000-1_0000.nii.gz'

@zjiang0529

Copy link
Copy Markdown
Contributor Author

@PaulaTBz
Hi Paula, thank you for helping with this PR, and you're right.
For the Meningioma RT (MENRT) task, our container expects the NIfTI file name to end with _t1c.nii.gz.

This is due to a naming inconsistency in the official MENRT dataset. Other tasks use -t1c.nii.gz, but MENRT does not (at least for 2024 and 2025), so we added a special condition for this task. Without it, users or challenge testing code will encounter issues when running the container on the official dataset downloaded from Synapse.

I guess your sample data file follows the correct "-" naming conversion. You could test with a MENRT file, an intentionally "wrongly" named sample file, or the file naming in the official MENRT dataset would need to be changed, which is outside of our control.

Best,
Zhifan

@PaulaTBz PaulaTBz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the two small issues regarding "requires_root" and the special naming convention of input data for Meningioma RT, all baselines run successfully.

@zjiang0529

Copy link
Copy Markdown
Contributor Author

Since all changes have been approved, could you please consider validating and merging the PR? Thanks.

@MarcelRosier
MarcelRosier self-requested a review July 6, 2026 20:23

@MarcelRosier MarcelRosier left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few items still have to addressed @zjiang0529:

Must fix (blocking merge)

  1. brats/data/meta/meningioma_rt.ymlBraTS25_B missing subject_modality_separator: "_"
    4 of 6 existing MENRT algorithms set this field (BraTS25_1, 25_2, 24_1, 24_3). The aparida12/brats2025:menrt container expects "_" (underscore) as the modality separator — Paula's testing confirmed this is the cause of the FileNotFoundError. Without it, the default "-" is used and the container's internal rename logic fails.

  2. brats/data/meta/inpainting.ymlBraTS25_B missing requires_root: true
    The container needs root access to run. Paula confirmed adding this fixes the "Not enough output files" error.

Discuss

  1. Naming convention — BraTS25_B will conflict when Astarakee's baselines are added
    If Astarakee also adds BraTS25_B to the same enum, it'll be a duplicate key. Options raised in the thread were BraTS25_BA/BB, BraTS25_BaselineA/B, etc. Would be good to settle this before the next set of baselines lands.

  2. Astarakee's baselines to be added to this same PR
    As discussed above — Astarakee agreed to follow the same pattern. Should we wait for those commits before merging?

  3. Docker image hosting — aparida12/brats2025:* vs reuploading to brainles/
    I advised moving them to the brainles/ org for consistency and offered to help. Not a blocker, but worth deciding.

@zjiang0529

Copy link
Copy Markdown
Contributor Author

Thank you for pointing out these changes. If I understand correctly, the action plan is as follows. Could you confirm?

Easy fixes:

  1. Add subject_modality_separator: "_" to the YAML meta file.
  2. Add requires_root: true.
  3. Yes, please upload the Docker images to brainless/. If you need any action from us, please let us know.

Still unclear:
3. Who should approve the naming convention? If there are no concerns, I will proceed with BraTS25_BA/BB.
4. I would be happy to help add other baselines if they need to be in the same PR. But, also would like to move this PR forward soon if we can consider keeping our baselines together in this PR and address different baselines separately.

@neuronflow

Copy link
Copy Markdown
Contributor

@PaulaTBz can you please take care of the image uploads?

@neuronflow

neuronflow commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

3. Naming convention — BraTS25_B will conflict when Astarakee's baselines are added
If Astarakee also adds BraTS25_B to the same enum, it'll be a duplicate key. Options raised in the thread were BraTS25_BA/BB, BraTS25_BaselineA/B, etc. Would be good to settle this before the next set of baselines lands.

I suggest going for BraTS25_CNMC_PAI or any other acronym you want. This way, users don't need to look up in the table which baseline is which, and no ranking is suggested.

@neuronflow

Copy link
Copy Markdown
Contributor

Thanks!
@Astarakee could @zjiang0529 help you create a PR for your baseline?

@PaulaTBz

PaulaTBz commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

I pushed all baseline images to the brainles namespace on docker hub

@neuronflow

Copy link
Copy Markdown
Contributor

I pushed all baseline images to the brainles namespace on docker hub

cool, now the paths need to be adjusted ;)
either you do it or @zjiang0529 needs to know the paths

@PaulaTBz

PaulaTBz commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

I pushed all baseline images to the brainles namespace on docker hub

cool, now the paths need to be adjusted ;) either you do it or @zjiang0529 needs to know the paths

I can do it, but I'll post the new paths here as well for reference:

brainles/brats25_ssa_baseline
brainles/brats25_inpainting_baseline
brainles/brats25_met_baseline
brainles/brats25_menrt_baseline
brainles/brats25_men_baseline
brainles/brats25_ped_baseline
brainles/brats25_gli_baseline

The tag is always latest.

I'll wait for Zhifan to make the modifications and merge his branch, then I'll update the paths in a separate PR. (I think that makes the most sense) :)

@MarcelRosier

Copy link
Copy Markdown
Collaborator

any progress or blockers here? @zjiang0529 @PaulaTBz

@PaulaTBz

Copy link
Copy Markdown
Collaborator

any progress or blockers here? @zjiang0529 @PaulaTBz

Nothing blocking the merge from my side, assuming the small issues I mentioned above and the question about the naming convention have been addressed. Once this is merged, I'll open a new PR with the updated pointers to the brainles docker hub name space for consistency :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] integrate segmentation baselines from mehdi and Zhifan

6 participants