From 0181150f68c08cd7afa942ae67c35c22cd7bdc74 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 29 May 2024 11:36:55 -0400 Subject: [PATCH] feat(checks): Add check to ensure MatrixSize and nifti_header.dim are consistent --- src/schema/rules/checks/mrs.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/schema/rules/checks/mrs.yaml b/src/schema/rules/checks/mrs.yaml index a38a3007c6..41417feb93 100644 --- a/src/schema/rules/checks/mrs.yaml +++ b/src/schema/rules/checks/mrs.yaml @@ -12,3 +12,18 @@ MRSNiftiConsistency: checks: - sidecar.ResonantNucleus == nifti_header.mrs.ResonantNucleus - sidecar.SpectrometerFrequency == nifti_header.mrs.SpectrometerFrequency + +MRSMatrixSize: + issue: + code: MRS_MATRIX_SIZE + message: | + MatrixSize metadata must match NIfTI header field `dim[1:4]`. + level: error + selectors: + - datatype == "mrs" + - nifti_header + - type(sidecar.MatrixSize) != "null" + checks: + - sidecar.MatrixSize[0] == nifti_header.dim[1] + - sidecar.MatrixSize[1] == nifti_header.dim[2] + - sidecar.MatrixSize[2] == nifti_header.dim[3]