Skip to content

Add 3D semantic segmentation code example #2099

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

innat
Copy link
Contributor

@innat innat commented May 3, 2025

@innat
Copy link
Contributor Author

innat commented May 3, 2025

@mattdangerw
I addressed all the feedback you made here. Please check it.

@innat
Copy link
Contributor Author

innat commented May 7, 2025

@mattdangerw
A gentle reminder.

@innat
Copy link
Contributor Author

innat commented May 15, 2025

@mattdangerw
Could you please take a look this PR? Is it suitable for keras code example, otherwise I will close the PR.

@divyashreepathihalli
Copy link
Collaborator

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The code changes introduce a 3D semantic segmentation pipeline for medical imaging, specifically brain tumor segmentation using the BraTS dataset. The code is well-structured, but there are opportunities to improve maintainability, clarity, and correctness through refactoring repetitive code blocks, clarifying visualization logic, and simplifying computations.

Comment on lines +813 to +815
prediction[segment[..., 1] == 1] = 2
prediction[segment[..., 0] == 1] = 1
prediction[segment[..., 2] == 1] = 4
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The logic to reconstruct the single-channel prediction map relies on a specific order of assignments to handle overlapping regions. While the current order is correct, the code would be more self-documenting and easier to maintain if you add a comment explaining why this order is important.

prediction[segment[..., 1] == 1] = 2  # Whole Tumor (WT)
prediction[segment[..., 0] == 1] = 1  # Tumor Core (TC)
prediction[segment[..., 2] == 1] = 4  # Enhancing Tumor (ET)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@innat
Copy link
Contributor Author

innat commented Jul 13, 2025

@divyashreepathihalli
A review from human would be appreciated. Thanks.

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.

3 participants