Skip to content
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

Working synb0 wrapper in scilpy #734

Merged
merged 30 commits into from
Feb 22, 2024
Merged

Conversation

frheault
Copy link
Member

@frheault frheault commented Aug 15, 2023

Quick description

Please include a summary of the changes and the related issue(s) or improvement(s).
Please also include relevant motivation and context. List any dependencies that are required for this change if needed.

By providing a skull strip t1w and b0, this generate a perfect b0 without distortion which can be fed to topup (saying it has infinite bandwitdh) to trick topup into fixing the diffusion without a rev_b0.

Useful when no rev_b0 is available. Could help to simplify Tractoflow?

https://pubmed.ncbi.nlm.nih.gov/31075422/

...

Type of change

Check the relevant options.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Provide data, screenshots, command line to test (if relevant)

...

Checklist

  • My code follows the style guidelines of this project (run autopep8)
  • I added relevant citations to scripts, modules and functions docstrings and descriptions
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I moved all functions from the script file (except the argparser and main) to scilpy modules
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@arnaudbore arnaudbore self-requested a review August 15, 2023 18:42
@arnaudbore
Copy link
Contributor

Build passed ! Good Job 🍻 !

@arnaudbore
Copy link
Contributor

@arnaudbore
Copy link
Contributor

@frheault
Copy link
Member Author

The test requires tensorflow, should I just delete the test or we turn it off?

@AlexVCaron
Copy link
Contributor

Could the test run conditionally to having Tensorflow installed ? https://stackoverflow.com/questions/36377625/how-to-conditionally-skip-a-test-in-python

Maybe the import error is too early and would prevent this to work ...

@arnaudbore
Copy link
Contributor

Build passed ! Good Job 🍻 !

@arnaudbore
Copy link
Contributor

Build passed ! Good Job 🍻 !

Copy link
Contributor

@arnaudbore arnaudbore left a comment

Choose a reason for hiding this comment

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

Need some testing before moving forward. Overall synthesize_b0 works well but still needs to be tested with topup.

scripts/scil_prepare_topup_command.py Outdated Show resolved Hide resolved
scilpy/utils/image.py Outdated Show resolved Hide resolved
@pep8speaks
Copy link

pep8speaks commented Oct 23, 2023

Hello @frheault, Thank you for updating !

Line 211:80: E501 line too long (80 > 79 characters)
Line 233:80: E501 line too long (80 > 79 characters)

Comment last updated at 2024-02-21 21:13:53 UTC

@arnaudbore arnaudbore self-requested a review October 23, 2023 18:42
@arnaudbore
Copy link
Contributor

Build passed ! Good Job 🍻 !

@arnaudbore
Copy link
Contributor

Build passed ! Good Job 🍻 !

@arnaudbore
Copy link
Contributor

@arnaudbore
Copy link
Contributor

Copy link
Contributor

@mdesco mdesco left a comment

Choose a reason for hiding this comment

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

A few minor comments. Hard for me to test on my mac. Don't want to fight with tensorflow...

scripts/scil_synthesize_b0.py Outdated Show resolved Hide resolved
Copy link
Contributor

@mdesco mdesco left a comment

Choose a reason for hiding this comment

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

Once the minor comments are done. All good

@arnaudbore arnaudbore self-requested a review December 4, 2023 19:42
@arnaudbore
Copy link
Contributor

Build passed ! Good Job 🍻 !

@arnaudbore
Copy link
Contributor

Build passed ! Good Job 🍻 !

@arnaudbore
Copy link
Contributor

Build passed ! Good Job 🍻 !

@smeisler
Copy link

Thanks for your work on this, I have started testing it out.

It doesn't seem like the synb0 template fetcher function is defined in the PR, but I presume the template was the file in /data/mni_icbm152_t1_tal_nlin_asym_09c_masked_2_5.nii.gz? If so, the template looked strange after I visualized it when I downloaded it from GitHub:
image

The resulting b0 map also looked odd, but likely due to trying to register to that odd template image:
image

@smeisler
Copy link

@smeisler
Copy link

Fixing the template did the trick!
image

@frheault
Copy link
Member Author

The template here looks better: https://github.com/MASILab/Synb0-DISCO/blob/master/atlases/mni_icbm152_t1_tal_nlin_asym_09c_mask_2_5.nii.gz

I will fix the function and make sure the data inside the repo is reuploaded correctly, thank you !

@arnaudbore
Copy link
Contributor

Build passed ! Good Job 🍻 !

@arnaudbore
Copy link
Contributor

Build passed ! Good Job 🍻 !

Copy link

codecov bot commented Feb 20, 2024

Codecov Report

Attention: 85 lines in your changes are missing coverage. Please review.

Comparison is base (89ac8ce) 68.50% compared to head (bc117fb) 68.25%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #734      +/-   ##
==========================================
- Coverage   68.50%   68.25%   -0.25%     
==========================================
  Files         387      388       +1     
  Lines       20867    20950      +83     
  Branches     3214     3216       +2     
==========================================
+ Hits        14294    14300       +6     
- Misses       5285     5363      +78     
+ Partials     1288     1287       -1     
Components Coverage Δ
Scripts 70.92% <1.38%> (-0.36%) ⬇️
Library 63.64% <26.31%> (-0.07%) ⬇️

Copy link
Contributor

@arnaudbore arnaudbore left a comment

Choose a reason for hiding this comment

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

A couple of comments, almost GTG

scripts/scil_volume_b0_synthesis.py Outdated Show resolved Hide resolved
scripts/tests/test_synthesize_b0.py Outdated Show resolved Hide resolved
scilpy/image/volume_operations.py Outdated Show resolved Hide resolved
@arnaudbore arnaudbore merged commit 594fbb7 into scilus:master Feb 22, 2024
2 checks passed
@frheault frheault deleted the synb0_integration branch February 28, 2024 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants