[RESOLVED] Create_list and construct FC matrix with non-aligned data

Hi,

I have a batch of unaligned data - some individuals were scanned only once, some had multiple scans. After the preprocessing is complete I get files with the suffix “_s_hpss_res-mVWMWB1d_lpss.nii.gz” that I want to build the functional connectivity matrix based on. I don’t seem to be getting any errors when I run the create_list command, the list file is successfully created but the path to the data file I want to work with is not written in it. Below is my command:

    qunex_container create_list \
        --sessionsfolder="${WORK_DIR}/${STUDY_NAME}/sessions" \
        --batchfile="${WORK_DIR}/${STUDY_NAME}/processing/batch.txt" \
        --listfile="lists/rest.list" \
        --bold_tail="_s_hpss_res-mVWMWB1d_lpss.nii.gz" \
        --bind="/hdd1:/hdd1" \
        --overwrite="yes" \
        --container="${QUNEX_CONTAINER}"

In my list file:

# Generated by QuNex 1.1.1 [QIO] on 2025-03-28_13.57.36.863879
#
session id: 001A
session id: 001B
session id: 001C
session id: 001D
session id: 002A
session id: 002B
session id: 002C
session id: 003A
session id: 003B
session id: 003C
session id: 003D
session id: 004A
session id: 004B
session id: 004C
session id: 006A
session id: 006C
session id: 009A
session id: 009C
session id: 009D
session id: 010A
session id: 010C
session id: 010D
session id: 010D_
session id: 012A
session id: 012A_
session id: 012C
session id: 014A
session id: 014D
session id: 016A
session id: 016C
session id: 017A
session id: 017C
session id: 018A
session id: 018C
session id: 019A
session id: 019C
session id: 020A
session id: 020C
session id: 021A
session id: 021C
session id: 022A
session id: 023A
session id: 024A
session id: 024C
session id: 025A
session id: 025C
session id: 026A
session id: 027A
session id: 027C
session id: 027D
session id: 028A
session id: 029A
session id: 029C
session id: 029D
session id: 030A
session id: 030D
session id: 031A
session id: 031D
session id: 032A
session id: 033A
session id: 034A
session id: 035A
session id: 035C
session id: 035D
session id: 036A
session id: 037A
session id: 038A
session id: 038C
session id: 039A
session id: 039C

I have an additional question: how do I convert .nii.gz type files to cifity type files in qunex to match my atlas?
Thanks for your kindly help!

Best
Acacius

Acacius, hi!

You have structured the create_list command well, it is only missing the information about which bolds to include the list. You do this by specifying either the bold numbers (if they are the same across all the sessions) or by specifying the relevant tag, which is more flexible. For instance, if you want to include all the resting state bold runs that were tagged as ‘rest’, which would be present in the batch file something similar to:

15: bold2:rest        :RSBOLD 3mm 48 2.5s
16: bold3:rest        :RSBOLD 3mm 48 2.5s

then you just need to add --bolds="rest" as a parameter in your command call (see documentation).

I’m not sure, what you mean by converting .nii.gz files. Are you referring to bold files or, for instance, ROI files that you have prepared in volume and would like to map to surface. QuNex does not include specific commands for mapping volume to surface representation. For that, you can use wb_command that is part of the HCP workbench tools and is present also in the QuNex container.

All the best,

Grega

Hi Grega,

Thanks for your help! I have solved the problem by adding "–bolds=“1,2” and check=“present” ". However, I met another error in running “fc_compute_roifc”. The full command is:

       qunex_container fc_compute_roifc \
        --sessionsfolder="${WORK_DIR}/${STUDY_NAME}/sessions" \
        --flist="/hdd1/qunex/cimt/processing/lists/rest.list" \
        --roiinfo="/hdd1/qunex/script_yuming/result_fc_Gordon333/AAL116_3mm.nii" \
        --targetf="/hdd1/qunex/script_yuming/result_fc_Gordon333" \
        --options="sessions=all|roimethod=mean|eventdata=all|ignore=use,fidl|badevents=use|fcmeasure=r|debug=false|saveind=mat|itargetf:gfolder" \
        --frames_info="5" \
        --bind="/hdd1:/hdd1" \
        --container="${QUNEX_CONTAINER}";

And the error is:


Processing session 001A     ... reading image file(s) ... 488 frames read, done.
     ... creating ROI mask
     ... generating extraction sets
         -> timeseries: 1 good events, 483 good frames
     ... computing fc matrices
         ... set timeseries
         ... extracted ts

Matlab Error! Processing Failed!
ERROR: ROI image does not match target in dimensions!


ERROR: fc_compute_roifc failed! Please check output / log!

My input files are .nii.gz type, like"bold1_s_hpss_res-mVWMWB1d_lpss.nii.gz". What are the possible reasons for generating this error? And if my interest atlas is cifity type(like “Schaefer2018_100Parcels_7Networks_order.dlabel.nii”), I need to transfer my data by using wb_command function. Am I understanding you correctly?

Thanks again!

Best
Acacius

Acacius, hi!

Most analytical functions in QuNex expect the files to be of the same format and dimensions. In fc_compute_roifc, the roi file specified using --roiinfo has to be of the same type and dimensions as your BOLD input. Based on your command it seems that you have the AAL segmentation in 3mm resolution, whereas the bold after HCPpipelines preprocessing is in 2mm isometric resolution. You could either upsample the ROI file using FSL tools (that are included in the QuNex container) or obtain a version of the AAL segmentation in the 2mm isometric MNI standard space.

If your ROI definition is in a cifti file, you can use cifti BOLD input. They should be present in the images/functional folder along with the nii.gz volume files. They have been processed using HCPpipelines and mapped to the images/functional folder with the map_hcp_data command. If you have not yet ran the additional processing (smoothingm highpass filtering and regression), you can prepare them the same way you have the volume files, you just specify cifti as the processing target. There is no need for use of wb_command in this case.

All the best,

Grega

Hi Grega,

Many thanks to your patient help! In my path/images/functional folder are the nifti file “bold1.nii.gz” and the cifti file “bold1_Atlas.dtseries.nii ”, but the preprocess_bold function seems to only process nifti files by default, how do I specify it to process cifti files?

Here is my command:

    qunex_container preprocess_bold \
        --sessionsfolder="${WORK_DIR}/${STUDY_NAME}/sessions" \
		    --batchfile="${WORK_DIR}/${STUDY_NAME}/processing/batch.txt" \
        --sessions="${SUBJ}" \
        --bind="/hdd1:/hdd1" \
        --overwrite="yes" \
        --bolds="rest" \
        --bold_actions="s,h,r,c,l" \
        --bold_nuisance="m,V,WM,WB,1d" \
        --mov_bad="udvarsme" \
        --pignore="hipass=linear|regress=ignore|lopass=linear" \
        --container="${QUNEX_CONTAINER}"

The running log is:


Starting multiprocessing sessions in /hdd1/qunex/cimt/processing/batch.txt with a pool of 1 concurrent processes


Starting processing of sessions 001A at Tuesday, 01. April 2025 09:43:05
Running external command: octave -q --eval "try fc_preprocess('/hdd1/qunex/cimt/sessions/001A', 1, 5, 's,h,r,c,l', 'm,V,WM,WB,1d', [], '', '', '', true, **'.nii.gz'**, 'radius:50|fdt:0.50|dvarsmt:3.00|dvarsmet:1.50|after:0|before:0|reject:udvarsme', 'hipass=linear|regress=ignore|lopass=linear', 'boldname=bold|surface_smooth=2.000000|volume_smooth=2.000000|voxel_smooth=1.000000|hipass_filter=0.008000|lopass_filter=0.090000|framework_path=|wb_command_path=|smooth_mask=false|dilate_mask=false|glm_matrix=none|glm_residuals=save|glm_results=c,r|glm_name=|bold_tail=|ref_bold_tail=|bold_variant=|img_suffix='); catch ME, general_report_crash(ME); exit(1), end; exit"

You can follow command's progress in:
/hdd1/qunex/cimt/processing/logs/comlogs/tmp_preprocess_bold_B1_001A_2025-04-01_09.43.05.041225.log
------------------------------------------------------------

---------------------------------------------------------
Session id: 001A
[started on Tuesday, 01. April 2025 09:43:05]
Preprocessing all BOLD files as specified in --bolds.
Files in 'images/functional will be processed.
Running Preprocessing bold runs ...
Processing 1 BOLDs in parallel

Working on: bold1 ...
... checking for data
    ... movement data present
    ... bold scrubbing data present
    ... bold nuisance signal data present
    ... bold data present
    ... result present

running matlab/octave fc_preprocess on /hdd1/qunex/cimt/sessions/001A/images/functional bold 1
---> preprocess_bold test file [bold1_hpss_res-mVWMWB1d_lpss.nii.gz] present
---> logfile: /hdd1/qunex/cimt/processing/logs/comlogs/done_preprocess_bold_B1_001A_2025-04-01_09.43.05.041225.log

Best
Acacius

Acacius, hi!

No worries, we’re here to help. It seems that in the documentation for preprocess_bold the initial part that describes the parameters is missing for some reason. You can refer to the documentation for preprocess_conc, which shares most of the parameters. The parameter that defines, which image format to work with is image_target it is set to ‘nifti’ (for volume images) by default. Set it to ‘cifti’ to process cifti images. All other parameters stay the same.

In short, add:

   --image_target="cifti" 

to your command and it will process the cifti instead of the nifti files.

If you primarily work with cifti images, you can add the image_target parameters to the batch file header section. In the batch file, it might be also prudent to specify that cifti images end with “_Atlas” tag, by setting the cifti_tail parameter to “_Atlas”. This is done by default, but it does not hurt to make it explicit:

_image_target: cifti
_cifti_tail:   _Atlas

All the best,

Grega

Thanks for your kindly help! It starts to process now.

Best,
Acacius