-
Couldn't load subscription status.
- Fork 2
72 feature update brats tutorial #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the BraTS tutorial utility functions to use more type-safe and flexible path handling. The changes improve type annotations and enhance the segmentation visualization by making the background transparent.
- Replace string-only path parameters with Union[str, Path] type annotations throughout utility functions
- Convert DATA_FOLDER from string to Path object for better path handling
- Improve segmentation visualization by masking out background pixels with transparent overlay
| ax[0].imshow(modality_np[slice_index, :, :], cmap="gray") | ||
| ax[1].imshow(modality_np[slice_index, :, :], cmap="gray") | ||
| ax[1].imshow(seg_np[slice_index, :, :], cmap="plasma", alpha=0.3) | ||
| ax[1].imshow(seg_slice, cmap="plasma", alpha=np.where(seg_slice > 0, 0.3, 0)) | ||
|
|
Copilot
AI
Jul 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The np.where operation is computed for every pixel on each function call. Consider pre-computing the alpha mask: alpha_mask = np.where(seg_slice > 0, 0.3, 0) then use alpha=alpha_mask for better performance.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
No description provided.