-
Notifications
You must be signed in to change notification settings - Fork 264
ENH: Speed up tractogram.apply_affine #1000
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1000 +/- ##
==========================================
- Coverage 92.30% 92.23% -0.08%
==========================================
Files 100 100
Lines 12223 12176 -47
Branches 2194 2131 -63
==========================================
- Hits 11282 11230 -52
- Misses 617 618 +1
- Partials 324 328 +4
Continue to review full report at Codecov.
|
@effigies @arokem I forgot about this PR until now. Some TRK's header issue was brought up in this discussion: https://neurostars.org/t/trk-files-in-dipy-header-file-incorrect/20452/6. I'm not sure if the issue is related to Dipy/NiBabel or some other library. |
This looks good to me! |
Co-authored-by: Chris Markiewicz <[email protected]>
…ines is not a sliced view.
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.
Sorry for the extremely slow review. This LGTM.
@effigies no worries. Happy it's in before 4.0.0 :). |
This PR adds the
inplace
option toaffines.apply_affine(...)
whichTractogram.apply_affine
can leverage for some speed and memory gains.The speedup is actually two-fold:
affines.apply_affine
to perform the transformation in-place reduces memory peak usage (esp. when dealing with 10 million streamlines).ArraySequence
representing the tractogram's streamlines is not a sliced view, the affine transformation can be applied directly on the underlying numpy array that contains the data. Doing that avoids having to transform each streamline one by one as it is currently done.Also, this PR partially addresses issue #943 (see my comment over there for more details).