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
Deal with nibabel
deprecation of get_header
and get_data
#3879
Merged
Conversation
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
Except for examples which end in a filename, to avoid confusion.
Since we now depend on version 1.5.0, instead of 1.4.1. https://github.com/spinalcordtoolbox/spinalcordtoolbox/blob/5.7/requirements-freeze.txt#L15
It's all explained in the helps string.
There's no hdr_1, hdr_2, etc.
Since these are nibabel image objects and numpy arrays: img -> nii img_denoised -> nii_denoised img_diff -> nii_diff denoised -> data_denoised diff_4d -> data_diff According to the naming convention on the wiki: https://github.com/spinalcordtoolbox/spinalcordtoolbox/wiki/Programming%3A-Naming-conventions-(variables,-files)
Also this brings the numpy array computations together, separate from the "Save files" step.
mguaypaq
added
refactoring
category: improves code structure without affecting user-facing functionality
sct_dmri_denoise_patch2self
context:
labels
Sep 7, 2022
joshuacwnewton
approved these changes
Sep 8, 2022
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.
LGTM! The majority of my comments are mostly tangential discussions -- I don't really have any changes to request (and the few comments I had, you already fixed!).
Co-authored-by: Joshua Newton <joshuacwnewton@gmail.com>
joshuacwnewton
approved these changes
Sep 13, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
refactoring
category: improves code structure without affecting user-facing functionality
sct_dmri_denoise_patch2self
context:
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.
Description
nibabel
has deprecated theget_header()
andget_data()
methods, in favour of theheader
property and theget_fdata()
method, respectively. Thesct_dmri_denoise_patch2self.py
script is one of the three callers of these methods in SCT, so it needs to be updated. And since it's such a small script, I decided to do a general cleanup while I was at it.This is probably easier to review commit-by-commit, since each one is a single change.
I think the only controversial change is that I added the second output file to the
display_viewer_syntax
call at the end (which was possibly showing an incorrect filename anyway if-o
wasn't used).Linked issues
Part of #3854.