Segmentation of spinal cord lesion on MP2RAGE UNI images doesn't work

Hi,
I’m trying to segment lesion on spinal cord from MP2RAGE images, the task seg_ms_lesion_mp2rage seems perfect for that but for most of my subjects it finds lesions outside of the spinal cord even though there are very visible lesion on the spinal cord. Can you help me figure out why lesion segmentation doesn’t work on my data ?

Here is a close up into what I’m doing :

The image I use is MP2RAGE UNI (spacing : [1, 0.903409, 0.903409] and size : [176, 300, 352]) as this issue showed it works best compare to MP2RAGE T1q.
Segmentation of spinal cord to obtain sc_seg.nii.gz is done with sct_deepseg -i MP2RAGE_UNI.nii.gz -o sc_seg.nii.gz -task seg_ms_sc_mp2rage, the output is manually corrected if necessary. I then crop the image into *MP2RAGE_crop.nii.gz* with the sct_crop_image -i MP2RAGE_UNI.nii.gz -m sc_seg.nii.gz -dilate 32x0x32command as recommended insct_deepseg -list-tasks. And then sct_deepseg -i MP2RAGE_crop.nii.gz -o lesionseg.nii.gz -task seg_ms_lesion_mp2rage`.

Here are my dependancies :

--
Spinal Cord Toolbox (6.2)

sct_check_dependencies 
--


SYSTEM INFORMATION
------------------
SCT info:
- version: 6.2
- path: /home/nolwenn/sct_6.2
OS: linux (Linux-6.8.0-40-generic-x86_64-with-glibc2.35)
CPU cores: Available: 12, Used by ITK functions: 12
RAM: Total: 15627MB, Used: 4395MB, Available: 9218MB

OPTIONAL DEPENDENCIES
---------------------
Check FSLeyes version...............................[OK] (1.10.4)

MANDATORY DEPENDENCIES
----------------------
Check Python executable.............................[OK]
  Using bundled python 3.9.18 (main, Sep 11 2023, 13:41:44) 
[GCC 11.2.0] at /home/nolwenn/sct_6.2/python/envs/venv_sct/bin/python
Check if data are installed.........................[OK]
Check if dipy is installed..........................[OK] (1.5.0)
Check if ivadomed is installed......................[OK] (2.9.9)
Check if matplotlib is installed....................[OK] (3.8.3)
Check if monai is installed.........................[OK] (1.3.0)
Check if nibabel is installed.......................[OK] (3.2.2)
Check if nilearn is installed.......................[OK] (0.10.2)
Check if nnunetv2 is installed......................[OK]
Check if numpy is installed.........................[OK] (1.23.5)
Check if onnxruntime is installed...................[OK] (1.17.0)
Check if pandas is installed........................[OK] (1.4.4)
Check if portalocker is installed...................[OK] (2.8.2)
Check if psutil is installed........................[OK] (5.9.8)
Check if pyqt5 (5.12.3) is installed................[OK] (5.12.3)
Check if pyqt5-sip is installed.....................[OK]
Check if pytest is installed........................[OK] (8.0.0)
Check if pytest-cov is installed....................[OK] (4.1.0)
Check if requests is installed......................[OK] (2.31.0)
Check if requirements-parser is installed...........[OK]
Check if scipy is installed.........................[OK] (1.12.0)
Check if scikit-image is installed..................[OK] (0.22.0)
Check if scikit-learn is installed..................[OK] (1.4.0)
Check if xlwt is installed..........................[OK] (1.3.0)
Check if tqdm is installed..........................[OK] (4.66.2)
Check if transforms3d is installed..................[OK] (0.4.1)
Check if urllib3 is installed.......................[OK] (2.2.0)
Check if pytest_console_scripts is installed........[OK]
Check if pyyaml is installed........................[OK] (6.0.1)
Check if voxelmorph is installed....................[OK] (0.2)
Check if wquantiles is installed....................[OK] (0.4)
Check if xlsxwriter is installed....................[OK] (3.1.9)
Check if spinalcordtoolbox is installed.............[OK]
Check ANTs compatibility with OS ...................[OK]
Check PropSeg compatibility with OS ................[OK]
Check if figure can be opened with PyQt.............Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
[OK]
Check if figure can be opened with matplotlib.......[OK] (Using GUI backend: 'QtAgg')

Regards,
Nolwenn

Hi Nolwenn,

Would you be able to send me (will stay private) 1-2 dataset where you observe issues? It will be the most efficient way to help.

Cheers,
Julien

Hello,
Yes, on what email address should I send it to ?
Thanks
Nolwenn

jcohen@polymtl.ca

Hi,

I looked at your images. I see two issues:

Problem with spinal cord segmentation

The model you are using to segment the cord is sub-optimal. For example, in one of the image you shared, the segmentation stops below an MS lesion. I recommend you use the contrast-agnostic model, which has been updated as of SCT v6.4. See example below (red: seg_ms_sc_mp2rage | green: seg_sc_contrast_agnostic):

ezgif-4-c96902ec34

Problem with cropping

Your images have RAS orientation, therefore the dilate command you used is wrong. It should be 32x32x0 instead of 32x0x32.

Full syntax:

# Segment cord
sct_deepseg -i subject_1_SCT_issue.nii.gz -o subject_1_SCT_issue_SCseg-contrastagnostic.nii.gz -task seg_sc_contrast_agnostic
# Crop image
sct_crop_image -i subject_1_SCT_issue.nii.gz -m subject_1_SCT_issue_SCseg-contrastagnostic.nii.gz -dilate 32x32x0 -o subject_1_SCT_issue_crop.nii.gz 
# Segment MS lesions
sct_deepseg -i subject_1_SCT_issue_crop.nii.gz -o subject_1_SCT_issue_LESIONseg.nii.gz -task seg_ms_lesion_mp2rage

See results:

ezgif-4-8cd3168569

1 Like

Hi,
Thanks this helped a lot.
Nolwenn