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: Increase FSL serialization precision #144

Merged
merged 3 commits into from
Feb 16, 2022

Conversation

effigies
Copy link
Member

Was reviewing when you merged. :-)

@@ -46,14 +46,14 @@ def from_ras(cls, ras, moving=None, reference=None):

# Adjust for reference image offset and orientation
refswp, refspc = _fsl_aff_adapt(reference)
pre = reference.affine.dot(inv(refspc).dot(inv(refswp)))
pre = reference.affine @ inv(refswp @ refspc)
Copy link
Member Author

Choose a reason for hiding this comment

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

I think it makes sense to think of the matrices as aff and swp @ spc. So you are always either aff @ inv(swp @ spc) or swp @ spc @ inv(aff).


# Adjust for moving image offset and orientation
movswp, movspc = _fsl_aff_adapt(moving)
post = inv(movswp).dot(movspc.dot(inv(moving.affine)))
post = movswp @ movspc @ inv(moving.affine)
Copy link
Member Author

Choose a reason for hiding this comment

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

That catches that here you had movswp inverted and movspc not.

@effigies effigies requested a review from oesteban February 15, 2022 22:04
effigies and others added 3 commits February 16, 2022 16:55

Verified

This commit was signed with the committer’s verified signature.
oesteban Oscar Esteban

Verified

This commit was signed with the committer’s verified signature.
oesteban Oscar Esteban

Verified

This commit was signed with the committer’s verified signature.
oesteban Oscar Esteban
Copy link
Collaborator

@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.

Thanks for this. I've updated the test files so that the new precision is honored.

@oesteban oesteban merged commit 5fb3e40 into nipy:master Feb 16, 2022
@effigies effigies deleted the fix/fsl_transforms branch February 16, 2022 15:58
@@ -24,4 +24,4 @@ def assert_affines_by_filename(affine1, affine2):
else:
xfm1 = np.loadtxt(str(affine1))
xfm2 = np.loadtxt(str(affine2))
np.testing.assert_almost_equal(xfm1, xfm2)
np.allclose(xfm1, xfm2, atol=1e-04)
Copy link
Member Author

Choose a reason for hiding this comment

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

We just lost an assertion.

Copy link
Collaborator

Choose a reason for hiding this comment

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

ugh good catch

oesteban added a commit that referenced this pull request Feb 16, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
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.

None yet

2 participants