Skip to content

Add BraTS Mets panoptica tutorial with Standard PQ and Part PQ#77

Merged
neuronflow merged 3 commits into
BrainLesion:mainfrom
aymuos15:brats-mets-panoptica-tutorial
May 7, 2026
Merged

Add BraTS Mets panoptica tutorial with Standard PQ and Part PQ#77
neuronflow merged 3 commits into
BrainLesion:mainfrom
aymuos15:brats-mets-panoptica-tutorial

Conversation

@aymuos15
Copy link
Copy Markdown
Contributor

@aymuos15 aymuos15 commented May 4, 2026

Summary

  • Adds a new Panoptica tutorial for BraTS Metastasis 2025 segmentation evaluation
  • Demonstrates per-sub-region Standard PQ (Necrotic, Edema, Enhancing evaluated independently)
  • Demonstrates Part PQ with Enhancing Tumor (3) as the thing and Necrotic Core (1) as the part, with Edema (2) evaluated as a standard LabelGroup
  • Includes threshold sweep comparing Standard PQ vs Part PQ across IoU thresholds 0.05–0.95

Demonstrates per-sub-region Standard PQ and hierarchical Part PQ
evaluation using BraTS-Mets 2025 segmentation labels.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Panoptica tutorial notebook for BraTS-Mets 2025 segmentation evaluation, demonstrating Standard PQ per sub-region, Part PQ (thing+part hierarchy), and an IoU-threshold sweep comparison.

Changes:

  • Introduces a new end-to-end notebook that loads example NIfTI masks and runs Standard PQ across BraTS sub-regions.
  • Adds a Part PQ example (ET as thing, NCR as part) alongside standard evaluation of edema.
  • Includes a threshold sweep (0.05–0.95) comparing Standard PQ (ET) vs Part PQ and visualizes the trend.

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

"\n",
"In **Standard PQ**, each sub-region is evaluated independently as a separate class.\n",
"\n",
"In **Part PQ**, the enhancing tumor and edema form the *thing* (the tumor instance), while the necrotic core is a *part* nested inside it — reflecting the biological hierarchy."
Comment on lines +62 to +69
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m26.0.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m26.1\u001b[0m\r\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpython3 -m pip install --upgrade pip\u001b[0m\r\n"
]
}
],
"source": [
"!pip install panoptica auxiliary nibabel matplotlib numpy rich > /dev/null"
]
"import numpy as np\n",
"import nibabel as nib\n",
"import matplotlib.pyplot as plt\n",
"from rich import print as rprint\n",
Comment on lines +316 to +318
" \"Necrotic\": LabelGroup(1),\n",
" \"Edema\": LabelGroup(2),\n",
" \"Enhancing\": LabelGroup(3),\n",
Comment on lines +673 to +681
"from panoptica.instance_matcher import NaiveThresholdMatching as NTM\n",
"\n",
"thresholds = np.arange(0.05, 1.0, 0.05)\n",
"pq_enhancing = []\n",
"pq_part = []\n",
"\n",
"print(\"Sweeping thresholds...\")\n",
"for thresh in thresholds:\n",
" matcher = NTM(matching_metric=Metric.IOU, matching_threshold=float(thresh))\n",
"ax.legend(fontsize=11)\n",
"ax.grid(True, linestyle=\"--\", alpha=0.6)\n",
"fig.tight_layout()\n",
"plt.show()"
@neuronflow neuronflow requested a review from PaulaTBz May 7, 2026 12:18
@neuronflow neuronflow merged commit 99c5841 into BrainLesion:main May 7, 2026
1 check passed
@PaulaTBz
Copy link
Copy Markdown
Collaborator

PaulaTBz commented May 8, 2026

Maybe it would be nice to add some visual examples, like showing one or two slices of the reference and prediction masks with a plot. A simple plot of the sub-regions and tumor/part relationship would make the hierarchy a little clearer I think.
I am not too familiar with brain metastases, so it would have helped me here to be reminded what the segmented results look like (and to see how reference and prediction differ). Also that might make it a little easier to interpret the results for PQ, SQ, RQ when seeing them in combination with the images. I would place the plot right after the data loading.

Apart from that I think it very nicely shows the difference between standard and part-aware PQ! :)

@aymuos15
Copy link
Copy Markdown
Contributor Author

aymuos15 commented May 8, 2026

Totally agree. I will speak to erik next week about this on how we can expand properly in his web viewer.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants