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

[ENH] add support for qMRI json in top dir #1546

Merged
merged 13 commits into from
Feb 27, 2023
68 changes: 66 additions & 2 deletions bids-validator/bids_validator/rules/top_level_rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
"phase1\\.json",
"phase2\\.json",
"fieldmap\\.json",
"TB1DAM\\.json",
"TB1EPI\\.json",
"TB1AFI\\.json",
"TB1TFL\\.json",
"TB1RFM\\.json",
"TB1SRGE\\.json",
"RB1COR\\.json",
Remi-Gau marked this conversation as resolved.
Show resolved Hide resolved
"events\\.json",
"scans\\.json",
"samples\\.json",
Expand Down Expand Up @@ -59,7 +66,7 @@
},

"anat_top": {
"regexp": "^[\\/\\\\](?:ses-[a-zA-Z0-9]+_)?(?:acq-[a-zA-Z0-9]+_)?(?:rec-[a-zA-Z0-9]+_)?(?:run-[0-9]+_)?(@@@_anat_suffixes_@@@)\\.json$",
"regexp": "^[\\/\\\\](?:ses-[a-zA-Z0-9]+_)?(?:acq-[a-zA-Z0-9]+_)?(?:ce-[a-zA-Z0-9]+_)?(?:rec-[a-zA-Z0-9]+_)?(?:run-[0-9]+_)?(@@@_anat_suffixes_@@@)\\.json$",
"tokens": {
"@@@_anat_suffixes_@@@": [
"T1w",
Expand All @@ -77,11 +84,68 @@
"T2star",
"FLASH",
"PDmap",
"photo"
"photo",
"VFA",
"MEGRE",
"MESE",
"IRT1",
"MPM",
"MTS",
"MTR",
"MP2RAGE"
Remi-Gau marked this conversation as resolved.
Show resolved Hide resolved
]
}
},

"VFA_top": {
"regexp": "^[\\/\\\\](?:ses-[a-zA-Z0-9]+_)?(?:acq-[a-zA-Z0-9]+_)?(?:ce-[a-zA-Z0-9]+_)?(?:rec-[a-zA-Z0-9]+_)?(?:run-[0-9]+_)?(?:echo-[0-9]+_)?flip-[0-9]+_(?:part-(mag|phase|real|imag)_)?(@@@_mese_megre_suffixes_@@@)\\.json$",
Remi-Gau marked this conversation as resolved.
Show resolved Hide resolved
"tokens": {
"@@@_mese_megre_suffixes_@@@": ["VFA"]
}
},

"megre_mese_top": {
"regexp": "^[\\/\\\\](?:ses-[a-zA-Z0-9]+_)?(?:acq-[a-zA-Z0-9]+_)?(?:ce-[a-zA-Z0-9]+_)?(?:rec-[a-zA-Z0-9]+_)?(?:run-[0-9]+_)?echo-[0-9]+_(?:part-(mag|phase|real|imag)_)?(@@@_mese_megre_suffixes_@@@)\\.json$",
"tokens": {
"@@@_mese_megre_suffixes_@@@": ["MEGRE", "MESE"]
}
},

"irt1_top": {
"regexp": "^[\\/\\\\](?:ses-[a-zA-Z0-9]+_)?(?:acq-[a-zA-Z0-9]+_)?(?:ce-[a-zA-Z0-9]+_)?(?:rec-[a-zA-Z0-9]+_)?(?:run-[0-9]+_)?inv-[0-9]+_(?:part-(mag|phase|real|imag)_)?(@@@_irt1_suffixes_@@@)\\.json$",
"tokens": {
"@@@_irt1_suffixes_@@@": ["IRT1"]
}
},

"mpm_top": {
"regexp": "^[\\/\\\\](?:ses-[a-zA-Z0-9]+_)?(?:acq-[a-zA-Z0-9]+_)?(?:ce-[a-zA-Z0-9]+_)?(?:rec-[a-zA-Z0-9]+_)?(?:run-[0-9]+_)?(?:echo-[0-9]+_)?(?:flip-[0-9]+_)?mt-(on|off)_(?:part-(mag|phase|real|imag)_)?(@@@_mpm_suffixes_@@@)\\.json$",
"tokens": {
"@@@_mpm_suffixes_@@@": ["MPM"]
}
},

"mts_top": {
"regexp": "^[\\/\\\\](?:ses-[a-zA-Z0-9]+_)?(?:acq-[a-zA-Z0-9]+_)?(?:ce-[a-zA-Z0-9]+_)?(?:rec-[a-zA-Z0-9]+_)?(?:run-[0-9]+_)?(?:echo-[0-9]+_)?flip-[0-9]+_mt-(on|off)_(?:part-(mag|phase|real|imag)_)?(@@@_mts_suffixes_@@@)\\.json$",
"tokens": {
"@@@_mts_suffixes_@@@": ["MTS"]
}
},

"mtr_top": {
"regexp": "^[\\/\\\\](?:ses-[a-zA-Z0-9]+_)?(?:acq-[a-zA-Z0-9]+_)?(?:ce-[a-zA-Z0-9]+_)?(?:rec-[a-zA-Z0-9]+_)?(?:run-[0-9]+_)?mt-(on|off)_(?:part-(mag|phase|real|imag)_)?(@@@_mtr_suffixes_@@@)\\.json$",
"tokens": {
"@@@_mtr_suffixes_@@@": ["MTR"]
}
},

"mp2rage_top": {
"regexp": "^[\\/\\\\](?:ses-[a-zA-Z0-9]+_)?(?:acq-[a-zA-Z0-9]+_)?(?:ce-[a-zA-Z0-9]+_)?(?:rec-[a-zA-Z0-9]+_)?(?:run-[0-9]+_)?(?:echo-[0-9]+_)?(?:flip-[0-9]+_)?(?:inv-[0-9]+_)(?:part-(mag|phase|real|imag)_)?(@@@_mp2rage_suffixes_@@@)\\.json$",
"tokens": {
"@@@_mp2rage_suffixes_@@@": ["MP2RAGE"]
}
},

"dwi_top": {
"regexp": "^[\\/\\\\](?:ses-[a-zA-Z0-9]+_)?(?:acq-[a-zA-Z0-9]+_)?(?:rec-[a-zA-Z0-9]+_)?(?:run-[0-9]+_)?(dwi\\.(?:@@@_dwi_top_ext_@@@)|sbref\\.json)$",
"tokens": {
Expand Down
21 changes: 21 additions & 0 deletions bids-validator/utils/type.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ const rootTop = buildRegExp(top_level_rules.root_top)
const funcTop = buildRegExp(top_level_rules.func_top)
const aslTop = buildRegExp(top_level_rules.asl_top)
const anatTop = buildRegExp(top_level_rules.anat_top)
const vfaTop = buildRegExp(top_level_rules.VFA_top)
const megreTop = buildRegExp(top_level_rules.megre_mese_top)
const irt1Top = buildRegExp(top_level_rules.irt1_top)
const mpmTop = buildRegExp(top_level_rules.mpm_top)
const mtsTop = buildRegExp(top_level_rules.mts_top)
const mtrTop = buildRegExp(top_level_rules.mtr_top)
const mp2rageTop = buildRegExp(top_level_rules.mp2rage_top)
Remi-Gau marked this conversation as resolved.
Show resolved Hide resolved
const dwiTop = buildRegExp(top_level_rules.dwi_top)
const eegTop = buildRegExp(top_level_rules.eeg_top)
const ieegTop = buildRegExp(top_level_rules.ieeg_top)
Expand Down Expand Up @@ -141,6 +148,13 @@ export default {
aslTop.test(path) ||
dwiTop.test(path) ||
anatTop.test(path) ||
vfaTop.test(path) ||
megreTop.test(path) ||
irt1Top.test(path) ||
mpmTop.test(path) ||
mtsTop.test(path) ||
mtrTop.test(path) ||
mp2rageTop.test(path) ||
multiDirFieldmap.test(path) ||
otherTopFiles.test(path) ||
megTop.test(path) ||
Expand All @@ -157,6 +171,13 @@ export default {
aslTop.test(path) ||
dwiTop.test(path) ||
anatTop.test(path) ||
vfaTop.test(path) ||
megreTop.test(path) ||
irt1Top.test(path) ||
mpmTop.test(path) ||
mtsTop.test(path) ||
mtrTop.test(path) ||
mp2rageTop.test(path) ||
multiDirFieldmap.test(path) ||
otherTopFiles.test(path) ||
megTop.test(path) ||
Expand Down