Skip to content

Commit dc50cda

Browse files
Update sct_deepseg calls to use new subparser syntax (no -task) (#30)
1 parent 2076f3a commit dc50cda

2 files changed

Lines changed: 18 additions & 18 deletions

File tree

multi_subject/process_data.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ segment_if_does_not_exist() {
8383
else
8484
echo "Not found. Proceeding with automatic segmentation."
8585
# Segment spinal cord
86-
sct_deepseg -task seg_sc_contrast_agnostic -i "${file}".nii.gz -qc "${PATH_QC}" -qc-subject "${SUBJECT}"
86+
sct_deepseg spinalcord -i "${file}".nii.gz -qc "${PATH_QC}" -qc-subject "${SUBJECT}"
8787
fi
8888
}
8989

single_subject/batch_single_subject.sh

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ fi
4646
# Go to T2 folder
4747
cd data/t2
4848
# Spinal cord segmentation (using the new 2024 contrast-agnostic method)
49-
sct_deepseg -task seg_sc_contrast_agnostic -i t2.nii.gz -qc ~/qc_singleSubj
49+
sct_deepseg spinalcord -i t2.nii.gz -qc ~/qc_singleSubj
5050
# The default output is t2_seg.nii.gz
5151
# You can also choose your own output filename using the “-o” argument
52-
sct_deepseg -task seg_sc_contrast_agnostic -i t2.nii.gz -o test/t2_seg_2.nii.gz
52+
sct_deepseg spinalcord -i t2.nii.gz -o test/t2_seg_2.nii.gz
5353

5454
# To check the QC report, use your web browser to open the file qc_singleSubj/qc/index.html, which has been created in
5555
# your home directory
@@ -104,7 +104,7 @@ sct_process_segmentation -i t2_seg.nii.gz -vertfile t2_seg_labeled.nii.gz -persl
104104
# ======================================================================================================================
105105
cd ../t2_compression
106106
# Segment the spinal cord of the compressed spine
107-
sct_deepseg -task seg_sc_contrast_agnostic -i t2_compressed.nii.gz -qc ~/qc_singleSubj
107+
sct_deepseg spinalcord -i t2_compressed.nii.gz -qc ~/qc_singleSubj
108108
# Label the vertebrae using the compressed spinal cord segmentation
109109
sct_label_vertebrae -i t2_compressed.nii.gz -s t2_compressed_seg.nii.gz -c t2 -qc ~/qc_singleSubj
110110
# Generate labels for each spinal cord compression site.
@@ -169,7 +169,7 @@ fsleyes t2.nii.gz -cm greyscale -a 100.0 label/template/PAM50_t2.nii.gz -cm grey
169169
# Go to mt folder
170170
cd ../mt
171171
# Segment cord
172-
sct_deepseg -task seg_sc_contrast_agnostic -i mt1.nii.gz -qc ~/qc_singleSubj
172+
sct_deepseg spinalcord -i mt1.nii.gz -qc ~/qc_singleSubj
173173

174174
# Create a close mask around the spinal cord for more accurate registration (i.e. does not account for surrounding
175175
# tissue which could move independently from the cord)
@@ -215,7 +215,7 @@ sct_compute_mtr -mt0 mt0_reg.nii.gz -mt1 mt1.nii.gz
215215
cd ../t2_lumbar
216216

217217
# Use lumbar-specific `sct_deepseg` model to segment the spinal cord
218-
sct_deepseg -i t2_lumbar.nii.gz -task seg_lumbar_sc_t2w -qc ~/qc_singleSubj
218+
sct_deepseg sc_lumbar_t2 -i t2_lumbar.nii.gz -qc ~/qc_singleSubj
219219

220220
# Generate labels for the 2 spinal cord landmarks: cauda equinea ('99') and T9-T10 disc ('17')
221221
# Note: Normally this would be done manually using fsleyes' "Edit mode -> Create mask" functionality. (Uncomment below)
@@ -239,7 +239,7 @@ cd ../t2s
239239
# Segment gray matter (check QC report afterwards)
240240
sct_deepseg_gm -i t2s.nii.gz -qc ~/qc_singleSubj
241241
# Spinal cord segmentation
242-
sct_deepseg -task seg_sc_contrast_agnostic -i t2s.nii.gz -qc ~/qc_singleSubj
242+
sct_deepseg spinalcord -i t2s.nii.gz -qc ~/qc_singleSubj
243243
# Subtract GM segmentation from cord segmentation to obtain WM segmentation
244244
# Note that we use the flag -thr 0 in case some voxels in the GM segmentation are *not* included in the cord
245245
# segmentation. That would results in voxels in the WM segmentation having the value “-1”, which would cause issues
@@ -311,7 +311,7 @@ cd ../dmri
311311
sct_dmri_separate_b0_and_dwi -i dmri.nii.gz -bvec bvecs.txt
312312
# Segment SC on mean dMRI data
313313
# Note: This segmentation does not need to be accurate-- it is only used to create a mask around the cord
314-
sct_deepseg -task seg_sc_contrast_agnostic -i dmri_dwi_mean.nii.gz -qc ~/qc_singleSubj
314+
sct_deepseg spinalcord -i dmri_dwi_mean.nii.gz -qc ~/qc_singleSubj
315315
# Create mask (for subsequent cropping)
316316
sct_create_mask -i dmri_dwi_mean.nii.gz -p centerline,dmri_dwi_mean_seg.nii.gz -size 35mm
317317

@@ -320,7 +320,7 @@ sct_dmri_moco -i dmri.nii.gz -m mask_dmri_dwi_mean.nii.gz -bvec bvecs.txt -qc ~/
320320
# Check results in the QC report
321321

322322
# Segment SC on motion-corrected mean dwi data (check results in the QC report)
323-
sct_deepseg -task seg_sc_contrast_agnostic -i dmri_moco_dwi_mean.nii.gz -qc ~/qc_singleSubj
323+
sct_deepseg spinalcord -i dmri_moco_dwi_mean.nii.gz -qc ~/qc_singleSubj
324324

325325
# Register template->dwi via t2 to account for cord shape (which is better defined in T2 contrast)
326326
# Tips: Here we use the PAM50 contrast t1, which is closer to the dwi contrast (although we are not using type=im in
@@ -357,7 +357,7 @@ sct_create_mask -i fmri.nii.gz -p centerline,t2_seg_reg.nii.gz -size 35mm -f cyl
357357
sct_fmri_moco -i fmri.nii.gz -m mask_fmri.nii.gz -qc ~/qc_singleSubj -qc-seg t2_seg_reg.nii.gz
358358

359359
# Cord segmentation on motion-corrected averaged time series
360-
sct_deepseg -i fmri_moco_mean.nii.gz -task seg_sc_contrast_agnostic -qc ~/qc_singleSubj/
360+
sct_deepseg spinalcord -i fmri_moco_mean.nii.gz -qc ~/qc_singleSubj/
361361
# TSNR before/after motion correction with QC report
362362
sct_fmri_compute_tsnr -i fmri.nii.gz
363363
sct_fmri_compute_tsnr -i fmri_moco.nii.gz
@@ -380,7 +380,7 @@ sct_warp_template -d fmri_moco_mean.nii.gz -w warp_template2fmri.nii.gz -a 0 -qc
380380

381381
cd ../t1
382382
# Segment T1-weighted image (to be used in later steps)
383-
sct_deepseg -task seg_sc_contrast_agnostic -i t1.nii.gz -qc ~/qc_singleSubj/
383+
sct_deepseg spinalcord -i t1.nii.gz -qc ~/qc_singleSubj/
384384

385385
# Smooth spinal cord along centerline (extracted from the segmentation)
386386
sct_smooth_spinalcord -i t1.nii.gz -s t1_seg.nii.gz
@@ -402,17 +402,17 @@ sct_flatten_sagittal -i t1.nii.gz -s t1_seg.nii.gz
402402
cd ../t2_lesion
403403
# Segment the spinal cord and intramedullary lesion using the SCIsegV2 model
404404
# Note: t2.nii.gz contains a fake lesion for the purpose of this tutorial
405-
sct_deepseg -i t2.nii.gz -task seg_sc_lesion_t2w_sci -qc ~/qc_singleSubj
405+
sct_deepseg lesion_sci_t2 -i t2.nii.gz -qc ~/qc_singleSubj
406406
# Note: Two files are output:
407407
# - t2_sc_seg.nii.gz: the spinal cord segmentation
408408
# - t2_lesion_seg.nii.gz: the lesion segmentation
409409
# Check results using FSLeyes
410410
fsleyes t2.nii.gz -cm greyscale t2_sc_seg.nii.gz -cm red -a 70.0 t2_lesion_seg.nii.gz -cm blue-lightblue -a 70.0 &
411411

412412
# Note: We also have a contrast-agnostic segmentation command for MS lesions, too:
413-
sct_deepseg -i t2.nii.gz -task seg_ms_lesion -qc ~/qc_singleSubj
413+
sct_deepseg lesion_ms -i t2.nii.gz -qc ~/qc_singleSubj
414414
# As well as a segmentation command tailored to MP2RAGE MS lesions
415-
# sct_deepseg -i t2.nii.gz -task seg_ms_lesion_mp2rage -qc ~/qc_singleSubj
415+
# sct_deepseg lesion_ms_mp2rage -i t2.nii.gz -qc ~/qc_singleSubj
416416

417417
# Compute various morphometric measures, such as number of lesions, lesion length, lesion volume, etc.
418418
sct_analyze_lesion -m t2_lesion_seg.nii.gz -s t2_sc_seg.nii.gz -qc ~/qc_singleSubj
@@ -423,22 +423,22 @@ sct_analyze_lesion -m t2_lesion_seg.nii.gz -s t2_sc_seg.nii.gz -qc ~/qc_singleSu
423423

424424
# Segment the spinal cord on gradient echo EPI data
425425
cd ../fmri/
426-
sct_deepseg -i fmri_moco_mean.nii.gz -task seg_sc_epi -qc ~/qc_singleSubj
426+
sct_deepseg sc_epi -i fmri_moco_mean.nii.gz -qc ~/qc_singleSubj
427427

428428
# Canal segmentation
429429
cd ../t2
430-
sct_deepseg -i t2.nii.gz -task canal_t2w -qc ~/qc_singleSubj
430+
sct_deepseg sc_canal_t2 -i t2.nii.gz -qc ~/qc_singleSubj
431431
# Check results using FSLeyes
432432
fsleyes t2.nii.gz -cm greyscale t2_canal_seg_seg.nii.gz -cm red -a 70.0 &
433433

434434
# Full spinal segmentation (Vertebrae, Intervertebral discs, Spinal cord and Spinal canal)
435435
# Segment using totalspineseg
436-
sct_deepseg -i t2.nii.gz -task totalspineseg -qc ~/qc_singleSubj
436+
sct_deepseg totalspineseg -i t2.nii.gz -qc ~/qc_singleSubj
437437
# Check results using FSLeyes
438438
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 &
439439

440440
# Segment the spinal nerve rootlets
441-
sct_deepseg -i t2.nii.gz -task seg_spinal_rootlets_t2w -qc ~/qc_singleSubj
441+
sct_deepseg rootlets -i t2.nii.gz -qc ~/qc_singleSubj
442442
# Check results using FSLeyes
443443
fsleyes t2.nii.gz -cm greyscale t2_rootlets.nii.gz -cm subcortical -a 70.0 &
444444

0 commit comments

Comments
 (0)