get_image_orientation
- bidsaid.metadata.get_image_orientation(nifti_file_or_img)[source]
Get the image orientation.
Parameters
- nifti_file_or_img
str,Path, orNifti1Image, default=None Path to the NIfTI file or a NIfTI image.
Returns
- tuple[dict[str, str], tuple[str, str, str]]:
A tuple consisting of a dictionary mapping the voxel dimension to its starting and ending anatomical location (from 0 to N) and a tuple of the image orientation.
Note
The reverse direction (N to 0) is just {voxel dimension}- (e.g. “i-” in RAS orientation is “R -> L”).
Examples
>>> from bidsaid.simulate import simulate_nifti_image >>> from bidsaid.metadata import get_image_orientation >>> img = simulate_nifti_image((10, 10, 10, 10)) >>> get_image_orientation(img) ({"i": "L -> R", "j": "P -> A", "k": "I -> S"}, ("R", "A", "S"))
References
Weber, D. (n.d.). MRI orientation notes. https://eeg.sourceforge.net/mri_orientation_notes.html
Orientation and Voxel-Order Terminology: RAS, LAS, LPI, RPI, XYZ and All That. (n.d.). Www.grahamwideman.com. http://www.grahamwideman.com/gw/brain/orientation/orientterms.htm
- nifti_file_or_img