Skip to content
Snippets Groups Projects
Commit 0cd85d1f authored by Paul McCarthy's avatar Paul McCarthy
Browse files

Workaround a bug in nibabel 2.1.0

parent 9a363495
No related branches found
No related tags found
No related merge requests found
...@@ -211,11 +211,26 @@ class Nifti(notifier.Notifier): ...@@ -211,11 +211,26 @@ class Nifti(notifier.Notifier):
# We have to treat FSL/FNIRT images # We have to treat FSL/FNIRT images
# specially, as FNIRT clobbers the # specially, as FNIRT clobbers the
# sform section of the NIFTI header # sform section of the NIFTI header
# to store other data. # to store other data.
intent = header.get('intent_code', -1) #
qform = header.get('qform_code', -1) # TODO Nibabel <= 2.1.0 has a bug in header.get
sform = header.get('sform_code', -1) # for fields with a value of 0. When this
# bug gets fixed, we can replace the if-else
# block below with this:
#
# intent = header.get('intent_code', -1)
# qform = header.get('qform_code', -1)
# sform = header.get('sform_code', -1)
#
if isinstance(header, nib.nifti1.Nifti1Header):
intent = header['intent_code']
qform = header['qform_code']
sform = header['sform_code']
else:
intent = -1
qform = -1
sform = -1
if intent in (constants.FSL_FNIRT_DISPLACEMENT_FIELD, if intent in (constants.FSL_FNIRT_DISPLACEMENT_FIELD,
constants.FSL_CUBIC_SPLINE_COEFFICIENTS, constants.FSL_CUBIC_SPLINE_COEFFICIENTS,
constants.FSL_DCT_COEFFICIENTS, constants.FSL_DCT_COEFFICIENTS,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment