xnatcli cubids¶
Runs CuBIDS on a BIDS dataset produced by xnatcli mriconvert — first cubids add-nifti-info (which annotates JSON sidecars with NIfTI header fields) and then cubids group (which groups acquisitions by their parameters and writes _summary.tsv, _files.tsv, _AcqGrouping.tsv, and _AcqGroupInfo.txt).
- Validates that
--inputis an existing directory and thatINPUT_DIR/<PROJECT>/(the BIDS dataset) exists. The expected layout is the one produced byxnatcli mriconvert—<input>/PROJECT/sub-X/ses-Y/.... - Verifies that
cubidsis onPATH; exits with an error if it is missing. - Creates the output directory
INPUT_DIR/PROJECT-<PROJECT>_cubids/if it does not already exist. If it does, the directory is reused (CuBIDS writes its own outputs into it). - If
INPUT_DIR/<PROJECT>/tmp_dcm2bids/exists (leftover dcm2bids scratch), it is moved out toINPUT_DIR/.<PROJECT>_cubids_stash_tmp_dcm2bids/for the duration of the run so CuBIDS does not scan it, and moved back when the run finishes (success or failure). CuBIDS has no built-in ignore mechanism; it walks the whole BIDS tree. - Invokes
cubids add-nifti-info <bids_dir>without--use-datalad(datalad is disabled by default in CuBIDS), so the BIDS dataset itself is mutated in place to add NIfTI header info to sidecars. - Invokes
cubids group <bids_dir> v0, which writesv0_summary.tsv,v0_files.tsv,v0_AcqGrouping.tsv, andv0_AcqGroupInfo.txtintoINPUT_DIR/<PROJECT>/code/CuBIDS/. - On a successful
group, theINPUT_DIR/<PROJECT>/code/CuBIDS/directory is merged intoINPUT_DIR/PROJECT-<PROJECT>_cubids/CuBIDS/(existing files with the same name are overwritten; unrelated files in the destination are left alone) and the source is removed. IfINPUT_DIR/<PROJECT>/code/is empty afterwards, it is also removed. - If
add-nifti-infoexits non-zero,groupis skipped and the command exits1. Otherwise the exit code is0if both steps succeeded and1ifgroupfailed.
For example, if you ran xnatcli mriconvert -i DOWNLOAD_DIR -p MYPROJ -o /data/bids -c config.json, the BIDS dataset lives at /data/bids/MYPROJ/, and xnatcli cubids -i /data/bids -p MYPROJ writes CuBIDS outputs to /data/bids/PROJECT-MYPROJ_cubids/CuBIDS/v0_*.tsv.
| Argument | Description |
|---|---|
-i, --input |
Required. Parent directory holding the BIDS dataset at INPUT_DIR/PROJECT/ (i.e., the output of xnatcli mriconvert). The CuBIDS output subdirectory is created here. |
-p, --project |
Required. Project directory name under INPUT_DIR identifying the BIDS dataset to process. |
-l, --log |
Optional. Write a per-step log CSV to INPUT_DIR/PROJECT-<PROJECT>_cubids/log/cubids_<YYYYMMDD_HHMMSS>_log.csv with header DATESTAMP,PROJECT,STEP,STATUS. One row per CuBIDS step (add-nifti-info, group), each with STATUS of COMPLETE or FAILURE. |