@@ -63,12 +63,18 @@ 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
71- # inter -vertebral disc level. The convention is: Value 3 —> C2-C3 disc, Value 4 —> C3-C4 disc, etc.
77+ # intersct_deepseg spinalcord -i t2.nii.gz -vertebral disc level. The convention is: Value 3 —> C2-C3 disc, Value 4 —> C3-C4 disc, etc.
7278
7379# OPTIONAL: If automatic labeling did not work, you can initialize with manual identification of C2-C3 disc:
7480# sct_label_utils -i t2.nii.gz -create-viewer 3 -o label_c2c3.nii.gz -msg "Click at the posterior tip of C2/C3 inter-vertebral disc"
@@ -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,24 +133,24 @@ sct_compute_compression -i t2_compressed_seg.nii.gz -vertfile t2_compressed_seg_
127133cd ../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
132138sct_qc -i t2.nii.gz -s t2_labels_vert.nii.gz -p sct_label_utils -qc ~ /qc_singleSubj
133139
134140# OPTIONAL: You might want to completely bypass sct_label_vertebrae and do the labeling manually. In that case, we
135- # provide a viewer to do so conveniently. In the example command below, we will create labels at the inter-vertebral
136- # discs C2-C3 (value=3), C3-C4 (value=4) and C4-C5 (value=5).
137- # 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."
141+ # provide a viewer to do so conveniently. In the example command below, we will create labels at the inter-vertebral
142+ # discs C2-C3 (value=3), C3-C4 (value=4) and C4-C5 (value=5).
143+ # 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.
@@ -226,6 +232,9 @@ sct_deepseg sc_lumbar_t2 -i t2_lumbar.nii.gz -qc ~/qc_singleSubj
226232# sake of reproducing the results in the tutorial.
227233sct_label_utils -i t2_lumbar.nii.gz -create 27,76,187,17:27,79,80,60 -o t2_lumbar_labels.nii.gz -qc ~ /qc_singleSubj
228234
235+ # generate a QC report for the lumbar labels
236+ sct_qc -i t2_lumbar.nii.gz -s t2_lumbar_labels.nii.gz -p sct_label_utils -qc ~ /qc_singleSubj
237+
229238# Register the image to the template using segmentation and labels
230239sct_register_to_template -i t2_lumbar.nii.gz -s t2_lumbar_seg.nii.gz -ldisc t2_lumbar_labels.nii.gz -c t2 -qc ~ /qc_singleSubj -param step=1,type=seg,algo=centermassrot:step=2,type=seg,algo=bsplinesyn,metric=MeanSquares,iter=3,slicewise=0:step=3,type=im,algo=syn,metric=CC,iter=3,slicewise=0
231240
@@ -237,7 +246,7 @@ sct_register_to_template -i t2_lumbar.nii.gz -s t2_lumbar_seg.nii.gz -ldisc t2_l
237246# Go to T2*-weighted data, which has good GM/WM contrast and high in-plane resolution
238247cd ../t2s
239248# Segment gray matter (check QC report afterwards)
240- sct_deepseg_gm -i t2s.nii.gz -qc ~ /qc_singleSubj
249+ sct_deepseg graymatter -i t2s.nii.gz -qc ~ /qc_singleSubj
241250# Spinal cord segmentation
242251sct_deepseg spinalcord -i t2s.nii.gz -qc ~ /qc_singleSubj
243252# Subtract GM segmentation from cord segmentation to obtain WM segmentation
@@ -387,7 +396,7 @@ sct_smooth_spinalcord -i t1.nii.gz -s t1_seg.nii.gz
387396# Tips: use flag "-sigma" to specify smoothing kernel size (in mm)
388397
389398# Second-pass segmentation using the smoothed anatomical image
390- sct_deepseg_sc -i t1_smooth.nii.gz -c t1 -qc ~ /qc_singleSubj
399+ sct_deepseg spinalcord -i t1_smooth.nii.gz -qc ~ /qc_singleSubj
391400
392401# Align the spinal cord in the right-left direction using slice-wise translations.
393402sct_flatten_sagittal -i t1.nii.gz -s t1_seg.nii.gz
@@ -414,7 +423,8 @@ sct_analyze_lesion -m t2_lesion_seg.nii.gz -s t2_sc_seg.nii.gz -qc ~/qc_singleSu
414423# Lesion analysis using PAM50 (the -f flag is used to specify the folder containing the atlas/template)
415424# Note: You must go through the "Register to Template" steps (labeling, registration) first
416425# This is because `sct_warp_template` is required to generate the `label` folder used for `-f`
417- # sct_analyze_lesion -m t2_lesion_seg.nii.gz -s t2_sc_seg.nii.gz -f label -qc ~/qc_singleSubj
426+ sct_warp_template -d t2.nii.gz -w ../t2/warp_template2anat.nii.gz
427+ sct_analyze_lesion -m t2_lesion_seg.nii.gz -s t2_sc_seg.nii.gz -f label -qc ~ /qc_singleSubj
418428
419429# Segment the spinal cord on gradient echo EPI data
420430cd ../fmri/
@@ -425,12 +435,8 @@ cd ../t2
425435sct_deepseg sc_canal_t2 -i t2.nii.gz -qc ~ /qc_singleSubj
426436# Check results using FSLeyes
427437fsleyes t2.nii.gz -cm greyscale t2_canal_seg_seg.nii.gz -cm red -a 70.0 &
428-
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 &
438+ # Use canal segmentation to compute aSCOR
439+ sct_compute_ascor -i-SC t2_seg.nii.gz -i-canal t2_canal_seg.nii.gz -perlevel -1 -o ascor.csv
434440
435441# Segment the spinal nerve rootlets
436442sct_deepseg rootlets -i t2.nii.gz -qc ~ /qc_singleSubj
0 commit comments