One giant json config file is hard to inspect. Breaking rules into their own file makes debuging more managable. And we can add comments.
- change e.g.
LunaHabit/SEFieldMap.json
- run
./bundler.py
(ormake
, seeMakefile
for bundler.py syntax) - upload bundle to flywheel (e.g
fw upload LunaHabit_curate.json fw://mrrc/playground
) - rerun BIDS.
./run_curate-gear.py
. prints log, writes to/tmp/nii.csv
. - look at output:
grep nii.gz /tmp/nii.csv| cut -d, -f5,6,9|column -ts,
- repeat
As of 2024-12, fw-template-check
is out-of-date with upstream curate-bids
. Use the old version like (likely in a dedicate python virtual machine):
pip install git+https://gitlab.com/will.foran/curate-bids.git@check-cli-old
fw-template-check -t LunaHabit_curate.json "33 - dMRI_b0_AP" "37 - dMRI_b0_AP"
33 - dMRI_b0_AP dMRI_b0 sub-{session.info.BIDS.Subject}_acq-b0_epi.nii.gz
37 - dMRI_b0_AP dMRI_b0 sub-{session.info.BIDS.Subject}_acq-b0_epi.nii.gz
intendedFor regex pairs. can be set in ./run_curate-gear.py
https://docs.flywheel.io/Developer_Guides/dev_bids_template_file/
[Watch out for missing currly's and parrens]
Flywheel examples can be found in
https://gitlab.com/flywheel-io/public/bids-client/
within flywheel_bids/templates/flywheel_curated/
"run": {
// bids-client/tests/test_templates_unittest.py
// + always increments?
"$value": "+",
// flywheel_curated/nyu-bair-vfs-project-template.json
"$run_counter": {
"key": "field_map.{file.info.BIDS.Dir}.{file.info.BIDS.Acq}.{file.info.BIDS.Suffix}"
}
},
bids-client/flywheel_bids/supporting_files/templates.py
appears to only update the $run_couter
if the current value is "+"
.
The only place I've found this referenced is in bids-client/tests/test_templates_unittest.py
.
Format can be used with auto_update
defnitiions, espeically for session and subject: definitions.session.{Label,Subject}.auto_update
.
"$format":[{
"$replace": {
"$pattern": "bad",
"$replacement": "good"}
}]
}
"definitions": {
"session": {
"properties": {
"Label": {
"auto_update": {
"$process": true,
"$value": "<session.label>", // this is yyyymmddhhmmss... '<>' is autoformat lowercase + rm spaces; {} is literal value
"$format": [{
"$replace": { // keep only the first 8 digits
"$pattern": "(?<=[0-9]{8}).*",
"$replacement": ""}
}]
}