Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Extract image orientation from NIfTI header #112

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

effigies
Copy link
Contributor

For #76 and #79, it would be helpful to have access to the image orientation. This PR starts with a function to determine axis codes from the the image affine.

If we add nifti_header.axis_codes to the context, we could then write #76 as:

NiftiPEDir:
  issue:
    code: NIFTI_PE_DIRECTION_CONSISTENCY
    message: Phase encoding direction is inconsistent with entity
    level: warning
  selectors:
    - type(nifti_header) != "null"
    - intersects([entities.direction], ["AP", "PA", "RL", "LR", "IS", "SI"])
    - sidecar.PhaseEncodingDirection
  checks:
    - |
      entities.direction[2 - length(sidecar.PhaseEncodingDirection)]
      == nifti_header.axis_codes[index(["i", "j", "k"], sidecar.PhaseEncodingDirection[0]]

(Would need to check that check... It's probably being too clever, but it is nice to get it in one.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant