-
Notifications
You must be signed in to change notification settings - Fork 536
FIX: ANTs' tools maintenance overhaul #3180
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
909301e
fix #3178: improve the parsing of ``Atropos``
oesteban 8165242
enh: add a few new utilities to ANTs
oesteban 167f6c9
enh: update ants' interfaces API
oesteban 417b889
sty: black
oesteban 1c5045d
enh,sty: update antsJointFusion + black et al.
oesteban 9e7c997
fix: ``make specs``
oesteban dfe8501
tst: reduce some complexity and increase coverage
oesteban dffcb78
fix: copy header for ResampleImageBySpacing
oesteban cf48cbd
Apply suggestions from code review
oesteban 051c1e5
fix(compat): ensure nibabel < 3 compatiblity of tests
oesteban 774f41d
fix: use ``aggregate_outputs`` instead of ``_list_outputs``
oesteban 0544124
enh: remove ``aggregate_outputs`` duplications, fix InputMultiPath
oesteban f88add4
fix: roll back under-i/o specs
oesteban 6979cbd
RF: Move header copying to a mixin
effigies d50c185
STY: black
effigies 545a5fe
MNT: make specs
effigies 292e2e8
Merge pull request #10 from effigies/enh/ants-utils-overhaul
oesteban 135d900
sty: fix unused import
oesteban 4e1d601
fix: consider that some outputs might not be defined
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
enh: add a few new utilities to ANTs
- Loading branch information
commit 8165242e61d605029b52d2f1a0189e7270148e90
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| """Image manipulation utilities (mostly, NiBabel manipulations).""" | ||
| import nibabel as nb | ||
|
|
||
|
|
||
| def copy_header(header_file, in_file, keep_dtype=True): | ||
| """Copy header from a reference image onto another image.""" | ||
| hdr_img = nb.load(header_file) | ||
| out_img = nb.load(in_file, mmap=False) | ||
| hdr = hdr_img.header.copy() | ||
| if keep_dtype: | ||
| hdr.set_data_dtype(out_img.get_data_dtype()) | ||
|
|
||
| new_img = out_img.__class__(out_img.dataobj, None, hdr) | ||
| if not keep_dtype: | ||
| new_img.set_data_dtype(hdr_img.get_data_dtype()) | ||
|
|
||
| new_img.to_filename(in_file) | ||
| return in_file |
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.
Uh oh!
There was an error while loading. Please reload this page.