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

ENH: twix mixed headers #135

Merged
merged 2 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ This document contains the Spec2nii release history in reverse chronological ord
---------------------------------
- Refinements and improvements to the GE SVS pipeline from Mark Mikkelsen.
- Add support for older jMRUI text formats which have a slightly different syntax. With thanks to Donnie Cameron.
- Handle odd case of XA like .twix headers in a VX baseline scan

0.7.3 (Tuesday 12th March 2024)
-------------------------------
Expand Down
12 changes: 11 additions & 1 deletion spec2nii/Siemens/twixfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,17 @@ def examineTwix(twixObj, fileName, mraid):
def extractTwixMetadata(mapVBVDHdr, original_file):
"""Pass to appropriate extractTwixMetadata function for software version."""
if xa_or_vx(mapVBVDHdr) == 'vx':
return extractTwixMetadata_vx(mapVBVDHdr, original_file)
try:
return extractTwixMetadata_vx(mapVBVDHdr, original_file)
except KeyError as original_err:
try:
print(f'VX-line scanner headers caused KeyError {original_err}.')
print('Trying XA interpreter. ')
return extractTwixMetadata_xa(mapVBVDHdr, original_file)
except Exception as backup_err:
print(f'XA interpreter failed with reason {backup_err}. Raising original error.')
raise original_err

elif xa_or_vx(mapVBVDHdr) == 'xa':
return extractTwixMetadata_xa(mapVBVDHdr, original_file)

Expand Down
Loading