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

FIX: Calculate bspline grids separately from colocation matrices #308

Merged
merged 2 commits into from
Dec 6, 2022

Conversation

effigies
Copy link
Member

@effigies effigies commented Dec 5, 2022

The _collocation_matrix function introduced in #301 could produce slightly different knot spacings if the field of view changes sufficiently in resampling. The results of this function should be based entirely on the size of the input image, not a dynamic resampling.

We therefore calculate the grid spacings before any resampling. This eliminates the need for a separate _collocation_matrix, which can be done with a single call to scipy.sparse.vstack() over an iterable of sparse matrices.

Closes #307.

@effigies effigies changed the title RF: Calculate bspline grids separately from colocation matrices FIX: Calculate bspline grids separately from colocation matrices Dec 5, 2022
@codecov-commenter
Copy link

Codecov Report

Base: 83.94% // Head: 90.70% // Increases project coverage by +6.76% 🎉

Coverage data is based on head (0306191) compared to base (a2bc54c).
Patch coverage: 63.63% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #308      +/-   ##
==========================================
+ Coverage   83.94%   90.70%   +6.76%     
==========================================
  Files          24       24              
  Lines        1999     1991       -8     
  Branches      232      305      +73     
==========================================
+ Hits         1678     1806     +128     
+ Misses        280      145     -135     
+ Partials       41       40       -1     
Flag Coverage Δ
travis ?
unittests 90.70% <63.63%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
sdcflows/interfaces/bspline.py 80.00% <63.63%> (+2.58%) ⬆️
sdcflows/workflows/outputs.py 93.84% <0.00%> (+1.53%) ⬆️
sdcflows/interfaces/reportlets.py 89.83% <0.00%> (+1.69%) ⬆️
sdcflows/interfaces/utils.py 90.86% <0.00%> (+10.04%) ⬆️
sdcflows/workflows/fit/syn.py 69.82% <0.00%> (+21.30%) ⬆️
sdcflows/interfaces/fmap.py 96.55% <0.00%> (+24.13%) ⬆️
sdcflows/utils/phasemanip.py 94.02% <0.00%> (+28.35%) ⬆️
sdcflows/interfaces/brainmask.py 100.00% <0.00%> (+43.75%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@effigies
Copy link
Member Author

effigies commented Dec 6, 2022

@oesteban This should be a fairly quick review. This fix is necessary for a release, regardless of whether we get in other improvements.

@effigies effigies added this to the 2.2.0 milestone Dec 6, 2022
@oesteban
Copy link
Member

oesteban commented Dec 6, 2022

Replaces #300, correct?

Copy link
Member

@oesteban oesteban left a comment

Choose a reason for hiding this comment

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

Okay, I can see this is not replacing #300.

I believe readability is much improved :)

@effigies effigies force-pushed the fix/grid_creation branch 2 times, most recently from db9314f to 7d5d007 Compare December 6, 2022 18:00
@effigies effigies merged commit 7898fac into nipreps:master Dec 6, 2022
@effigies effigies deleted the fix/grid_creation branch December 6, 2022 19:10
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.

BSplineApprox dimension mismatch
3 participants