[RESOLVED] Questions about import_bids

Hello,

I have a few questions regarding import_bids of qunex.

  1. How does import_bids support multi-session data
    I tried to import a bids validated dataset of a single subject that has two scan sessions with anatomical data in the first session, the bids folder structure is:

*–sub-001

  • –ses-1
  •   --anat
    
  •   --fmap
    
  •   --func
    
  • –ses-2
  •   --fmap
    
  •   --func
    

Then I got the following output folder structure inside “sessions” folder:

  • –001
  • –001_1
  • –001_2
  • –archive
  • –BIDS (empty folder)

log file (inside processing/logs/comlogs) showed:
Running import_bids

created BIDS archive folder
identifying files in /myStudy/bids_data/sessions/inbox/BIDS
Inbox type: bids_study
Paths:
BIDSInfo → /myStudy/bids_data/info/bids
BIDSInbox → /myStudy/bids_data/sessions/inbox/BIDS
BIDSArchive → /myStudy/bids_data/sessions/archive/BIDS
mapping files to QuNex bids folders
processing BIDS info folder
creating bids session 001
creating bids session 001_2
creating bids session 001_1
Running map_bids2nii for subject 001

WARNING:
** Unrecognized session!**
This folder [/myStudy/bids_data/sessions/001] does not have a valid matching BIDS session!
Please check your data!

……. (Running map_bids2nii for subject 001, session 1 and session 2 were successful)

And at the end of the log file:
===> ERROR in completing import_bids:
Some actions failed
** Please check report!**

while the log file in “processing/logs/runlogs” showed:

Generated by QuNex 0.94.14

qunex import_bids
–sessionsfolder=“/myStudy/bids_data/sessions”
–inbox=“/myStudy/bids_data/sessions/inbox/BIDS”
–action=“copy”
–overwrite=“yes”
–archive=“leave”
–fileinfo=“full”
ERROR running import_bids

However, if I change the bids folder structure to the following before running “import_bids” by moving anat folder from ses-1 up one level to directly under the subject folder as:

*–sub-001

  • –anat
  • –ses-1
  •   --fmap
    
  •   --func
    
  • –ses-2
  •   --fmap
    
  •   --func
    

Then the import went smoothly without any warning message or error message, and the folder [/myStudy/bids_data/sessions/001] previously reported error on was not created at all.
I wonder why import_bids worked this way.

  1. I wonder how to run qunex pipeline on the imported bids data, especially multiple session together (as the example here for sessions/001-1 and sessions/001-2 together, as there is only anatomical data in the first session)?

After the import, under folder “sessions":
–001-1

  • –behavior*
  • –bids*
  • –nii*
  • session.txt*

–001-2

  • –behavior*
  • –bids*
  • –nii*
  • session.txt*

there are the copied and renamed nifty files in the “nii” folder, the original bids data in the “bids” folder, and a mapping file “session.txt” to show which nifty file in the “nii” folder mapped to T1w, T2w, fieldmap, fMRI data, etc. Is there a documentation page on how to run qunex on the imported data that I can refer to?

By the way, in the “session.txt” file it mentioned there should be a folder named “hcp” as:
hcp: /myStudy/bids_data/sessions/001_1/hcp
But this “hcp” folder was not created at all during the import_bids process. Is that a concern? In the log file (inside folder “processing/logs/runlogs”, it marked importing was successful:

Generated by QuNex 0.94.14

qunex import_bids
–sessionsfolder=“/myStudy/bids_data/sessions”
–inbox=“/myStudy/bids_data/sessions/inbox/BIDS”
–action=“copy”
–overwrite=“yes”
–archive=“leave”
–fileinfo=“full”

===> Successful completion of task

  1. I wonder how the information in the json files of the original bids dataset are used in the qunex processing pipeline?

Many thanks.

Best,
Xuejun

Hi Xuejun,

In addition to the folder structure, qunex also uses bids file names extensively when importing bids studies. Would you be able to share the complete folder structure including file names of the original sub-001 folder (e.g. with the tree command)?

Lining

Thank you, Lining.

Here is the tree information of the “session/inbox/BIDS” folder:
├── dataset_description.json
├── dir-fpe_epi.json
├── dir-rpe_epi.json
├── participants.tsv
├── sub-001
│ ├── ses-1
│ │ ├── anat
│ │ │ ├── sub-001_ses-1_T1w.json
│ │ │ ├── sub-001_ses-1_T1w.nii.gz
│ │ │ ├── sub-001_ses-1_T2w.json
│ │ │ └── sub-001_ses-1_T2w.nii.gz
│ │ ├── fmap
│ │ │ ├── sub-001_ses-1_dir-fpe_epi.json
│ │ │ ├── sub-001_ses-1_dir-fpe_epi.nii.gz
│ │ │ ├── sub-001_ses-1_dir-rpe_epi.json
│ │ │ └── sub-001_ses-1_dir-rpe_epi.nii.gz
│ │ └── func
│ │ ├── sub-001_ses-1_task-FUNCMUX6_run-01_bold.json
│ │ ├── sub-001_ses-1_task-FUNCMUX6_run-01_bold.nii.gz
│ │ ├── sub-001_ses-1_task-FUNCMUX6_run-02_bold.json
│ │ ├── sub-001_ses-1_task-FUNCMUX6_run-02_bold.nii.gz
│ │ ├── sub-001_ses-1_task-FUNCMUX6_run-03_bold.json
│ │ ├── sub-001_ses-1_task-FUNCMUX6_run-03_bold.nii.gz
│ │ ├── sub-001_ses-1_task-FUNCMUX6_run-04_bold.json
│ │ └── sub-001_ses-1_task-FUNCMUX6_run-04_bold.nii.gz
│ └── ses-2
│ ├── fmap
│ │ ├── sub-001_ses-2_dir-fpe_run-01_epi.json
│ │ ├── sub-001_ses-2_dir-fpe_run-01_epi.nii.gz
│ │ ├── sub-001_ses-2_dir-rpe_run-01_epi.json
│ │ └── sub-001_ses-2_dir-rpe_run-01_epi.nii.gz
│ └── func
│ ├── sub-001_ses-2_task-FUNCMUX6_run-01_bold.json
│ ├── sub-001_ses-2_task-FUNCMUX6_run-01_bold.nii.gz
│ ├── sub-001_ses-2_task-FUNCMUX6_run-02_bold.json
│ ├── sub-001_ses-2_task-FUNCMUX6_run-02_bold.nii.gz
│ ├── sub-001_ses-2_task-FUNCMUX6_run-03_bold.json
│ ├── sub-001_ses-2_task-FUNCMUX6_run-03_bold.nii.gz
│ ├── sub-001_ses-2_task-FUNCMUX6_run-04_bold.json
│ ├── sub-001_ses-2_task-FUNCMUX6_run-04_bold.nii.gz
│ ├── sub-001_ses-2_task-rest_bold.json
│ └── sub-001_ses-2_task-rest_bold.nii.gz

Interestingly, I just tried the import_bids again on the above data and this time import was successful without any warning or error and without the need to move anat folder up one level. So now the issue can be thought as solved.

For the other two questions, please let me know if there is documentation on how to run qunex pipeline on the imported bids data, especially multiple scan sessions together (such as the 001-1 and 001-2 as in the above example, since anatomical data only in 001-1)? In addition, is there documentation on how to use the information inside the json files of the bids dataset in the qunex pipeline?

Thanks again.

Best,
Xuejun

thanks my issue has been fixed.