Add RankSEG integration tutorial - #2068
Conversation
Signed-off-by: statmlben <[email protected]>
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. 💤 Files selected but had no reviewable changes (1)
⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughAdds a MONAI tutorial integrating RankSEG and RankSEGd with a pretrained pancreas DiNTS model, comparing RankSEG against argmax using Dice scores and visualizations. It also documents the notebook and exempts it from the runner’s ChangesRankSEG integration tutorial
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Notebook
participant DiNTS
participant RankSEG
participant DiceMetric
Notebook->>DiNTS: run sliding-window inference
DiNTS-->>Notebook: return segmentation logits
Notebook->>RankSEG: decode softmax probabilities
RankSEG-->>Notebook: return class-index prediction
Notebook->>DiceMetric: compare prediction with foreground labels
DiceMetric-->>Notebook: return Dice scores
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@modules/rankseg_integration.ipynb`:
- Line 47: Update the dependency-check command in the notebook setup cell to
validate both MONAI and nibabel imports before skipping installation. Ensure any
installation runs through the active kernel interpreter, and retain the existing
MONAI extras including nibabel and tqdm so the later LoadImaged call can read
.nii.gz files.
- Around line 630-653: Update both torch.load calls for the architecture and
checkpoint artifacts in the model-loading flow to use weights_only=True instead
of explicitly enabling full pickle deserialization. Preserve the existing paths
and map_location settings, and only retain weights_only=False if the loaded
files require trusted non-tensor objects.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e68feaab-cd4b-4ade-99e2-419988bdcf7c
📒 Files selected for processing (3)
README.mdmodules/rankseg_integration.ipynbrunner.sh
ericspod
left a comment
There was a problem hiding this comment.
Hi @statmlben thanks for this tutorial as we had discussed. I think it's fine overall for the existing content, but we need a discussion on what Rankseg is and how the algorithm works. At the top you should describe what it is, how it differs from other components, what it's used for, what the implications of using it are, etc. This by no means needs the same details as in your paper but should be motivating enough so readers know what the notebook is demonstrating and whether they'd want to use it themselves or not. I think the Coderabbit comments should be looked at but I had responses here as well.
Signed-off-by: statmlben <[email protected]>
|
Thanks @ericspod for the feedback. I added an introductory section near the top of the notebook explaining what RankSEG is, how it differs from argmax, fixed thresholding, and morphology-based post-processing, and how the RMA workflow operates at a high level. The section also discusses suitable use cases, probability requirements, computational cost, and the need to validate improvements on representative data. I also addressed your inline suggestions by consolidating the dependency installation command and using the Bundle |
Related to MONAI-#8908
Description
This PR adds a runnable tutorial demonstrating how to use RankSEG as an optional third-party post-processing transform in a MONAI workflow.
The tutorial:
pancreas_ct_dints_segmentationMONAI Bundle and a real MSD Task07 Pancreas case;RankSEGtransform;RankSEGdtransform in a MONAIComposepost-processing pipeline;This PR also adds the tutorial to the repository README and registers it in
doesnt_contain_max_epochsbecause it is an inference-only notebook.Checks
Results
Summary by CodeRabbit
New Features
Documentation