Skip to content

Conversation

@mnoergaard
Copy link
Collaborator

@mnoergaard mnoergaard commented Nov 26, 2025

This PR addresses issue #184 and #177 by adding support for 1) using other reference PET images for e.g. co-registration, and 2) implementing an additional option for performing PET to anatomical co-registration using ANTs. It implements the possibility to use 'twa' which is a time-weighted average of the motion corrected PET data. Furthermore, it also allows the use of 'sum' which is a summed image across time for the motion corrected PET data. The default is still the template generated from the motion correction using mri_robust_template.

@codecov
Copy link

codecov bot commented Nov 26, 2025

Codecov Report

❌ Patch coverage is 86.17886% with 34 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.81%. Comparing base (133526d) to head (03c6a78).

Files with missing lines Patch % Lines
petprep/workflows/pet/fit.py 79.13% 11 Missing and 13 partials ⚠️
petprep/interfaces/reports.py 60.00% 3 Missing and 3 partials ⚠️
petprep/cli/parser.py 33.33% 1 Missing and 1 partial ⚠️
petprep/workflows/pet/registration.py 95.45% 1 Missing ⚠️
petprep/workflows/pet/tests/test_fit.py 98.83% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #185      +/-   ##
==========================================
+ Coverage   80.63%   80.81%   +0.17%     
==========================================
  Files          84       84              
  Lines        6512     6738     +226     
  Branches      657      689      +32     
==========================================
+ Hits         5251     5445     +194     
- Misses       1097     1112      +15     
- Partials      164      181      +17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mnoergaard mnoergaard requested a review from aliswh November 26, 2025 13:33
@mnoergaard mnoergaard requested a review from mathesong November 30, 2025 19:38
@mnoergaard
Copy link
Collaborator Author

mnoergaard commented Dec 1, 2025

@mathesong - think this is ready for review. Will continue to do more testing locally on my end and test robustness/performance. We may want to consider making ants the default option for co-registration. WDYT? But this should go into a separate PR.

@mathesong
Copy link

Looks good to me!

I've been testing this over the weekend on my other dataset too, and unfortunately it's not a silver bullet. I still have failures in ~25%. Some overlapping from before, some not. So better than before, but not quite as robust as I had hoped. I then ran it with the hmc with a 2mm fwhm, and it's saved a few, but they're still causing issues. So I'm not really sure what the default ought to be if we still have issues :\

I suspect that the primary issue is that for this tracer, there's just so much uptake outside the brain in the PET, which makes things messy. There's got to be a solution somewhere...

@mathesong
Copy link

I just started running a few of the problematic subjects with the updated ANTS settings from ~30 minutes ago. I see you reverted some of them? Should I stop and restart with the new settings?

Also, another thought is that it might be worth having another pet2anat method called "ants_withskull" where the brain mask is dilated by 2cm around the brain, and then masked with the head mask from FreeSurfer. This might just give a bit more information for cases where there's either a lot going on around the brain, or alternatively where there's just not so much binding in the brain like when there's high occupancy.

@mnoergaard
Copy link
Collaborator Author

I just started running a few of the problematic subjects with the updated ANTS settings from ~30 minutes ago. I see you reverted some of them? Should I stop and restart with the new settings?

Also, another thought is that it might be worth having another pet2anat method called "ants_withskull" where the brain mask is dilated by 2cm around the brain, and then masked with the head mask from FreeSurfer. This might just give a bit more information for cases where there's either a lot going on around the brain, or alternatively where there's just not so much binding in the brain like when there's high occupancy.

The updated settings failed for another dataset I have, where there is not much uptake within the brain. So reverted my changes. Interestingly, for two of the ones that failed on my end with ANTs, worked with mri_coreg using --petref sum. This makes we think that we may also want to support more options for generating the PET reference image, such as a summing over the first 5 minutes to create a flow-like image. WDYT? Nevertheless, more testing is needed, and I think it is good to allow for several additional options, as some settings will be good for some tracers, and other settings will be good for other tracers.

It's a good idea with ants-with-skull!

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