Skip to content

Added tissue binary masks to brainweb phantoms generation#68

Merged
J-Endres merged 2 commits intoMRsources:mainfrom
snawarhussain:main
Sep 17, 2024
Merged

Added tissue binary masks to brainweb phantoms generation#68
J-Endres merged 2 commits intoMRsources:mainfrom
snawarhussain:main

Conversation

@snawarhussain
Copy link
Contributor

Summary

This pull request introduces some enhancements and new features related to binary mask generation for different tissue when downloading data from the BrainWeb website. The key changes are as follows:

  1. Binary Mask Generation:

    • Binary masks are now created from tissue properties during the data download process from the BrainWeb website using the generate_brainweb_phantoms function. These masks accurately represent different tissue types in the downloaded brain phantoms.
  2. Integration with VoxelGrid Phantom and SimData:

    • The functionality to resample, plot, and manage these binary masks has been integrated into the VoxelGrid phantom and SimData classes. This integration ensures that the binary masks are now a cohesive part of the simulation data workflow.
  3. New Example Notebook:

    • A new example notebook has been added at documentation/playground/templates/binary_masks.ipynb. This notebook demonstrates how to extract and plot the binary masks, providing users with a clear and practical guide on utilizing this new functionality.
  4. Intended Use of Binary Masks:

  • Image metric calculation i,e (tissue-specific SNR, Sharpness, contrast, etc.)

Changes Made

  • Updated the generate_brainweb_phantoms function to create binary masks based on tissue properties during the BrainWeb data download.
  • Enhanced the VoxelGrid and SimData classes to include functionality for resampling, plotting, and managing these binary masks.
  • Added a new Jupyter notebook to the documentation/playground/templates/ directory that shows how to work with these binary masks, including plotting and extraction.
  • Updated the relevant documentation to reflect the new and modified features.

Testing

  • I have tested the code on Python 3.10.14 with binary masks of varying interpolated sizes, subjects, and configuration i.e. [3T, 3T-highres-fat ].
  • The example notebook includes visualizations that verify the correct creation, resampling, and plotting of the binary masks.

Notes

  • Feedback is welcome, and I am prepared to make any further refinements or adjustments as needed based on the review.

I look forward to your review and comments on this contribution!

@J-Endres
Copy link
Collaborator

Thank you for your contribution!

Your changes look like a gread addition to MRzero and I'm happy to see it getting more practical for more usecases. There are only some small tweaks I'd like to see so that existing behaviour does not change, otherwise I'm more than happy to merge your modifications.

@snawarhussain
Copy link
Contributor Author

Hi @J-Endres , thank you for going through the PR in such great depth, I appreciate the insights and suggestions.
I will make the changes over the weekend and let you know :)

@snawarhussain
Copy link
Contributor Author

snawarhussain commented Aug 26, 2024

The last few forced pushes were to amend the commit. I made minor adjustments to the comments and the titles on the ipynb example file, and to account for the number of masks in plot() function. though the brainweb phantoms come with 3 segmentation masks I understand that the VoxelGridPhantom class intends to be a bit universal and should work on various types of digital phantoms and different numbers of segmentation masks.

@snawarhussain snawarhussain marked this pull request as ready for review August 26, 2024 09:29
@snawarhussain snawarhussain requested a review from J-Endres August 29, 2024 11:38
@J-Endres
Copy link
Collaborator

The changes look great, thank you!

@J-Endres J-Endres merged commit e98d963 into MRsources:main Sep 17, 2024
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.

2 participants