Add BraTS Mets panoptica tutorial with Standard PQ and Part PQ#77
Conversation
Demonstrates per-sub-region Standard PQ and hierarchical Part PQ evaluation using BraTS-Mets 2025 segmentation labels.
There was a problem hiding this comment.
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." |
| "\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", |
| " \"Necrotic\": LabelGroup(1),\n", | ||
| " \"Edema\": LabelGroup(2),\n", | ||
| " \"Enhancing\": LabelGroup(3),\n", |
| "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()" |
|
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. Apart from that I think it very nicely shows the difference between standard and part-aware PQ! :) |
|
Totally agree. I will speak to erik next week about this on how we can expand properly in his web viewer. |
Summary