Sct_run_batch -include_list

Hi,

I am struggling with the -include_list option for sct_run_batch script. What is the correct way how to define the list?

I have tried many different variants in my config.json file:

"include_list" : "sub-0001 sub-0002"
"include_list" : "sub-0001,sub-0002"
"include_list" : "'sub-0001' 'sub-0002'"
"include_list" : "'sub-0001','sub-0002'"
"include_list" : "[sub-0001 sub-0002]"
"include_list" : "[sub-0001,sub-0002]"
"include_list" : "['sub-0001' 'sub-0002']"
"include_list" : "['sub-0001','sub-0002']"
"include_list" : ['sub-0001' 'sub-0002']
"include_list" : ['sub-0001','sub-0002']

But no one works.

Similar issue has not helped me.

On the other hand, include option works fine:

"include" : "sub-0001"

Thanks!
Jan

SCT uses the json Python library to parse config.json.

Looking at this json page, in order to get a list (in Python), we need to use an array (in JSON).

So, I think you would need to do:

"include_list" : ["sub-0001", "sub-0002"]

The important distinction here is single-quotes vs. double-quotes. JSON does not allow single-quoted strings. (I actually didn’t know this until now, but the PyCharm json parser caught this for me:)

I have tried this on my current research project, and found that it works. For reference, here is the full JSON file I’m using:

{
  "path_data" : "/data/vertebral-labeling-validation/data_prepared/data_processed/data",
  "path_output" : "/data/vertebral-labeling-validation/prediction_version_deep",
  "script" : "/home/joshua/repos/vertebral-labeling-validation/run_prediction.sh",
  "jobs" : 2,
  "batch_log" : "sct_run_batch_log.txt",
  "continue_on_error" : 0,
  "subject_prefix" : "sub-",
  "zip" : true,
  "include_list" : ["sub-koreajisun002", "sub-nyuShepherd002"]
}

The result:

RUNNING
-------
Processing 2 subjects in parallel. (Worker processes used: 2).
Started at 12h14m16s: sub-nyuShepherd002. See log file /data/vertebral-labeling-validation/prediction_version_deep/log/run_prediction_sub-nyuShepherd002.log
Started at 12h14m16s: sub-koreajisun002. See log file /data/vertebral-labeling-validation/prediction_version_deep/log/run_prediction_sub-koreajisun002.log

I will update the GitHub issue accordingly so that the use of single-quotes doesn’t mislead anyone again.

1 Like

Thanks for quick response Joshua!

I have tried your solution ("include_list" : ["sub-0001", "sub-0002"]) but it did work. Since our dataset is longitudinal (organised in this way: sub-0001/ses-01/anat, …) I then tried to include also ses into the list:

"include_list" : ["sub-0001/ses-01","sub-0002/ses-01"]

In this configuration, it works. I also tried:

"include_list" : "['sub-0001/ses-01','sub-0002/ses-01']"

And it works as well.

So, it seems that include_list required ses for longitudinal studies. On the other hand, include accepts both variants (with ses: "include" : "sub-0001/ses-01" and also without ses: "include" : "sub-0001")

1 Like

Thank you for reporting this!

I’m surprised to hear that include and include_list function differently with respect to ses folders. I think this requires further investigation on the part of SCT’s developers. :thinking:

2 Likes