Skip to content

Conversation

MarcelRosier
Copy link
Collaborator

No description provided.

@MarcelRosier MarcelRosier linked an issue Jul 25, 2025 that may be closed by this pull request
@MarcelRosier MarcelRosier requested a review from neuronflow July 25, 2025 14:29
@MarcelRosier MarcelRosier self-assigned this Jul 25, 2025
@neuronflow neuronflow requested a review from Copilot July 25, 2025 18:33
@neuronflow neuronflow enabled auto-merge July 25, 2025 18:34
Copy link
Contributor

@Copilot 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

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

Comment on lines 75 to +78
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))

Copy link

Copilot AI Jul 25, 2025

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.

Copilot uses AI. Check for mistakes.

neuronflow and others added 2 commits July 25, 2025 20:35
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@neuronflow neuronflow merged commit d31ea49 into main Jul 25, 2025
1 check passed
@neuronflow neuronflow deleted the 72-feature-update-brats-tutorial branch July 25, 2025 18:36
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.

[FEATURE] Update brats tutorial

2 participants