Skip to content

Commit

Permalink
Finally got it to pull PhotometricInterpretation but doesn't work for…
Browse files Browse the repository at this point in the history
… fieldmaps
  • Loading branch information
mtnhuck authored and mtnhuck committed Jan 15, 2018
1 parent ef32caf commit 80ee7ff
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bids2nda/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,9 @@ def run(args):
dict_append(image03_dict, 'mri_echo_time_pd', metadata.get("EchoTime", ""))
dict_append(image03_dict, 'flip_angle', metadata.get("FlipAngle", ""))
dict_append(image03_dict, 'receive_coil', metadata.get("ReceiveCoilName", ""))
dict_append(image03_dict, 'image_slice_thickness', metadata.get("global.const.SliceThickness", ""))
dict_append(image03_dict, 'photomet_interpret', metadata.get("global.const.PhotometricInterpretation", ""))

plane = metadata.get("ImageOrientationPatient")

plane = metadata.get("ImageOrientationPatient","")
get_orientation = lambda place: ['Axial','Coronal','Sagittal'][np.argmax(plane[:3])]
dict_append(image03_dict, 'image_orientation.',get_orientation(plane))
dict_append(image03_dict, 'transformation_performed', 'Yes')
Expand Down Expand Up @@ -201,6 +200,8 @@ def run(args):
dict_append(image03_dict, 'image_resolution1', nii.header.get_zooms()[0])
dict_append(image03_dict, 'image_resolution2', nii.header.get_zooms()[1])
dict_append(image03_dict, 'image_resolution3', nii.header.get_zooms()[2])
dict_append(image03_dict, 'image_slice_thickness', nii.header.get_zooms()[2])
dict_append(image03_dict, 'photomet_interpret', metadata.get("global",{}).get("const",{}).get("PhotometricInterpretation"),""))
if len(nii.shape) > 3:
image_resolution4 = nii.header.get_zooms()[3]
else:
Expand Down

1 comment on commit 80ee7ff

@yarikoptic
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, so you didn't see the branch with my changes.

Please sign in to comment.