You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def get_readoutdir(metadata):
"""
get readout direction from bids metadata. !!Note that this method only
applies where the nifti orientation is RAS!!
:param metadata: grabbids metadata dict.
:return: unwarp dir in cartesian (world) coordinates.
"""
iopd = metadata['ImageOrientationPatientDICOM']
ped = metadata['InPlanePhaseEncodingDirectionDICOM']
# readout direction is opposite the in plane phase encoding direction
if ped == 'ROW':
readoutvec = iopd[3:]
elif ped == 'COL':
readoutvec = iopd[:3]
else:
raise ValueError('phase encoding direction not recognized: ' + ped)
# convert 3-vector to symbolic unit vector
i = max([0, 1, 2], key=lambda x: abs(readoutvec[x]))
readoutdir = ['x', 'y', 'z'][i]
# TODO: Fix readoutdir algorithm. Arbitratily switched pos to neg for ABCD.
if readoutvec[i] > 0:
readoutdir += '-'
return readoutdir
There should be a field in the sidecar JSONs that just has this information instead of determining it in this roundabout way. We need it to be grabbed from elsewhere for HCP-YA.
Comment from @ericfeczko: If you have the phase encoding direction and the in plane axis, the readout direction can be inferred from the two.
The text was updated successfully, but these errors were encountered:
audreymhoughton
changed the title
Grab Readout Dir from the proper JSON field
Grab Readout Dir from a more intuitive JSON field
Apr 21, 2023
There should be a field in the sidecar JSONs that just has this information instead of determining it in this roundabout way. We need it to be grabbed from elsewhere for HCP-YA.
Comment from @ericfeczko: If you have the phase encoding direction and the in plane axis, the readout direction can be inferred from the two.
The text was updated successfully, but these errors were encountered: