[RESOLVED] Import BIDS Data

Apologize for confusing the issue due to my debugging, here is my file structure and how it runs.
My complete data file structure is as follows:

├── HOH002_pre
│   ├── anat
│   │   ├── HOH002_pre_T1w.json
│   │   ├── HOH002_pre_T1w.nii
│   │   ├── HOH002_pre_T2w.json
│   │   └── HOH002_pre_T2w.nii
│   ├── dwi
│   │   ├── HOH002_pre_ses-1_AP_dwi.bval
│   │   ├── HOH002_pre_ses-1_AP_dwi.bvec
│   │   ├── HOH002_pre_ses-1_AP_dwi.json
│   │   └── HOH002_pre_ses-1_AP_dwi.nii
│   └── func
│       ├── HOH002_pre_task-rest_dir-AP_run-01_bold.json
│       └── HOH002_pre_task-rest_dir-AP_run-01_bold.nii
├── HOH003_pre
│   ├── anat
│   │   ├── HOH003_pre_T1w.json
│   │   ├── HOH003_pre_T1w.nii
│   │   ├── HOH003_pre_T2w.json
│   │   └── HOH003_pre_T2w.nii
│   ├── dwi
│   │   ├── HOH003_pre_ses-10_AP_dwi.bval
│   │   ├── HOH003_pre_ses-10_AP_dwi.bvec
│   │   ├── HOH003_pre_ses-10_AP_dwi.json
│   │   └── HOH003_pre_ses-10_AP_dwi.nii
│   └── func
│       ├── HOH003_pre_task-rest_dir-AP_run-01_bold.json
│       └── HOH003_pre_task-rest_dir-AP_run-01_bold.nii
├── HOH006_pre
│   ├── anat
│   │   ├── HOH006_pre_T1w.json
│   │   ├── HOH006_pre_T1w.nii
│   │   ├── HOH006_pre_T2w.json
│   │   └── HOH006_pre_T2w.nii
│   ├── dwi
│   │   ├── HOH006_pre_ses-18_AP_dwi.bval
│   │   ├── HOH006_pre_ses-18_AP_dwi.bvec
│   │   ├── HOH006_pre_ses-18_AP_dwi.json
│   │   └── HOH006_pre_ses-18_AP_dwi.nii
│   └── func
│       ├── HOH006_pre_task-rest_dir-AP_run-01_bold.json
│       └── HOH006_pre_task-rest_dir-AP_run-01_bold.nii
├── HOH011_pre
│   ├── anat
│   │   ├── HOH011_pre_T1w.json
│   │   ├── HOH011_pre_T1w.nii
│   │   ├── HOH011_pre_T2w.json
│   │   └── HOH011_pre_T2w.nii
│   ├── dwi
│   │   ├── HOH011_pre_ses-10_AP_dwi.bval
│   │   ├── HOH011_pre_ses-10_AP_dwi.bvec
│   │   ├── HOH011_pre_ses-10_AP_dwi.json
│   │   └── HOH011_pre_ses-10_AP_dwi.nii
│   └── func
│       ├── HOH011_pre_task-rest_dir-AP_run-01_bold.json
│       └── HOH011_pre_task-rest_dir-AP_run-01_bold.nii
├── HOH013_pre
│   ├── anat
│   │   ├── HOH013_pre_T1w.json
│   │   ├── HOH013_pre_T1w.nii
│   │   ├── HOH013_pre_T2w.json
│   │   └── HOH013_pre_T2w.nii
│   ├── dwi
│   │   ├── HOH013_pre_ses-10_AP_dwi.bval
│   │   ├── HOH013_pre_ses-10_AP_dwi.bvec
│   │   ├── HOH013_pre_ses-10_AP_dwi.json
│   │   └── HOH013_pre_ses-10_AP_dwi.nii
│   └── func
│       ├── HOH013_pre_task-rest_dir-AP_run-01_bold.json
│       └── HOH013_pre_task-rest_dir-AP_run-01_bold.nii
├── HOH015_pre
│   ├── anat
│   │   ├── HOH015_pre_T1w.json
│   │   ├── HOH015_pre_T1w.nii
│   │   ├── HOH015_pre_T2w.json
│   │   └── HOH015_pre_T2w.nii
│   ├── dwi
│   │   ├── HOH015_pre_ses-10_AP_dwi.bval
│   │   ├── HOH015_pre_ses-10_AP_dwi.bvec
│   │   ├── HOH015_pre_ses-10_AP_dwi.json
│   │   └── HOH015_pre_ses-10_AP_dwi.nii
│   └── func
│       ├── HOH015_pre_task-rest_dir-AP_run-01_bold.json
│       └── HOH015_pre_task-rest_dir-AP_run-01_bold.nii
├── HOH019_pre
│   ├── anat
│   │   ├── HOH019_pre_T1w.json
│   │   ├── HOH019_pre_T1w.nii
│   │   ├── HOH019_pre_T2w.json
│   │   └── HOH019_pre_T2w.nii
│   ├── dwi
│   │   ├── HOH019_pre_ses-10_AP_dwi.bval
│   │   ├── HOH019_pre_ses-10_AP_dwi.bvec
│   │   ├── HOH019_pre_ses-10_AP_dwi.json
│   │   └── HOH019_pre_ses-10_AP_dwi.nii
│   └── func
│       ├── HOH019_pre_task-rest_dir-AP_run-01_bold.json
│       └── HOH019_pre_task-rest_dir-AP_run-01_bold.nii
├── HOH020_pre
│   ├── anat
│   │   ├── HOH020_pre_T1w.json
│   │   ├── HOH020_pre_T1w.nii
│   │   ├── HOH020_pre_T2w.json
│   │   └── HOH020_pre_T2w.nii
│   ├── dwi
│   │   ├── HOH020_pre_ses-10_AP_dwi.bval
│   │   ├── HOH020_pre_ses-10_AP_dwi.bvec
│   │   ├── HOH020_pre_ses-10_AP_dwi.json
│   │   └── HOH020_pre_ses-10_AP_dwi.nii
│   └── func
│       ├── HOH020_pre_task-rest_dir-AP_run-01_bold.json
│       └── HOH020_pre_task-rest_dir-AP_run-01_bold.nii
├── HOS005_pre
│   ├── anat
│   │   ├── HOS005_pre_T1w.json
│   │   ├── HOS005_pre_T1w.nii
│   │   ├── HOS005_pre_T2w.json
│   │   └── HOS005_pre_T2w.nii
│   ├── dwi
│   │   ├── HOS005_pre_ses-10_AP_dwi.bval
│   │   ├── HOS005_pre_ses-10_AP_dwi.bvec
│   │   ├── HOS005_pre_ses-10_AP_dwi.json
│   │   └── HOS005_pre_ses-10_AP_dwi.nii
│   └── func
│       ├── HOS005_pre_task-rest_dir-AP_run-01_bold.json
│       └── HOS005_pre_task-rest_dir-AP_run-01_bold.nii
├── HOS006_pre
│   ├── anat
│   │   ├── HOS006_pre_T1w.json
│   │   ├── HOS006_pre_T1w.nii
│   │   ├── HOS006_pre_T2w.json
│   │   └── HOS006_pre_T2w.nii
│   ├── dwi
│   │   ├── HOS006_pre_ses-10_AP_dwi.bval
│   │   ├── HOS006_pre_ses-10_AP_dwi.bvec
│   │   ├── HOS006_pre_ses-10_AP_dwi.json
│   │   └── HOS006_pre_ses-10_AP_dwi.nii
│   └── func
│       ├── HOS006_pre_task-rest_dir-AP_run-01_bold.json
│       └── HOS006_pre_task-rest_dir-AP_run-01_bold.nii
├── HOS007_pre
│   ├── anat
│   │   ├── HOS007_pre_T1w.json
│   │   ├── HOS007_pre_T1w.nii
│   │   ├── HOS007_pre_T2w.json
│   │   └── HOS007_pre_T2w.nii
│   ├── dwi
│   │   ├── HOS007_pre_ses-10_AP_dwi.bval
│   │   ├── HOS007_pre_ses-10_AP_dwi.bvec
│   │   ├── HOS007_pre_ses-10_AP_dwi.json
│   │   └── HOS007_pre_ses-10_AP_dwi.nii
│   └── func
│       ├── HOS007_pre_task-rest_dir-AP_run-01_bold.json
│       └── HOS007_pre_task-rest_dir-AP_run-01_bold.nii
└── HOS009_pre
    ├── anat
    │   ├── HOS009_pre_T1w.json
    │   ├── HOS009_pre_T1w.nii
    │   ├── HOS009_pre_T2w.json
    │   └── HOS009_pre_T2w.nii
    ├── dwi
    │   ├── HOS009_pre_ses-10_AP_dwi.bval
    │   ├── HOS009_pre_ses-10_AP_dwi.bvec
    │   ├── HOS009_pre_ses-10_AP_dwi.json
    │   └── HOS009_pre_ses-10_AP_dwi.nii
    └── func
        ├── HOS009_pre_task-rest_dir-AP_run-01_bold.json
        └── HOS009_pre_task-rest_dir-AP_run-01_bold.nii

In order to test the complete processing procedure, I only processed the HOH002_pre participant data. My command is:

		qunex_container import_bids \
		    --sessionsfolder="${WORK_DIR}/${STUDY_NAME}/sessions" \
		    --sessions="HOH002_pre" \
		    --inbox="${RAW_DATA}" \
		    --archive="leave" \
		    --bind="/hdd1:/hdd1" \
		    --container="${QUNEX_CONTAINER}" \
		    --overwrite="yes"

And the output is:


.......................... Running QuNex v1.1.1 [QIO] ..........................


--- Full QuNex call for command: import_bids

qunex import_bids --sessionsfolder="/hdd1/qunex/cimt/validation2/sessions" --inbox="/hdd1/qunex/cimt/validation2/rawdata/For_ProfHui/MRI_data" --archive="leave" --bidsname="HOH002_pre" --overwrite="yes" --sessions="HOH002_pre"

---------------------------------------------------------


started running import_bids at 2025-07-08 15:21:20, track progress in /hdd1/qunex/cimt/validation2/processing/logs/comlogs/tmp_import_bids_2025-07-08_15.21.20.345102.log
call: gmri import_bids sessionsfolder="/hdd1/qunex/cimt/validation2/sessions" inbox="/hdd1/qunex/cimt/validation2/rawdata/For_ProfHui/MRI_data" archive="leave" bidsname="HOH002_pre" overwrite="yes" sessions="HOH002_pre"
-----------------------------------------
Running import_bids
==================
---> identifying files in /hdd1/qunex/cimt/validation2/rawdata/For_ProfHui/MRI_data
---> Inbox type: inbox
---> Paths:
    bidsinfo    -> /hdd1/qunex/cimt/validation2/info/bids/MRI_data
    bidsinbox   -> /hdd1/qunex/cimt/validation2/sessions/inbox/BIDS
    bidsarchive -> /hdd1/qunex/cimt/validation2/sessions/archive/BIDS
---> mapping files to QuNex bids folders
    ---> creating bids session 1
Running map_bids2nii for subject 1
==================================
---> linked 1.nii.gz <-- HOH002_pre_ses-1_AP_dwi.nii.gz
Running mapBIDS2behavior for subject 1
======================================
---> created behavior subfolder

Final report
============
subject 1 image mapping completed, behavioral files: no files mapped

-----------------------------------------
Finished at 2025-07-08 15:23:33

---> Successful completion of task


But when I check my sessions folder, it seems only dwi data be imported:

> /hdd1/qunex/cimt/validation2/sessions$ tree
.
├── 1
│   ├── behavior
│   ├── bids
│   │   ├── bids2nii.log
│   │   └── dwi
│   │       ├── HOH002_pre_ses-1_AP_dwi.bval
│   │       ├── HOH002_pre_ses-1_AP_dwi.bvec
│   │       ├── HOH002_pre_ses-1_AP_dwi.json
│   │       └── HOH002_pre_ses-1_AP_dwi.nii.gz
│   ├── nii
│   │   ├── 1.bval
│   │   ├── 1.bvec
│   │   ├── 1.json
│   │   └── 1.nii.gz
│   └── session.txt
├── archive
│   ├── behavior
│   ├── BIDS
│   ├── EEG
│   ├── HCPLS
│   └── MR
├── inbox
│   ├── behavior
│   ├── BIDS
│   ├── concs
│   ├── EEG
│   ├── events
│   ├── HCPLS
│   └── MR
├── QC
└── specs
    └── parameters_example.txt


where 1.nii is also dwi data.

Best,
Acacius

I think you have file naming issues as the BIDS file names are not consistent. Simplified, BIDS naming is as such: <subject>_<session>_<image>. In your case it is a bit all over the place again. For example:

  • HOH002_pre_T1w.nii.gz this seems fine, subject is HOH002, session is pre, image is T1w.
  • HOH002_pre_ses-1_AP_dwi.nii.gz you can see this is not consistent with T1w annotation, what is ses-1?
  • HOH002_pre_task-rest_dir-AP_run-01_bold.nii this is consistent with T1w, but inconsistent with DWI.

Try renaming all files as HOH002_001_<image>.nii.gz. This way it will be onboarded into QuNex as subject HOH002, session 001.

Best, Jure

I have renamed my data as your suggestion:

├── anat
│   ├── HOH002_001_T1w.json
│   ├── HOH002_001_T1w.nii.gz
│   ├── HOH002_001_T2w.json
│   └── HOH002_001_T2w.nii.gz
├── dwi
│   ├── HOH002_001_AP_dwi.bval
│   ├── HOH002_001_AP_dwi.bvec
│   ├── HOH002_001_AP_dwi.json
│   └── HOH002_001_AP_dwi.nii.gz
└── func
    ├── HOH002_001_task-rest_dir-AP_run-01_bold.json
    └── HOH002_001_task-rest_dir-AP_run-01_bold.nii.gz

But all of them can not be imported after unified their name:


.......................... Running QuNex v1.1.1 [QIO] ..........................


--- Full QuNex call for command: import_bids

qunex import_bids --sessionsfolder="/hdd1/qunex/cimt/validation2/sessions" --inbox="/hdd1/qunex/cimt/validation2/rawdata/For_ProfHui/MRI_data" --archive="leave" --bidsname="HOH002" --overwrite="yes" --sessions="HOH002"

---------------------------------------------------------


started running import_bids at 2025-07-08 17:50:46, track progress in /hdd1/qunex/cimt/validation2/processing/logs/comlogs/tmp_import_bids_2025-07-08_17.50.46.751713.log
call: gmri import_bids sessionsfolder="/hdd1/qunex/cimt/validation2/sessions" inbox="/hdd1/qunex/cimt/validation2/rawdata/For_ProfHui/MRI_data" archive="leave" bidsname="HOH002" overwrite="yes" sessions="HOH002"
-----------------------------------------
Running import_bids
==================
---> identifying files in /hdd1/qunex/cimt/validation2/rawdata/For_ProfHui/MRI_data
---> Inbox type: inbox
---> Paths:
    bidsinfo    -> /hdd1/qunex/cimt/validation2/info/bids/MRI_data
    bidsinbox   -> /hdd1/qunex/cimt/validation2/sessions/inbox/BIDS
    bidsarchive -> /hdd1/qunex/cimt/validation2/sessions/archive/BIDS
---> mapping files to QuNex bids folders

Final report
============

When running import_bids:
No sessions were mapped in this call. Please check report!

-----------------------------------------

Best,
Acacius

What is the used command call?

@yzhong Your filenames do not conform to the BIDS naming convention. For example, you have named one of them HOH002_001_T1w.nii.gz. It should actually be sub-HOH002_ses-001_T1w.

Please refer to the introduction to the BIDS scheme here and check the examples.

The folder should also be named sub-HOH002, and within that folder, you should have another folder named ses-001. The subject name should not contain any underscores. You can check whether your dataset is BIDS compliant using BIDS Validator.

Thanks Andraz! For some reason I forgot about the sub- and ses- prefixes …

Thank you and Andraz very much for the kindly help. Now all the problems have been solved!

Best,
Acacius