Skip to content

Commit 33fcc22

Browse files
Replace sct_label_vertebrae with disc labels from totalspineseg
1 parent bd48328 commit 33fcc22

1 file changed

Lines changed: 16 additions & 15 deletions

File tree

single_subject/batch_single_subject.sh

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,14 @@ sct_deepseg -h
6363
# Vertebral labeling
6464
# ======================================================================================================================
6565

66-
# Vertebral labeling
67-
sct_label_vertebrae -i t2.nii.gz -s t2_seg.nii.gz -c t2 -qc ~/qc_singleSubj
66+
# Vertebral disc labeling
67+
sct_deepseg totalspineseg -step1-only -i t2.nii.gz -qc ~/qc_singleSubj
68+
69+
# Full spinal segmentation (Vertebrae, Intervertebral discs, Spinal cord and Spinal canal)
70+
# Segment using totalspineseg
71+
sct_deepseg totalspineseg -i t2.nii.gz -qc ~/qc_singleSubj
72+
# Check results using FSLeyes
73+
fsleyes t2.nii.gz -cm greyscale t2_step1_canal.nii.gz -cm YlOrRd -a 70.0 t2_step1_cord.nii.gz -cm YlOrRd -a 70.0 t2_step1_levels.nii.gz -cm subcortical -a 70.0 t2_step1_output.nii.gz -cm subcortical -a 70.0 t2_step2_output.nii.gz -cm subcortical -a 70.0 &
6874
# Check QC report: Go to your browser and do "refresh".
6975
# Note: Here, two files are output: t2_seg_labeled, which represents the labeled segmentation (i.e., the value
7076
# corresponds to the vertebral level), and t2_seg_labeled_discs, which only has a single point for each
@@ -80,11 +86,11 @@ sct_label_vertebrae -i t2.nii.gz -s t2_seg.nii.gz -c t2 -qc ~/qc_singleSubj
8086
# ======================================================================================================================
8187

8288
# Compute cross-sectional area (CSA) of spinal cord and average it across levels C3 and C4
83-
sct_process_segmentation -i t2_seg.nii.gz -vert 3:4 -vertfile t2_seg_labeled.nii.gz -o csa_c3c4.csv
89+
sct_process_segmentation -i t2_seg.nii.gz -vert 3:4 -discfile t2_step1_levels.nii.gz -o csa_c3c4.csv
8490
# Aggregate CSA value per level
85-
sct_process_segmentation -i t2_seg.nii.gz -vert 3:4 -vertfile t2_seg_labeled.nii.gz -perlevel 1 -o csa_perlevel.csv
91+
sct_process_segmentation -i t2_seg.nii.gz -vert 3:4 -discfile t2_step1_levels.nii.gz -perlevel 1 -o csa_perlevel.csv
8692
# Aggregate CSA value per slices
87-
sct_process_segmentation -i t2_seg.nii.gz -z 30:35 -vertfile t2_seg_labeled.nii.gz -perslice 1 -o csa_perslice.csv
93+
sct_process_segmentation -i t2_seg.nii.gz -z 30:35 -discfile t2_step1_levels.nii.gz -perslice 1 -o csa_perslice.csv
8894

8995
# A drawback of vertebral level-based CSA is that it doesn’t consider neck flexion and extension.
9096
# To overcome this limitation, the CSA can instead be computed using the distance to a reference point.
@@ -96,7 +102,7 @@ sct_process_segmentation -i t2_seg.nii.gz -pmj t2_pmj.nii.gz -pmj-distance 64 -p
96102

97103
# The above commands will output the metrics in the subject space (with the original image's slice numbers)
98104
# However, you can get the corresponding slice number in the PAM50 space by using the flag `-normalize-PAM50 1`
99-
sct_process_segmentation -i t2_seg.nii.gz -vertfile t2_seg_labeled.nii.gz -perslice 1 -normalize-PAM50 1 -o csa_PAM50.csv
105+
sct_process_segmentation -i t2_seg.nii.gz -discfile t2_step1_levels.nii.gz -perslice 1 -normalize-PAM50 1 -o csa_PAM50.csv
100106

101107

102108

@@ -127,7 +133,7 @@ sct_compute_compression -i t2_compressed_seg.nii.gz -vertfile t2_compressed_seg_
127133
cd ../t2
128134

129135
# Create labels at C3 and T2 mid-vertebral levels. These labels are needed for template registration.
130-
sct_label_utils -i t2_seg_labeled.nii.gz -vert-body 3,9 -o t2_labels_vert.nii.gz
136+
sct_label_utils -i t2_step1_levels.nii.gz -keep 3,9 -o t2_labels_vert.nii.gz
131137
# Generate a QC report to visualize the two selected labels on the anatomical image
132138
sct_qc -i t2.nii.gz -s t2_labels_vert.nii.gz -p sct_label_utils -qc ~/qc_singleSubj
133139

@@ -137,14 +143,14 @@ sct_qc -i t2.nii.gz -s t2_labels_vert.nii.gz -p sct_label_utils -qc ~/qc_singleS
137143
#sct_label_utils -i t2.nii.gz -create-viewer 3,4,5 -o labels_disc.nii.gz -msg "Place labels at the posterior tip of each inter-vertebral disc. E.g. Label 3: C2/C3, Label 4: C3/C4, etc."
138144

139145
# Register t2->template.
140-
sct_register_to_template -i t2.nii.gz -s t2_seg.nii.gz -l t2_labels_vert.nii.gz -c t2 -qc ~/qc_singleSubj
146+
sct_register_to_template -i t2.nii.gz -s t2_seg.nii.gz -ldisc t2_labels_vert.nii.gz -c t2 -qc ~/qc_singleSubj
141147
# Note: By default the PAM50 template is selected. You can also select your own template using flag -t.
142148

143149
# Register t2->template with modified parameters (advanced usage of `-param`)
144-
sct_register_to_template -i t2.nii.gz -s t2_seg.nii.gz -l t2_labels_vert.nii.gz -qc ~/qc_singleSubj -ofolder advanced_param -c t2 -param step=1,type=seg,algo=rigid:step=2,type=seg,metric=CC,algo=bsplinesyn,slicewise=1,iter=3:step=3,type=im,metric=CC,algo=syn,slicewise=1,iter=2
150+
sct_register_to_template -i t2.nii.gz -s t2_seg.nii.gz -ldisc t2_labels_vert.nii.gz -qc ~/qc_singleSubj -ofolder advanced_param -c t2 -param step=1,type=seg,algo=rigid:step=2,type=seg,metric=CC,algo=bsplinesyn,slicewise=1,iter=3:step=3,type=im,metric=CC,algo=syn,slicewise=1,iter=2
145151

146152
# Register t2->template with large FOV (e.g. C2-L1) using `-ldisc` option
147-
# sct_register_to_template -i t2.nii.gz -s t2_seg.nii.gz -ldisc t2_seg_labeled_discs.nii.gz -c t2
153+
# sct_register_to_template -i t2.nii.gz -s t2_seg.nii.gz -ldisc t2_step1_levels.nii.gz -c t2
148154

149155
# Register t2->template in compressed cord (example command)
150156
# In case of highly compressed cord, the algo columnwise can be used, which allows for more deformation than bsplinesyn.
@@ -426,11 +432,6 @@ sct_deepseg sc_canal_t2 -i t2.nii.gz -qc ~/qc_singleSubj
426432
# Check results using FSLeyes
427433
fsleyes t2.nii.gz -cm greyscale t2_canal_seg_seg.nii.gz -cm red -a 70.0 &
428434

429-
# Full spinal segmentation (Vertebrae, Intervertebral discs, Spinal cord and Spinal canal)
430-
# Segment using totalspineseg
431-
sct_deepseg totalspineseg -i t2.nii.gz -qc ~/qc_singleSubj
432-
# Check results using FSLeyes
433-
fsleyes t2.nii.gz -cm greyscale t2_step1_canal.nii.gz -cm YlOrRd -a 70.0 t2_step1_cord.nii.gz -cm YlOrRd -a 70.0 t2_step1_levels.nii.gz -cm subcortical -a 70.0 t2_step1_output.nii.gz -cm subcortical -a 70.0 t2_step2_output.nii.gz -cm subcortical -a 70.0 &
434435

435436
# Segment the spinal nerve rootlets
436437
sct_deepseg rootlets -i t2.nii.gz -qc ~/qc_singleSubj

0 commit comments

Comments
 (0)