-
Notifications
You must be signed in to change notification settings - Fork 16
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: Update implementation of ndim
property of transforms
#197
Merged
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d865ec5
enh: outsource the apply function
jmarabotto d6dca85
sty: pacify flake8
jmarabotto e299dc1
sty: fix imports
jmarabotto ffd8a6d
fix: update many apply() calls
oesteban 150c145
Implement ndim
f3529ce
ENH: Implement_ndim
3d40b93
enh: add a test on ndim
abe016e
fix: remove straneous files, revert changes from other branch
180ec18
enh: revert unrelated changes
c0e2a98
enh: revert unrelated changes
90e529b
enh: revert unrelated changes
bafd2ed
enh: revert unrelated changes
acb0736
Update nitransforms/tests/test_base.py
oesteban 4a18200
Update nitransforms/linear.py
oesteban File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surely
-1
? A 4x4 affine represents a transform in 3D space, and nothing intelligible I'm aware of in 5 dimensions.Also this docstring is off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see, it's a 2D matrix, so this works out to 3, but does so in all cases. What you actually want is
self._matrix.shape[0] - 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not work for 2D transforms. But it does work for >2D:
5D could become "a thing" when we want to realign 3D+t images reconstructed with magnitude and phase (or complex). This looks more plausible than generalization to 2D images (2D, 2D+t, 2D+t+part).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, so we're not considering e.g., a 5x5 affine matrix for transforms of 4D spaces, but a collection of 4x4 affines for a collection of 3D volumes.
If you want to be really general, you could treat it as
self._matrix.shape[0] + self._matrix.ndim - 3
, which would handle collections of any number of ND affine spaces. But I'm okay keeping this simplification and assuming 3D volumes for now.As an aside: I don't really understand why you would treat the real and imaginary parts of complex numbers as being an extra dimension in this context. The interpolation would need to account for the complex plane (though on first thought, independent interpolation of real and imaginary components should work...) , but I don't see why the transform would.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct
The fact that this ndim could be 5D does not mean that the transform should use all the dimensions. I agree you (in principle) don't want to interpolate in between imaginary and real part.
I think your implementation is better; why keep the simplification once you've written a better alternative down here?