Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing contrast-agnostic model on GRE magnitude data #108

Closed
jcohenadad opened this issue Jun 5, 2024 · 6 comments
Closed

Testing contrast-agnostic model on GRE magnitude data #108

jcohenadad opened this issue Jun 5, 2024 · 6 comments

Comments

@jcohenadad
Copy link
Member

jcohenadad commented Jun 5, 2024

As of SCT version spinalcordtoolbox/spinalcordtoolbox@bb479d8 (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
Copy link
Member Author

jcohenadad commented Jun 5, 2024

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).

@naga-karthik
Copy link
Collaborator

naga-karthik commented Feb 5, 2025

I added a comparison with the prediction from the new model. The gif below shows the comparison. Show in red is model M5prime, and shown in green is nnunet3D

Image

We get a decent segmentation with the nnUNet3D model (green). Note that this is completely out-of-distribution.

@jcohenadad
Copy link
Member Author

jcohenadad commented Feb 5, 2025

#108 (comment)

@naga-karthik can you please replace 'new' and 'old' with the actual names of the model in your post? (eg: M5', nnUnet3D_20250205, etc.) thanks!

@naga-karthik
Copy link
Collaborator

naga-karthik commented Feb 5, 2025

Done now!

@jcohenadad
Copy link
Member Author

We get a decent segmentation with the nnUNet3D model (green). Note that this is completely out-of-distribution.

cool! although i would be cautious about interpretation-- there seem to be some oversegmentation at the bottom

@naga-karthik
Copy link
Collaborator

there seem to be some oversegmentation at the bottom

indeed ! the nnunet prediction is relatively better as it predicts something rather than an empty pred

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants