get orientation of image from meta data #4224
Answered
by
rijobro
YingdiZhang
asked this question in
Q&A
-
Thanks for the great job! |
Beta Was this translation helpful? Give feedback.
Answered by
rijobro
May 4, 2022
Replies: 1 comment
-
If you have the affine transformation matrix (e.g., affine = np.eye(4) # or e.g., data["image_meta_dict"]["affine"]
print("".join(nib.aff2axcodes(affine))) This is the relevant bit of code in our transform: https://github.com/Project-MONAI/MONAI/blob/dev/monai/transforms/spatial/array.py#L531. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
YingdiZhang
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you have the affine transformation matrix (e.g.,
data["image_meta_dict"]["affine"]
), you can get the orientation with this:This is the relevant bit of code in our transform: https://github.com/Project-MONAI/MONAI/blob/dev/monai/transforms/spatial/array.py#L531.