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

MS lesions masks outside the SC mask in basel-mp2rage dataset #266

Open
Nilser3 opened this issue Oct 2, 2023 · 9 comments
Open

MS lesions masks outside the SC mask in basel-mp2rage dataset #266

Nilser3 opened this issue Oct 2, 2023 · 9 comments

Comments

@Nilser3
Copy link

Nilser3 commented Oct 2, 2023

Description

139 subjects of the 180 MS subjects in the basel-mp2rage database have lesion segmentation pixels (lesion-manualNeuroPoly mask) that are outside the SC segmentation

Here an example:

sub-P121

lesion_SC
List of subjects with this issue: sub-P001, sub-P003, sub-P004, sub-P005, sub-P006, sub-P007, sub-P010, sub-P011, sub-P012, sub-P013, sub-P014, sub-P016, sub-P019, sub-P021, sub-P022, sub-P023, sub-P024, sub-P025, sub-P026, sub-P027, sub-P028, sub-P030, sub-P031, sub-P033, sub-P034, sub-P035, sub-P036, sub-P037, sub-P038, sub-P039, sub-P040, sub-P041, sub-P042, sub-P044, sub-P045, sub-P047, sub-P050, sub-P051, sub-P053, sub-P055, sub-P056, sub-P057, sub-P058, sub-P059, sub-P061, sub-P062, sub-P063, sub-P065, sub-P066, sub-P067, sub-P068, sub-P069, sub-P070, sub-P071, sub-P072, sub-P075, sub-P078, sub-P079, sub-P082, sub-P084, sub-P085, sub-P086, sub-P087, sub-P088, sub-P094, sub-P095, sub-P096, sub-P097, sub-P098, sub-P099, sub-P100, sub-P101, sub-P103, sub-P104, sub-P106, sub-P108, sub-P109, sub-P110, sub-P111, sub-P112, sub-P114, sub-P116, sub-P117, sub-P119, sub-P120, sub-P121, sub-P122, sub-P124, sub-P125, sub-P129, sub-P130, sub-P132, sub-P134, sub-P138, sub-P139, sub-P141, sub-P142, sub-P144, sub-P145, sub-P146, sub-P148, sub-P149, sub-P151, sub-P153, sub-P156, sub-P157, sub-P160, sub-P161, sub-P165, sub-P167, sub-P169, sub-P170, sub-P173, sub-P174, sub-P175, sub-P176, sub-P178, sub-P179, sub-P180, sub-P181, sub-P182, sub-P183, sub-P185, sub-P187, sub-P188, sub-P190, sub-P191, sub-P192, sub-P194, sub-P197, sub-P199, sub-P200, sub-P241, sub-P242, sub-P243, sub-P244, sub-P246, sub-P249, sub-P250

Maybe we should redefine the SC masks by making a union of the MS lesions and current SC masks

@jcohenadad
Copy link
Member

Thank you for spotting this @Nilser3 🙏

In any case, I think that our plan was to re-create all SC segmentations using the contrast-agnostic model. So I would suggest to:

  • run the contrast-agnostic model
  • manually fix the segmentations is needed
  • update the repository with the new segmentations
  • the JSON files would include the agnostic model and the manual curation (when it exists)

Does that make sense?

@Nilser3
Copy link
Author

Nilser3 commented Oct 4, 2023

Hi @jcohenadad

Thanks to the help of @naga-karthik and @sandrinebedard
I have executed the contrast-agnostic model on the basel-mp2rage and marseille-3T-mp2rage datas

Running inference

Based on: https://github.com/sct-pipeline/contrast-agnostic-softseg-spinalcord/blob/nk/monai/monai/inference_instructions.md#method-1-running-inference-on-a-single-image

python monai/run_inference_single_image.py --path-img /mnt/nvme/nilaia/basel-mp2rage/sub-P121/anat/sub-P121_UNIT1.nii.gz --chkp-path  /mnt/duke/temp/muena/contrast-agnostic/final_monai_model/nnunet_nf\=32_DS\=1_opt\=adam_lr\=0.001_AdapW_CCrop_bs\=2_64x192x320_20230918-2253/ --path-out test_contrast_agnostic  --device cpu

Here the same patient reported above sub-P121:

sub-P121

I have binarized the soft masks with a threshold of 0.5, and my issue persists in 137 patients out of 180 subjects.

I think we should retrain a new SC soft model with these soft masks in mp2rage datas.

@jcohenadad
Copy link
Member

 I have binarized the soft masks with a threshold of 0.5, and my issue persists in 137 patients out of 180 subjects. I think we should retrain a new SC soft model with these soft masks in mp2rage datas.

Agreed. Could you please manually correct these 137 patients? Thanks! Good job!

@Nilser3
Copy link
Author

Nilser3 commented Jan 5, 2024

To fix the MS lesion masks outside the SC,
I first made a manual correction based on binarized contrast-agnostic SC masks.
Then I made a union of these corrected SC masks with MS lesions (lesion-manualNeuroPoly.nii.gz) masks.

Here is the QC for basel-mp2rage dataset from sub-P001 to sub-P086

Legend of QC maks

  • SC_seg.nii.gz -> sct_deepseg_sc
  • pred_bin.nii.gz -> contrast-agnostic (version v2.0), binarized with threshold 0.5001
  • SC_seg_rater2.nii.gz -> pred_bin.nii.gz corrected by rater 2 (Nilser) + union with MS lesion masks.

@jcohenadad
Copy link
Member

I suggest we put a hold on the correction of the masks until this issue is settled: sct-pipeline/contrast-agnostic-softseg-spinalcord#99

@Nilser3
Copy link
Author

Nilser3 commented Feb 13, 2024

Exploring the latest version (2024-02-11) of contrast-agnostic model on MP2RAGE data

Model available in : duke/temp/muena/contrast-agnostic/monai_bin_model

For basel-mp2rage dataset (here the QC), I observe that the masks generated by this latest version are closer to those of the GT (manual correction based on version v2.0) for sub-P001 to sub-P086.

Same observations on marseille-3T-mp2rage dataset (here the QC), where even in the presence of large MS lesions, the latest model performs slightly better than the previous one.

Legend of QC:

  • contrast-agnostic.V2.0/.../...pred_bin.nii.gz -> contrast-agnostic (version v2.0), binarized with threshold 0.5001
  • contrast-agnostic_monai_bin_model/.../...pred.nii.gz -> contrast-agnostic latest version (2024-02-11) using run_inference_single_image.py
  • SC_seg_rater2.nii.gz -> contrast-agnostic.V2.0 segmentation corrected by rater 2 (Nilser)

@jcohenadad I still have to manually correct 203 subjects from basel-mp2rageand all nih-ms-mp2rage, maybe I should finish these correctiones based on the latest version instead of version 2.0 ?

@jcohenadad
Copy link
Member

jcohenadad commented Feb 13, 2024

@jcohenadad I still have to manually correct 203 subjects from basel-mp2rageand all nih-ms-mp2rage, maybe I should finish these correctiones based on the latest version instead of version 2.0 ?

what do you mean by "finish these corrections based on the latest version instead of version 2.0"? did you mean:

  1. run the latest version, and then perform manual correction, or
  2. finish manual correction, and then run the latest version (but then, I don't see the logic here)

if you meant "1", then yes, I agree. Also, only do 20 subj and show me for validation before moving forward

@Nilser3
Copy link
Author

Nilser3 commented Feb 13, 2024

I meant 1, run the latest version and then perform the manual correction.
perfect, I will do so

@Nilser3
Copy link
Author

Nilser3 commented Apr 18, 2024

Hi @naga-karthik

Here the SC manual corrections for subjects (sub-P001 to sub-P086) on basel-mp2rage data

branch: nlm/add_sc_manual_correction
commit: 961a0c0afc753ba960155548e14c227d14703c1b

QC here

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

No branches or pull requests

2 participants