Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(schema): Fix checks to reduce false positives #1878

Merged
merged 7 commits into from
Jul 30, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions src/schema/rules/checks/events.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ EventsMissing:
- '"task" in entities'
- '!match(entities.task, "rest")'
- suffix != "events"
- extension != ".json"
checks:
- '"events" in associations'

Expand Down
3 changes: 3 additions & 0 deletions src/schema/rules/checks/fmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,6 +23,7 @@ FmapFieldmapWithoutMagnitude:
level: error
selectors:
- suffix == "fieldmap"
- match(extension, '\.nii(\.gz)?$')
checks:
- '"magnitude" in associations'

Expand All @@ -34,6 +36,7 @@ FmapPhasediffWithoutMagnitude:
level: warning
selectors:
- suffix == "phasediff"
- match(extension, '\.nii(\.gz)?$')
checks:
- '"magnitude1" in associations'

Expand Down
11 changes: 11 additions & 0 deletions src/schema/rules/checks/func.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
3 changes: 2 additions & 1 deletion src/schema/rules/checks/nirs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
NASamplingFreq:
selectors:
- suffix == "nirs"
- samplingFrequency == "n/a"
- sidecar.SamplingFrequency == "n/a"
checks:
- associations.channels.sampling_frequency != null

NIRSChannelCount:
selectors:
- datatype == "nirs"
- suffix == "nirs"
- match(extension, '\.nii(\.gz)?$')
checks:
- |
sidecar.NIRSChannelCount
Expand Down
4 changes: 0 additions & 4 deletions src/schema/rules/sidecars/func.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 11 additions & 3 deletions src/schema/rules/sidecars/mri.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,23 @@ MRISliceAcceleration:

MRIAnatomicalLandmarks:
selectors:
- modality == "mri"
- datatype == "anat"
- intersects(dataset.datatypes, ["meg"])
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:
Expand Down