Skip to content

Commit e349507

Browse files
joshuacwnewtonvalosekjSomeoneInParticular
authored
Update batch_single_subject.sh and process_data.sh to match changes to 2024 SCT Course Slides (#25)
Co-authored-by: Jan Valosek <[email protected]> Co-authored-by: Kalum Ost <[email protected]>
1 parent c3a4f10 commit e349507

File tree

3 files changed

+157
-102
lines changed

3 files changed

+157
-102
lines changed

Diff for: .github/workflows/run_batch_script.yml

+19-3
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,26 @@ jobs:
6262
fi
6363
done
6464
65-
- name: Check that script executed without error
65+
- name: Check results (no error logs)
66+
if: always()
6667
run: |
6768
cd "${{ github.event.repository.name }}/multi_subject/output/log"
6869
[ "$(compgen -G "process_data_sub-0*.log")" ] # Log files should exist
70+
71+
- name: Check results (no error logs)
72+
if: always()
73+
run: |
74+
cd "${{ github.event.repository.name }}/multi_subject/output/log"
6975
[ ! "$(compgen -G "err.process_data_sub-0*.log")" ] # Error files should NOT exist
70-
grep -iF "warning" process_data_sub-01.log
71-
grep -iF "error" process_data_sub-01.log
76+
77+
- name: Check results (warnings in log)
78+
if: always()
79+
run: |
80+
cd "${{ github.event.repository.name }}/multi_subject/output/log"
81+
# ! grep -iF "warning" process_data_sub-01.log
82+
83+
- name: Check results (errors in log)
84+
if: always()
85+
run: |
86+
cd "${{ github.event.repository.name }}/multi_subject/output/log"
87+
! grep -iF "error" process_data_sub-01.log

Diff for: multi_subject/process_data.sh

+5-6
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ segment_if_does_not_exist() {
7171
# This allows you to add manual segmentations on a subject-by-subject basis without disrupting the pipeline.
7272
###
7373
local file="${1}"
74-
local contrast="${2}"
7574
# Update global variable with segmentation file name
7675
FILESEG="${file}"_seg
7776
FILESEGMANUAL="${PATH_DATA}"/derivatives/labels/"${SUBJECT}"/anat/"${FILESEG}".nii.gz
@@ -84,7 +83,7 @@ segment_if_does_not_exist() {
8483
else
8584
echo "Not found. Proceeding with automatic segmentation."
8685
# Segment spinal cord
87-
sct_deepseg_sc -i "${file}".nii.gz -c "${contrast}" -qc "${PATH_QC}" -qc-subject "${SUBJECT}"
86+
sct_deepseg -task seg_sc_contrast_agnostic -i "${file}".nii.gz -qc "${PATH_QC}" -qc-subject "${SUBJECT}"
8887
fi
8988
}
9089

@@ -111,8 +110,8 @@ rsync -avzh "${PATH_DATA}"/"${SUBJECT}" .
111110
# ======================================================================================================================
112111
cd "${SUBJECT}"/anat/
113112
file_t2="${SUBJECT}"_T2w
114-
# Segment spinal cord (only if it does not exist)
115-
segment_if_does_not_exist "${file_t2}" "t2"
113+
# Segment spinal cord (only if it does not exist) using contrast-agnostic model
114+
segment_if_does_not_exist "${file_t2}"
116115
file_t2_seg="${FILESEG}"
117116
# Create labels in the cord at C2 and C5 mid-vertebral levels (only if it does not exist)
118117
label_if_does_not_exist "${file_t2}" "${file_t2_seg}"
@@ -132,8 +131,8 @@ sct_process_segmentation -i "${file_t2_seg}".nii.gz -vert 2:3 -vertfile label_T2
132131
# ======================================================================================================================
133132
file_mt1="${SUBJECT}"_acq-MTon_MTS
134133
file_mt0="${SUBJECT}"_acq-MToff_MTS
135-
# Segment spinal cord
136-
segment_if_does_not_exist "${file_mt1}" "t2s"
134+
# Segment spinal cord using contrast-agnostic model
135+
segment_if_does_not_exist "${file_mt1}"
137136
file_mt1_seg="${FILESEG}"
138137
# Create mask
139138
sct_create_mask -i "${file_mt1}".nii.gz -p centerline,"${file_mt1_seg}".nii.gz -size 45mm

0 commit comments

Comments
 (0)