Skip to content

Commit 4ed7372

Browse files
committed
feat(schema): Add rule to detect inconsistent PE directions
1 parent aa6af1e commit 4ed7372

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/schema/rules/checks/nifti.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,18 @@ XformCodes0:
4949
- nifti_header != null
5050
checks:
5151
- nifti_header.qform_code != 0 || nifti_header.sform_code != 0
52+
53+
NiftiPEDir:
54+
issue:
55+
code: NIFTI_PE_DIRECTION_CONSISTENCY
56+
message: |
57+
Phase encoding direction is inconsistent with `dir-` entity.
58+
level: warning
59+
selectors:
60+
- type(nifti_header.axis_codes) != "null"
61+
- intersects([entities.direction], ["AP", "PA", "RL", "LR", "SI", "IS"])
62+
- sidecar.PhaseEncodingDirection
63+
checks:
64+
- |
65+
entities.direction[2 - length(sidecar.PhaseEncodingDirection)]
66+
== nifti_header.axis_codes[index(["i", "j", "k"], sidecar.PhaseEncodingDirection[0])]

0 commit comments

Comments
 (0)