Skip to content

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.)

@oesteban
Copy link
Contributor

This has bitten me pretty hard; thanks for the initiative.

@effigies effigies changed the base branch from main to dev February 14, 2025 15:14
@effigies
Copy link
Contributor Author

effigies commented Apr 4, 2025

@effigies effigies marked this pull request as ready for review August 28, 2025 14:32
@effigies effigies force-pushed the feat/axiscodes branch 2 times, most recently from 05363a0 to 2f3ba20 Compare August 29, 2025 17:12
@effigies effigies changed the base branch from dev to main September 3, 2025 18:50
@effigies
Copy link
Contributor Author

effigies commented Sep 3, 2025

This is necessary to fully support BIDS 1.10.1. Post-merge reviews are welcome.

@effigies effigies merged commit fd3da41 into bids-standard:main Sep 3, 2025
27 checks passed
@effigies effigies deleted the feat/axiscodes branch September 3, 2025 20:04
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.

2 participants