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

Fix for images which have a qform but not an sform.

parent c49e1014
No related branches found
No related tags found
No related merge requests found
......@@ -240,12 +240,27 @@ class Nifti(object):
- :data:`~.constants.NIFTI_XFORM_MNI_152`
"""
if code is None: code = 'sform_code'
elif code == 'sform' : code = 'sform_code'
if code == 'sform' : code = 'sform_code'
elif code == 'qform' : code = 'qform_code'
else: raise ValueError('code must be None, sform, or qform')
elif code is not None:
raise ValueError('code must be None, sform, or qform')
if code is not None:
code = self.header[code]
# If a specific code is not
# specified, we check both.
# If the sform is present,
# we return it. Otherwise,
# if the qform is present,
# we return that.
else:
sform_code = self.header['sform_code']
qform_code = self.header['qform_code']
code = self.header[code]
if sform_code != constants.NIFTI_XFORM_UNKNOWN: code = sform_code
elif qform_code != constants.NIFTI_XFORM_UNKNOWN: code = qform_code
# Invalid values
if code > 4: code = constants.NIFTI_XFORM_UNKNOWN
......
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