Skip to content

Commit b1be676

Browse files
authored
fix(schema): Fix checks to reduce false positives (bids-standard#1878)
* fix(schema): Limit EVENTS_TSV_MISSING to data files * fix(schema): Move VolumeTiming check into checks * fix(schema): Associated file checks only apply to data files * fix(schema): Improve targeting of B0Field* recommendations * fix(schema): Improve targeting of MRIAnatomicalLandmarks * fix(schema): Check sidecars of data files only * fix(schema): NIRS SamplingFrequency check should look in sidecar
1 parent 6bd4458 commit b1be676

File tree

7 files changed

+33
-9
lines changed

7 files changed

+33
-9
lines changed

src/modality-specific-files/magnetic-resonance-imaging-data.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,11 @@ The definitions of the fields specified in these tables may be found in
160160
A guide for using macros can be found at
161161
https://github.com/bids-standard/bids-specification/blob/master/macros_doc.md
162162
-->
163-
{{ MACROS___make_sidecar_table("mri.MRIEchoPlanarImagingAndB0Mapping") }}
163+
{{ MACROS___make_sidecar_table([
164+
"mri.MRIB0FieldIdentifier",
165+
"mri.MRIEchoPlanarImagingAndB0FieldSource",
166+
])
167+
}}
164168

165169
#### Tissue description
166170

src/schema/rules/checks/events.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ EventsMissing:
1313
- '"task" in entities'
1414
- '!match(entities.task, "rest")'
1515
- suffix != "events"
16+
- extension != ".json"
1617
checks:
1718
- '"events" in associations'
1819

src/schema/rules/checks/fmap.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ EchoTime12DifferenceUnreasonable:
99
level: error
1010
selectors:
1111
- suffix == "phasediff"
12+
- match(extension, '\.nii(\.gz)?$')
1213
checks:
1314
- sidecar.EchoTime2 - sidecar.EchoTime1 >= 0.0001
1415
- sidecar.EchoTime2 - sidecar.EchoTime1 <= 0.01
@@ -22,6 +23,7 @@ FmapFieldmapWithoutMagnitude:
2223
level: error
2324
selectors:
2425
- suffix == "fieldmap"
26+
- match(extension, '\.nii(\.gz)?$')
2527
checks:
2628
- '"magnitude" in associations'
2729

@@ -34,6 +36,7 @@ FmapPhasediffWithoutMagnitude:
3436
level: warning
3537
selectors:
3638
- suffix == "phasediff"
39+
- match(extension, '\.nii(\.gz)?$')
3740
checks:
3841
- '"magnitude1" in associations'
3942

src/schema/rules/checks/func.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,14 @@ SliceTimingAcquisitionDurationMutex:
127127
checks:
128128
- type(sidecar.AcquisitionDuration) == "null"
129129
- type(sidecar.DelayTime) == "null"
130+
131+
VolumeTimingMissingAcquisitionDuration:
132+
issue:
133+
code: VOLUME_TIMING_MISSING_ACQUISITION_DURATION
134+
message: |
135+
The field 'VolumeTiming' requires 'AcquisitionDuration' or 'SliceTiming' to be defined.
136+
level: error
137+
selectors:
138+
- type(sidecar.VolumeTiming) != "null"
139+
checks:
140+
- '"SliceTiming" in sidecar || "AcquisitionDuration" in sidecar'

src/schema/rules/checks/nirs.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
NASamplingFreq:
33
selectors:
44
- suffix == "nirs"
5-
- samplingFrequency == "n/a"
5+
- sidecar.SamplingFrequency == "n/a"
66
checks:
77
- associations.channels.sampling_frequency != null
88

99
NIRSChannelCount:
1010
selectors:
1111
- datatype == "nirs"
1212
- suffix == "nirs"
13+
- match(extension, '\.nii(\.gz)?$')
1314
checks:
1415
- |
1516
sidecar.NIRSChannelCount

src/schema/rules/sidecars/func.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ MRIFuncTimingParameters:
5757
required for sequences that are described with the `VolumeTiming`
5858
field and that do not have the `SliceTiming` field set to allow for
5959
accurate calculation of "acquisition time"
60-
issue:
61-
code: VOLUME_TIMING_MISSING_ACQUISITION_DURATION
62-
message: |
63-
The field 'VolumeTiming' requires 'AcquisitionDuration' or 'SliceTiming' to be defined.
6460
DelayAfterTrigger: recommended
6561

6662
# fMRI task information

src/schema/rules/sidecars/mri.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,15 +296,23 @@ MRISliceAcceleration:
296296

297297
MRIAnatomicalLandmarks:
298298
selectors:
299-
- modality == "mri"
299+
- datatype == "anat"
300+
- intersects(dataset.datatypes, ["meg"])
300301
fields:
301302
AnatomicalLandmarkCoordinates__mri: recommended
302303

303-
MRIEchoPlanarImagingAndB0Mapping:
304+
MRIB0FieldIdentifier:
304305
selectors:
305-
- modality == "mri"
306+
- datatype == 'fmap'
307+
- match(extension, '\.nii(\.gz)?$')
306308
fields:
307309
B0FieldIdentifier: recommended
310+
311+
MRIEchoPlanarImagingAndB0FieldSource:
312+
selectors:
313+
- intersects(datatype, ['dwi', 'func', 'perf'])
314+
- intersects(dataset.datatypes, ['fmap'])
315+
fields:
308316
B0FieldSource: recommended
309317

310318
MRIInstitutionInformation:

0 commit comments

Comments
 (0)