sct-pipeline / contrast-agnostic-softseg-spinalcord

Contrast-agnostic spinal cord segmentation project with softseg
MIT License
4 stars 3 forks source link

Testing contrast-agnostic model on GRE magnitude data #108

Open jcohenadad opened 1 month ago

jcohenadad commented 1 month ago

As of SCT version https://github.com/spinalcordtoolbox/spinalcordtoolbox/commit/bb479d82ea1e2076dd50343177056a61bd17e260 (install dev version until SCT v6.4 is released)

Syntax:

# Cord segmentation
sct_deepseg -i sub-test5_magnitude1.nii.gz -task seg_sc_contrast_agnostic -qc qc
# And then to dilate
sct_maths -i sub-test5_magnitude1_seg.nii.gz -dilate 5 -shape disk -dim 1 -o sub-test5_magnitude1_seg_dil.nii.gz

Red: contrast-agnostic (release https://github.com/sct-pipeline/contrast-agnostic-softseg-spinalcord/releases/tag/v2.4), Green: sct_deepseg_sc:

image

With the mask: image

@chaigner

jcohenadad commented 1 month ago

Trying with a lumbar data:

image

First thing to do is to reorient the image (bc AP and SI are swapped):

sct_image -i 109_Rekos_magnitude1.nii -transpose y,x,z -o 109_Rekos_magnitude1_transposed.nii.gz
sct_image -i 109_Rekos_magnitude1_transposed.nii.gz -flip x -o 109_Rekos_magnitude1_transposed.nii.gz

Which gives:

image

Now we can run the inference:

sct_deepseg -i 109_Rekos_magnitude1_transposed.nii.gz -task seg_sc_contrast_agnostic -qc qc

Result (room for improvement 😅): image

QC report: qc.zip

[!note] For creating the mask for shimming, binary segmentation will suffice. However, for precise evaluation of shimming methods, e.g., computing B0 inside the spinal cord, then the soft segmentation should be used (see entry "2024-06-05 10:26:01" in the QC report).