help > Error when reading slice times from BIDS json during prerocessing
Showing 1-4 of 4 posts
Display:
Results per page:
Apr 21, 2025  05:04 PM | Dmitry Sinitsyn
Error when reading slice times from BIDS json during prerocessing
Hello everyone,

In the GUI of CONN 22v2407, I imported images from DICOM and tried to run the default prerocessing pipeline, selecting the option to read slice times from the BIDS json file. This file was successfully created upon import and contained the relevant field:

  "SliceTiming": [

  1.11,

  0,

  0.74,

  0.0925,

  0.8325,

. . .

During prerocessing, the following error occured:

Undefined function 'mtimes' for input arguments of type 'cell'.

Error in conn_setup_preproc (line 2618)

 else sliceorder=1000*reshape(str,1,[]); % (ms)

I tried to debug this, and in the file conn_setup_preproc.m made a break point at line 2602:

str=conn_jsonread(matlabbatch{end}.spm.temporal.st.scans{1}{1},'SliceTiming');

The resulting variable was a cell array:

K>> str

str =

  64×1 cell array

    {[1.1100]}

    {[     0]}

    {[0.7400]}

    {[0.0925]}

    {[0.8325]}

. . .

This caused the above-mentioned error in line 2618 with code:

else sliceorder=1000*reshape(str,1,[]); % (ms)

I suppose this line expects str to be a numerical array, not a cell array. So my guess is that there is a bug in function conn_jsonread.

Can anyone confirm this or explain what I may be doing wrong?

Best,

Dmitry
Apr 21, 2025  10:04 PM | Alfonso Nieto-Castanon - Boston University
RE: Error when reading slice times from BIDS json during prerocessing

Hi Dmitry,


That is strange indeed, could you please attach your .json file to help replicate this issue?


Thanks


Alfonso


Originally posted by Dmitry Sinitsyn:



Hello everyone,

In the GUI of CONN 22v2407, I imported images from DICOM and tried to run the default prerocessing pipeline, selecting the option to read slice times from the BIDS json file. This file was successfully created upon import and contained the relevant field:

  "SliceTiming": [

  1.11,

  0,

  0.74,

  0.0925,

  0.8325,

. . .

During prerocessing, the following error occured:

Undefined function 'mtimes' for input arguments of type 'cell'.

Error in conn_setup_preproc (line 2618)

 else sliceorder=1000*reshape(str,1,[]); % (ms)

I tried to debug this, and in the file conn_setup_preproc.m made a break point at line 2602:

str=conn_jsonread(matlabbatch{end}.spm.temporal.st.scans{1}{1},'SliceTiming');

The resulting variable was a cell array:

K>> str

str =

  64×1 cell array

    {[1.1100]}

    {[     0]}

    {[0.7400]}

    {[0.0925]}

    {[0.8325]}

. . .

This caused the above-mentioned error in line 2618 with code:

else sliceorder=1000*reshape(str,1,[]); % (ms)

I suppose this line expects str to be a numerical array, not a cell array. So my guess is that there is a bug in function conn_jsonread.

Can anyone confirm this or explain what I may be doing wrong?

Best,

Dmitry


 

Apr 22, 2025  07:04 AM | Dmitry Sinitsyn
RE: Error when reading slice times from BIDS json during prerocessing

Hi Alfonso,
Thank you for your reply. In the attached archive, the file 'run-8.json' is the one previously discussed.
I also want to ask a related question. When I tried to use the 2nd default pipeline including the fieldmap-based distortion correction, I got the following errors:
warning: unable to find EchoTime1 or EchoTime information in [. . .]\conn_project01\data\BIDS\sourcedata\sub-0001\run-6.nii
warning: unable to find PhaseEncodingDirection information in [. . . ]\conn_project01\data\BIDS\sourcedata\sub-0001\ref_run-8.nii
ERROR DESCRIPTION:
Error using conn_setup_preproc
insufficient information for vdm creation. Skipping subject 1 session 1...
The protocols are as follows:
run-6 - fieldmap amplitude (2 images in one file)
run-7 - fieldmap phase
run-8 - fMRI
Consistent with the above error message, I did not find EchoTime in run-6.json, although run-7.json has a field "EchoTime": 0.0074 (the larger of the two echo times).
Also in the file run-8.json, I did not find PhaseEncodingDirection.
I could get around this fieldmap issue by converting from DICOM to nii and json by the program MRIcroGL. It produced JSONs with all the above-mentioned fields, and I am attaching them for reference (files with long names denoting protocols).
It would be good if this could be fixed in CONN, so that there is no need to switch between programs.
Best,
Dmitry

Attachment: JSONs.zip
Apr 29, 2025  06:04 AM | Dmitry Sinitsyn
RE: Error when reading slice times from BIDS json during prerocessing

Hi Alfonso,


In my last reply, I did not press the button 'quote and reply'. I thought this may have caused you not to be notified about the message. If so, please see my previous post.


Thanks


Dmitry


 


Originally posted by Alfonso Nieto-Castanon:



Hi Dmitry,


That is strange indeed, could you please attach your .json file to help replicate this issue?


Thanks


Alfonso


Originally posted by Dmitry Sinitsyn:



Hello everyone,

In the GUI of CONN 22v2407, I imported images from DICOM and tried to run the default prerocessing pipeline, selecting the option to read slice times from the BIDS json file. This file was successfully created upon import and contained the relevant field:

  "SliceTiming": [

  1.11,

  0,

  0.74,

  0.0925,

  0.8325,

. . .

During prerocessing, the following error occured:

Undefined function 'mtimes' for input arguments of type 'cell'.

Error in conn_setup_preproc (line 2618)

 else sliceorder=1000*reshape(str,1,[]); % (ms)

I tried to debug this, and in the file conn_setup_preproc.m made a break point at line 2602:

str=conn_jsonread(matlabbatch{end}.spm.temporal.st.scans{1}{1},'SliceTiming');

The resulting variable was a cell array:

K>> str

str =

  64×1 cell array

    {[1.1100]}

    {[     0]}

    {[0.7400]}

    {[0.0925]}

    {[0.8325]}

. . .

This caused the above-mentioned error in line 2618 with code:

else sliceorder=1000*reshape(str,1,[]); % (ms)

I suppose this line expects str to be a numerical array, not a cell array. So my guess is that there is a bug in function conn_jsonread.

Can anyone confirm this or explain what I may be doing wrong?

Best,

Dmitry