|
3 | 3 | DEST_DIR=$1
|
4 | 4 |
|
5 | 5 | # Define variables
|
6 |
| -LIST_URL="gin.g-node.org/jhlegarreta/tests-nifreeze/raw/AddPETData" |
| 6 | +LIST_URL="gin.g-node.org/nipreps-data/tests-nifreeze/raw/master" |
7 | 7 |
|
8 | 8 | FOLDER="pet_data"
|
9 |
| -SUB_LABEL="sub-01" |
| 9 | +SRC_SUB_LABELS=("sub-01") |
| 10 | +MTN_SUB_LABELS=("sub-02") |
| 11 | +SUB_LABELS=("${SRC_SUB_LABELS[@]}" "${MTN_SUB_LABELS[@]}") |
10 | 12 | SESSION_LABEL="ses-baseline"
|
11 | 13 | ANAT_LABEL="anat"
|
12 | 14 | PET_LABEL="pet"
|
13 |
| -ANAT_FNAMES=("sub-01_ses-baseline_T1w.nii") |
14 |
| -PET_FNAMES=("sub-01_ses-baseline_pet.json" "sub-01_ses-baseline_pet.nii.gz" "sub-01_ses-baseline_recording-manual_blood.json" "sub-01_ses-baseline_recording-manual_blood.tsv") |
| 15 | +ANAT_FNAMES_CMN_SSTR=("ses-baseline_T1w.nii") |
| 16 | +PET_FNAMES_CMN_SSTR=("ses-baseline_pet.json" "ses-baseline_pet.nii.gz" "ses-baseline_recording-manual_blood.json" "ses-baseline_recording-manual_blood.tsv") |
| 17 | +MOTION_FNAMES_CMN_SSTR=("ses-baseline_ground_truth_motion.csv") |
| 18 | +UNDERSCORE="_" |
15 | 19 |
|
16 | 20 | # Create target directory structure
|
17 |
| -mkdir -p "${DEST_DIR}/${FOLDER}/${SUB_LABEL}/${SESSION_LABEL}/${ANAT_LABEL}" |
18 |
| -mkdir -p "${DEST_DIR}/${FOLDER}/${SUB_LABEL}/${SESSION_LABEL}/${PET_LABEL}" |
| 21 | +for sub_id in "${SUB_LABELS[@]}"; do |
| 22 | + mkdir -p "${DEST_DIR}/${FOLDER}/${sub_id}/${SESSION_LABEL}/${ANAT_LABEL}" |
| 23 | + mkdir -p "${DEST_DIR}/${FOLDER}/${sub_id}/${SESSION_LABEL}/${PET_LABEL}" |
| 24 | +done |
19 | 25 |
|
20 | 26 | # Download anatomical files
|
21 |
| -for fname in "${ANAT_FNAMES[@]}"; do |
22 |
| - url="${LIST_URL}/${FOLDER}/${SUB_LABEL}/${SESSION_LABEL}/${ANAT_LABEL}/${fname}" |
23 |
| - wget -nv -O "${DEST_DIR}/${FOLDER}/${SUB_LABEL}/${SESSION_LABEL}/${ANAT_LABEL}/${fname}" "${url}" |
| 27 | +for sub_id in "${SUB_LABELS[@]}"; do |
| 28 | + fname="${ANAT_FNAMES_CMN_SSTR[@]/#/${sub_id}${UNDERSCORE}}" |
| 29 | + url="${LIST_URL}/${FOLDER}/${sub_id}/${SESSION_LABEL}/${ANAT_LABEL}/${fname}" |
| 30 | + wget -nv -O "${DEST_DIR}/${FOLDER}/${sub_id}/${SESSION_LABEL}/${ANAT_LABEL}/${fname}" "${url}" |
24 | 31 | done
|
25 | 32 |
|
26 | 33 | # Download PET files
|
27 |
| -for fname in "${PET_FNAMES[@]}"; do |
28 |
| - url="${LIST_URL}/${FOLDER}/${SUB_LABEL}/${SESSION_LABEL}/${PET_LABEL}/${fname}" |
29 |
| - wget -nv -O "${DEST_DIR}/${FOLDER}/${SUB_LABEL}/${SESSION_LABEL}/${PET_LABEL}/${fname}" "${url}" |
| 34 | +for sub_id in "${SUB_LABELS[@]}"; do |
| 35 | + fnames=("${PET_FNAMES_CMN_SSTR[@]/#/${sub_id}${UNDERSCORE}}") |
| 36 | + for fname in "${fnames[@]}"; do |
| 37 | + url="${LIST_URL}/${FOLDER}/${sub_id}/${SESSION_LABEL}/${PET_LABEL}/${fname}" |
| 38 | + wget -nv -O "${DEST_DIR}/${FOLDER}/${sub_id}/${SESSION_LABEL}/${PET_LABEL}/${fname}" "${url}" |
| 39 | + done |
| 40 | +done |
| 41 | + |
| 42 | +# Download motion files |
| 43 | +for sub_id in "${MTN_SUB_LABELS[@]}"; do |
| 44 | + fnames=("${MOTION_FNAMES_CMN_SSTR[@]/#/${sub_id}${UNDERSCORE}}") |
| 45 | + for fname in "${fnames[@]}"; do |
| 46 | + url="${LIST_URL}/${FOLDER}/${SUB_LABEL}/${SESSION_LABEL}/${PET_LABEL}/${fname}" |
| 47 | + wget -nv -O "${DEST_DIR}/${FOLDER}/${SUB_LABEL}/${SESSION_LABEL}/${PET_LABEL}/${fname}" "${url}" |
| 48 | + done |
30 | 49 | done
|
31 | 50 |
|
32 | 51 | echo "PET data successfully downloaded to the '${DEST_DIR}/${FOLDER}' directory."
|
0 commit comments