From d38ffc7a7ec5b8276cdf73840a20ccfbe5dd4dce Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Mon, 29 Jul 2024 22:36:45 -0400 Subject: [PATCH 1/7] fix(schema): Limit EVENTS_TSV_MISSING to data files --- src/schema/rules/checks/events.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/schema/rules/checks/events.yaml b/src/schema/rules/checks/events.yaml index 1f0f57a123..a5fa9ac5fd 100644 --- a/src/schema/rules/checks/events.yaml +++ b/src/schema/rules/checks/events.yaml @@ -13,6 +13,7 @@ EventsMissing: - '"task" in entities' - '!match(entities.task, "rest")' - suffix != "events" + - extension != ".json" checks: - '"events" in associations' From 881739b5143c807741cd41dcaf54dc041b93bc28 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Mon, 29 Jul 2024 23:05:33 -0400 Subject: [PATCH 2/7] fix(schema): Move VolumeTiming check into checks --- src/schema/rules/checks/func.yaml | 11 +++++++++++ src/schema/rules/sidecars/func.yaml | 4 ---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/schema/rules/checks/func.yaml b/src/schema/rules/checks/func.yaml index cce740a1ec..a908bfa345 100644 --- a/src/schema/rules/checks/func.yaml +++ b/src/schema/rules/checks/func.yaml @@ -127,3 +127,14 @@ SliceTimingAcquisitionDurationMutex: checks: - type(sidecar.AcquisitionDuration) == "null" - type(sidecar.DelayTime) == "null" + +VolumeTimingMissingAcquisitionDuration: + issue: + code: VOLUME_TIMING_MISSING_ACQUISITION_DURATION + message: | + The field 'VolumeTiming' requires 'AcquisitionDuration' or 'SliceTiming' to be defined. + level: error + selectors: + - type(sidecar.VolumeTiming) != "null" + checks: + - '"SliceTiming" in sidecar || "AcquisitionDuration" in sidecar' diff --git a/src/schema/rules/sidecars/func.yaml b/src/schema/rules/sidecars/func.yaml index dbb4d714e0..7192886407 100644 --- a/src/schema/rules/sidecars/func.yaml +++ b/src/schema/rules/sidecars/func.yaml @@ -57,10 +57,6 @@ MRIFuncTimingParameters: required for sequences that are described with the `VolumeTiming` field and that do not have the `SliceTiming` field set to allow for accurate calculation of "acquisition time" - issue: - code: VOLUME_TIMING_MISSING_ACQUISITION_DURATION - message: | - The field 'VolumeTiming' requires 'AcquisitionDuration' or 'SliceTiming' to be defined. DelayAfterTrigger: recommended # fMRI task information From b52a1dd436ad4885b9bf70e93ce2ac886c6e220f Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Mon, 29 Jul 2024 23:08:14 -0400 Subject: [PATCH 3/7] fix(schema): Associated file checks only apply to data files --- src/schema/rules/checks/fmap.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/schema/rules/checks/fmap.yaml b/src/schema/rules/checks/fmap.yaml index b6e8e621cc..b80e40c6a9 100644 --- a/src/schema/rules/checks/fmap.yaml +++ b/src/schema/rules/checks/fmap.yaml @@ -22,6 +22,7 @@ FmapFieldmapWithoutMagnitude: level: error selectors: - suffix == "fieldmap" + - match(extension, '\.nii(\.gz)?$') checks: - '"magnitude" in associations' @@ -34,6 +35,7 @@ FmapPhasediffWithoutMagnitude: level: warning selectors: - suffix == "phasediff" + - match(extension, '\.nii(\.gz)?$') checks: - '"magnitude1" in associations' From 39cea69d954e06a589c67aa0ddc816991e37f51d Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Mon, 29 Jul 2024 23:27:58 -0400 Subject: [PATCH 4/7] fix(schema): Improve targeting of B0Field* recommendations --- .../magnetic-resonance-imaging-data.md | 6 +++++- src/schema/rules/sidecars/mri.yaml | 11 +++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/modality-specific-files/magnetic-resonance-imaging-data.md b/src/modality-specific-files/magnetic-resonance-imaging-data.md index d5e8e6abc9..a4e6c1fc7a 100644 --- a/src/modality-specific-files/magnetic-resonance-imaging-data.md +++ b/src/modality-specific-files/magnetic-resonance-imaging-data.md @@ -160,7 +160,11 @@ The definitions of the fields specified in these tables may be found in A guide for using macros can be found at https://github.com/bids-standard/bids-specification/blob/master/macros_doc.md --> -{{ MACROS___make_sidecar_table("mri.MRIEchoPlanarImagingAndB0Mapping") }} +{{ MACROS___make_sidecar_table([ + "mri.MRIB0FieldIdentifier", + "mri.MRIEchoPlanarImagingAndB0FieldSource", + ]) +}} #### Tissue description diff --git a/src/schema/rules/sidecars/mri.yaml b/src/schema/rules/sidecars/mri.yaml index c9b94ec83b..49de388ea3 100644 --- a/src/schema/rules/sidecars/mri.yaml +++ b/src/schema/rules/sidecars/mri.yaml @@ -300,11 +300,18 @@ MRIAnatomicalLandmarks: fields: AnatomicalLandmarkCoordinates__mri: recommended -MRIEchoPlanarImagingAndB0Mapping: +MRIB0FieldIdentifier: selectors: - - modality == "mri" + - datatype == 'fmap' + - match(extension, '\.nii(\.gz)?$') fields: B0FieldIdentifier: recommended + +MRIEchoPlanarImagingAndB0FieldSource: + selectors: + - intersects(datatype, ['dwi', 'func', 'perf']) + - intersects(dataset.datatypes, ['fmap']) + fields: B0FieldSource: recommended MRIInstitutionInformation: From 84acbd30d865f3c44280c38af6b544a3da2dccc1 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Mon, 29 Jul 2024 23:28:15 -0400 Subject: [PATCH 5/7] fix(schema): Improve targeting of MRIAnatomicalLandmarks --- src/schema/rules/sidecars/mri.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/schema/rules/sidecars/mri.yaml b/src/schema/rules/sidecars/mri.yaml index 49de388ea3..1dce5f67af 100644 --- a/src/schema/rules/sidecars/mri.yaml +++ b/src/schema/rules/sidecars/mri.yaml @@ -296,7 +296,8 @@ MRISliceAcceleration: MRIAnatomicalLandmarks: selectors: - - modality == "mri" + - datatype == "anat" + - intersects(dataset.datatypes, ["meg"]) fields: AnatomicalLandmarkCoordinates__mri: recommended From fc196e7bddb590d8f8fad76034ab2ec4a595cc90 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Tue, 30 Jul 2024 09:52:45 -0400 Subject: [PATCH 6/7] fix(schema): Check sidecars of data files only --- src/schema/rules/checks/fmap.yaml | 1 + src/schema/rules/checks/nirs.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/src/schema/rules/checks/fmap.yaml b/src/schema/rules/checks/fmap.yaml index b80e40c6a9..199b6e44b3 100644 --- a/src/schema/rules/checks/fmap.yaml +++ b/src/schema/rules/checks/fmap.yaml @@ -9,6 +9,7 @@ EchoTime12DifferenceUnreasonable: level: error selectors: - suffix == "phasediff" + - match(extension, '\.nii(\.gz)?$') checks: - sidecar.EchoTime2 - sidecar.EchoTime1 >= 0.0001 - sidecar.EchoTime2 - sidecar.EchoTime1 <= 0.01 diff --git a/src/schema/rules/checks/nirs.yaml b/src/schema/rules/checks/nirs.yaml index 3ec07ce1d2..310ae78a47 100644 --- a/src/schema/rules/checks/nirs.yaml +++ b/src/schema/rules/checks/nirs.yaml @@ -10,6 +10,7 @@ NIRSChannelCount: selectors: - datatype == "nirs" - suffix == "nirs" + - match(extension, '\.nii(\.gz)?$') checks: - | sidecar.NIRSChannelCount From c0966c7732441897243c5490ada736e86a7dada0 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Tue, 30 Jul 2024 09:53:52 -0400 Subject: [PATCH 7/7] fix(schema): NIRS SamplingFrequency check should look in sidecar --- src/schema/rules/checks/nirs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/schema/rules/checks/nirs.yaml b/src/schema/rules/checks/nirs.yaml index 310ae78a47..e4cabe3291 100644 --- a/src/schema/rules/checks/nirs.yaml +++ b/src/schema/rules/checks/nirs.yaml @@ -2,7 +2,7 @@ NASamplingFreq: selectors: - suffix == "nirs" - - samplingFrequency == "n/a" + - sidecar.SamplingFrequency == "n/a" checks: - associations.channels.sampling_frequency != null