ERROR IN DPABISurf: Repetition time did not match between the scan's header and the associated JSON metadata file.

Submitted by Zeqiang Linli on

Dear Dr. Yan

I encountered an error when I ran my data (not have DICOM data, start with FunImg and T1Img) by using DpabiSurf. The data have passed the data organization checcking and successfully converted into BIDS. But, the error was reported during the “Preprocessing with fmriprep” stage for every subject. The error log is the following figure. Since this is not DICOM data, I manually entered TR=2 (but I confirm that this is correct). I confirmed that I have correctly installed the DpbaiSurf as I have successfully run the DemoData (start from FunRaw) posted on this website.

The BIDS directory orgaization like:

            Sub-**
                ses-1
                        func
                                    *** rest_bold.nii & ***rest_bold.json
                        anat
                                   ***T1w.nii (NOT have .json file)
               ses-2
                        func
                                    *** rest_bold.nii & ***rest_bold.json
The ***rest_bold.json file are all same such as:
{"RepetitionTime":2,"SliceTiming":[0,1,0.055556,1.0556,0.11111,1.1111,0.16667,1.1667,0.22222,1.2222,0.27778,1.2778,0.33333,1.3333,0.38889,1.3889,0.44444,1.4444,0.5,1.5,0.55556,1.5556,0.61111,1.6111,0.66667,1.6667,0.72222,1.7222,0.77778,1.7778,0.83333,1.8333,0.88889,1.8889,0.94444,1.9444],"TaskName":"REST"}

Also, I tried to use the same setting option to run an open access data (not have DICOM data). Unfountatly, the same error was encountered. However, these two datasets can successfully run in DPARSF without involving fmriprep. The problem seems to be I used the FunImg instead of the FunRaw that can not available for my dataset?

I also tried to debug according to the error information (provided weblinks). However, I can’t find what error derives from since the DPABISurf is a user-friendly toolbox that invokes the code from fmriprep what I am not familiar with.

Have you encountered similar problems or other people have also asked about this problem? Do you have any suggestions on this problem? Thank you in advance for any help.

The text vertion of the error log:

Preprocessing with fmriprep, this process is very time consuming, please be patient...
bids-validator@1.4.0

                1: [ERR] Repetition time did not match between the scan's header and the associated JSON metadata file. (code: 12 - REPETITION_TIME_MISMATCH)
                                ./sub-n06/ses-1/func/sub-n06_ses-1_task-rest_bold.nii
                                ./sub-n06/ses-2/func/sub-n06_ses-2_task-rest_bold.nii

                Please visit https://neurostars.org/search?q=REPETITION_TIME_MISMATCH for existing conversations about this issue.

                1: [WARN] The recommended file /README is missing. See Section 03 (Modality agnostic files) of the BIDS specification. (code: 101 - README_FILE_MISSING)

                Please visit https://neurostars.org/search?q=README_FILE_MISSING for existing conversations about this issue.

                2: [WARN] The Authors field of dataset_description.json should contain an array of fields - with one author per field. This was triggered because there are no authors, which will make DOI registration from dataset metadata impossible. (code: 113 - NO_AUTHORS)

                Please visit https://neurostars.org/search?q=NO_AUTHORS for existing conversations about this issue.


        Summary:                  Available Tasks:        Available Modalities:
        271 Files, 37.23GB        REST                    T1w                  
        54 - Subjects                                     bold                 
        2 - Sessions                                                            


                If you have any questions, please post on https://neurostars.org/tags/bids.

/usr/local/miniconda/lib/python3.7/site-packages/bids/layout/validation.py:46: UserWarning: The ability to pass arguments to BIDSLayout that control indexing is likely to be removed in future; possibly as early as PyBIDS 0.14. This includes the `config_filename`, `ignore`, `force_index`, and `index_metadata` arguments. The recommended usage pattern is to initialize a new BIDSLayoutIndexer with these arguments, and pass it to the BIDSLayout via the `indexer` argument.
  warnings.warn("The ability to pass arguments to BIDSLayout that control "
Traceback (most recent call last):
  File "/usr/local/miniconda/bin/fmriprep", line 10, in <module>
    sys.exit(main())
  File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/cli/run.py", line 17, in main
    parse_args()
  File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/cli/parser.py", line 703, in parse_args
    config.environment.exec_env, opts.bids_dir, opts.participant_label
  File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/utils/bids.py", line 155, in validate_input_dir
    subprocess.check_call(['bids-validator', bids_dir, '-c', temp.name])
  File "/usr/local/miniconda/lib/python3.7/subprocess.py", line 341, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['bids-validator', PosixPath('/data/BIDS'), '-c', '/tmp/tmp24g0sogj']' returned non-zero exit status 1.

 

YAN Chao-Gan

Fri, 06/18/2021 - 07:26

The TR info in your NIfTI files (FunImg) were incorrect. You can change the TR info in your NIfTI files.

Or you can try to add one line in DPABISurf_run.m

Line 488:

Command = sprintf('%s --skip_bids_validation', Command);

 

Zeqiang Linli

Mon, 08/09/2021 - 10:44

Dear Prof. Yan, 

I comfirm my TR=2 is correct, since this TR setting have successfully been applied in DPARSF. 

I also tried add a command  one line in DPABISurf_run.m Line 488:

Command = sprintf('%s --skip_bids_validation', Command);

But, Similiar error occurred, the log is as following:

Preprocessing with fmriprep, this process is very time consuming, please be patient...

bids-validator@1.4.0


1: [ERR] Repetition time did not match between the scan's header and the associated JSON metadata file. (code: 12 - REPETITION_TIME_MISMATCH)

./sub-n02/func/sub-n02_task-rest_bold.nii


Please visit https://neurostars.org/search?q=REPETITION_TIME_MISMATCH for existing conversations about this issue.


1: [WARN] The recommended file /README is missing. See Section 03 (Modality agnostic files) of the BIDS specification. (code: 101 - README_FILE_MISSING)


Please visit https://neurostars.org/search?q=README_FILE_MISSING for existing conversations about this issue.


2: [WARN] The Authors field of dataset_description.json should contain an array of fields - with one author per field. This was triggered because there are no authors, which will make DOI registration from dataset metadata impossible. (code: 113 - NO_AUTHORS)


Please visit https://neurostars.org/search?q=NO_AUTHORS for existing conversations about this issue.



        Summary:                  Available Tasks:        Available Modalities: 

        163 Files, 19.21GB        REST                    T1w                   

        54 - Subjects                                     bold                  

        1 - Session                                                             



If you have any questions, please post on https://neurostars.org/tags/bids.


/usr/local/miniconda/lib/python3.7/site-packages/bids/layout/validation.py:46: UserWarning: The ability to pass arguments to BIDSLayout that control indexing is likely to be removed in future; possibly as early as PyBIDS 0.14. This includes the `config_filename`, `ignore`, `force_index`, and `index_metadata` arguments. The recommended usage pattern is to initialize a new BIDSLayoutIndexer with these arguments, and pass it to the BIDSLayout via the `indexer` argument.

  warnings.warn("The ability to pass arguments to BIDSLayout that control "

WARNING: Version 20.2.1 of fMRIPrep (current) has been FLAGGED

(reason: Functional outputs in standard space can be wrong depending on the original data's orientation headers - see https://github.com/nipreps/fmriprep/issues/2307).

That means some severe flaw was found in it and we strongly

discourage its usage.

Traceback (most recent call last):

  File "/usr/local/miniconda/bin/fmriprep", line 10, in <module>

    sys.exit(main())

  File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/cli/run.py", line 17, in main

    parse_args()

  File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/cli/parser.py", line 703, in parse_args

    config.environment.exec_env, opts.bids_dir, opts.participant_label

  File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/utils/bids.py", line 155, in validate_input_dir

    subprocess.check_call(['bids-validator', bids_dir, '-c', temp.name])

  File "/usr/local/miniconda/lib/python3.7/subprocess.py", line 341, in check_call

    raise CalledProcessError(retcode, cmd)

subprocess.CalledProcessError: Command '['bids-validator', PosixPath('/data/BIDS'), '-c', '/tmp/tmp3oezcfe_']' returned non-zero exit status 1.

/usr/local/miniconda/lib/python3.7/site-packages/bids/layout/validation.py:46: UserWarning: The ability to pass arguments to BIDSLayout that control indexing is likely to be removed in future; possibly as early as PyBIDS 0.14. This includes the `config_filename`, `ignore`, `force_index`, and `index_metadata` arguments. The recommended usage pattern is to initialize a new BIDSLayoutIndexer with these arguments, and pass it to the BIDSLayout via the `indexer` argument.

  warnings.warn("The ability to pass arguments to BIDSLayout that control "

You are using fMRIPrep-20.2.1, and a newer version of fMRIPrep is available: 20.2.3.

Please check out our documentation about how and when to upgrade:

https://fmriprep.readthedocs.io/en/latest/faq.html#upgrading

WARNING: Version 20.2.1 of fMRIPrep (current) has been FLAGGED

(reason: Functional outputs in standard space can be wrong depending on the original data's orientation headers - see https://github.com/nipreps/fmriprep/issues/2307).

That means some severe flaw was found in it and we strongly

discourage its usage.

Traceback (most recent call last):

  File "/usr/local/miniconda/bin/fmriprep", line 10, in <module>

    sys.exit(main())

  File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/cli/run.py", line 17, in main

    parse_args()

  File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/cli/parser.py", line 703, in parse_args

    config.environment.exec_env, opts.bids_dir, opts.participant_label

  File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/utils/bids.py", line 155, in validate_input_dir

    subprocess.check_call(['bids-validator', bids_dir, '-c', temp.name])

  File "/usr/local/miniconda/lib/python3.7/subprocess.py", line 341, in check_call

    raise CalledProcessError(retcode, cmd)

subprocess.CalledProcessError: Command '['bids-validator', PosixPath('/data/BIDS'), '-c', '/tmp/tmplty1pjyh']' returned non-zero exit status 1.

Can your recommed other possible solutions for this error? Thank you and best wishes!

Zeqiang

You can try the developing version from github: https://github.com/Chaogan-Yan/DPABI

Remember to use the Remove First X Time Points. 

The program will change the TR info in NIfTI header if they are different from DPABISurf_Pipeline setting.

Line 409 in DPABISurf_run.m

                    %YAN Chao-Gan, 210818. In case the TR info in NIfTI header is incorrect.

                    if Cfg.TR~=0

                        try

                            if Header.private.timing.tspace ~= Cfg.TR

                                Header.private.timing.tspace=Cfg.TR;

                            end

                        catch

                        end

                    end

 

 

Zeqiang Linli

Sat, 08/21/2021 - 14:31

Dear Dr. Yan, Thanks for your solution!  

Although the  developing version of DPARSFSurf cannot seem to  solve this error, the problem was resolved by changing the TR info in NIfTI header for every subject in BIDS directory, which is inspired by the code you gave above. Luckly, the DPARSFSurf can successfully run after changing the TR info. The code I used is as following, which maybe helpful for other people who encounter the same error: 

cd '$analysispath\BIDS' 

dir1 = dir('sub*')
parfor i = 1:length(dir1)
    dir2 = dir([dir1(i).name,'\func\sub*.nii'])
    [Data Header] = y_Read([dir1(i).name,'\func\',dir2.name]);
    Header.private.timing.tspace = 2;   %2 is my TR info
    y_Write(Data,Header,[dir1(i).name,'\func\',dir2.name]);
end

Again, thank you for your expensive time on this problem!

Zeqiang

Attachment Size
ERROR LOG 65.7 KB