minor bug in CBIG_preproc_convert_input_BIDS.csh

11 views
Skip to first unread message

abid.y....@gmail.com

unread,
Aug 19, 2024, 5:03:30 PM8/19/24
to CBIG users
Hi Yan Hongwei,

When I put in:
$CBIG_CODE_DIR/stable_projects/preprocessing/CBIG_fMRI_Preproc2016/CBIG_preproc_convert_input_BIDS.csh -d /home/aqureshi2/work/Research/Projects/Coma/scanner_testing/CBIG/BIDS -s Jacob -ses 1 -stem "task-BOLD"

The following error occured with each .json file:
[convert_input_BIDS]: logfile = /home/aqureshi2/work/Research/Projects/Coma/scanner_testing/CBIG/BIDS/derivatives/CBIG_preproc_convert_input_BIDS//sub-Jacob_ses-1/logs/CBIG_preproc_convert_input_BIDS.log

(standard_in) 1: illegal character: M

(standard_in) 1: illegal character: R

(standard_in) 1: syntax error

[WARNING]: TR from /home/aqureshi2/work/Research/Projects/Coma/scanner_testing/CBIG/BIDS/sub-Jacob/ses-1/func/sub-Jacob_ses-1_task-BOLD10_acq-4ME2p5_echo-1_bold.json is not consistent with TR from /home/aqureshi2/work/Research/Projects/Coma/scanner_testing/CBIG/BIDS/sub-Jacob/ses-1/func/sub-Jacob_ses-1_task-BOLD10_acq-4ME2p5_echo-1_bold.nii.gz header. TR from json: MR, TR from image header: 1540.  Will follow TR from image header.

(standard_in) 1: illegal character: M

(standard_in) 1: illegal character: R

(standard_in) 1: syntax error


But the .json file was correct:

cat $json_file

{

"Modality": "MR",

"MagneticFieldStrength": 3,

"ImagingFrequency": 123.263256,

.... 

"RepetitionTime": 1.54,

...

}


ChatGPT suggested changing line 164 from:

cat $json_file | tr -d '\n' | awk -F '[:,}]' '/"RepetitionTime"/{print $2}' | tr -d '"'

to this:

cat $json_file | tr -d '\n' | awk -F'"RepetitionTime"[ \t]*:[ \t]*' '{print $2}' | awk -F'[,}]' '{print $1}' | tr -d '"'

And it fixed the problem. 

I am not sure if this was specific to my .json file, or whether it would apply universally. But I thought I'd let you know. 

Thanks,

Abid


Reply all
Reply to author
Forward
0 new messages