Skip to content

Commit

Permalink
SCHEMA: Rewrite volume timing mutexes as checks
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Feb 8, 2023
1 parent f3c18b5 commit f0e1b1c
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 51 deletions.
58 changes: 58 additions & 0 deletions src/schema/rules/checks/func.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,61 @@ PhaseSuffixDeprecated:
- datatype == "func"
checks:
- suffix != "phase"

### The following rules implement the functional imaging acquisition timing rules
### For the sake of informative errors, they are implemented in more rules than
### strictly necessary
### The selectors/checks are implemented with the least likely case in the selector
### for efficiency.

# 178
VolumeTimingRepetitionTimeMutex:
issue:
code: VOLUME_TIMING_AND_REPETITION_TIME_MUTUALLY_EXCLUSIVE
message: |
The fields 'VolumeTiming' and 'RepetitionTime' for this file are mutually exclusive.
Choose 'RepetitionTime' when the same repetition time is used for all volumes,
or 'VolumeTiming' when variable times are used.
level: error
selectors:
- type(sidecar.VolumeTiming) != null
checks:
- type(sidecar.RepetitionTime) == null

RepetitionTimeAcquisitionDurationMutex:
issue:
code: REPETITION_TIME_AND_ACQUISITION_DURATION_MUTUALLY_EXCLUSIVE
message: |
The fields 'RepetitionTime' and 'AcquisitionDuration' for this file are mutually exclusive.
To specify acquisition duration, use 'SliceTiming' or 'DelayTime'
(RepetitionTime - AcquisitionDuration).
level: error
selectors:
- type(sidecar.AcquistionDuration) != null
checks:
- type(sidecar.RepetitionTime) == null

VolumeTimingDelayTimeMutex:
issue:
code: VOLUME_TIMING_AND_DELAY_TIME_MUTUALLY_EXCLUSIVE
message: |
The fields 'VolumeTiming' and 'DelayTime' for this file are mutually exclusive.
To specify acquisition duration, use 'AcquisitionDuration' or 'SliceTiming'.
level: error
selectors:
- type(sidecar.VolumeTiming) != null
checks:
- type(sidecar.DelayTime) == null

SliceTimingAcquisitionDurationMutex:
issue:
code: SLICE_TIMING_AND_DURATION_MUTUALLY_EXCLUSIVE
message: |
'SliceTiming' is defined for this file.
Neither 'DelayTime' nor 'AcquisitionDuration' may be defined in addition.
level: error
selectors:
- type(sidecar.SliceTiming) != null
checks:
- type(sidecar.AcquisitionDuration) == null
- type(sidecar.DelayTime) == null
51 changes: 0 additions & 51 deletions src/schema/rules/sidecars/func.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,57 +63,6 @@ MRIFuncTimingParameters:
The field 'VolumeTiming' requires 'AcquisitionDuration' or 'SliceTiming' to be defined.
DelayAfterTrigger: recommended

# The mutual exclusion table, spread across 5 definitions
# NOTE: This introduces a prohibited level
MRIFuncTimingParametersMutualExclusion1:
selectors:
- modality == "mri"
- datatype == "func"
- '"RepetitionTime" in sidecar'
fields:
AcquisitionDuration: prohibited
VolumeTiming: prohibited

MRIFuncTimingParametersMutualExclusion2:
selectors:
- modality == "mri"
- datatype == "func"
- '"SliceTiming" in sidecar'
- '"VolumeTiming" in sidecar'
fields:
RepetitionTime: prohibited
DelayTime: prohibited

MRIFuncTimingParametersMutualExclusion3:
selectors:
- modality == "mri"
- datatype == "func"
- '"AcquisitionDuration" in sidecar'
- '"VolumeTiming" in sidecar'
fields:
RepetitionTime: prohibited
DelayTime: prohibited

MRIFuncTimingParametersMutualExclusion4:
selectors:
- modality == "mri"
- datatype == "func"
- '"RepetitionTime" in sidecar'
- '"SliceTiming" in sidecar'
fields:
AcquisitionDuration: prohibited
VolumeTiming: prohibited

MRIFuncTimingParametersMutualExclusion5:
selectors:
- modality == "mri"
- datatype == "func"
- '"RepetitionTime" in sidecar'
- '"DelayTime" in sidecar'
fields:
AcquisitionDuration: prohibited
VolumeTiming: prohibited

# fMRI task information
MRIFuncTaskInformation:
selectors:
Expand Down

0 comments on commit f0e1b1c

Please sign in to comment.