Spinalcordtoolbox: Generate a deepseg model for exvivo spinal cord

Created on 5 Nov 2020  路  30Comments  路  Source: spinalcordtoolbox/spinalcordtoolbox

Context: https://forum.spinalcordmri.org/t/error-when-running-sct-get-centerline/551/8

This user privately shared beautiful DWI data, see an example here:
Screen Shot 2020-11-04 at 9 55 46 PM

We need to generate a specific deepseg model to segment the spinal cord and gray matter. I believe @charleygros has done most of the work for his previous exvivo spinalcord segmentation (ISMRM submission).

Most helpful comment

I am running the T1 exvivo model on the DWI data (data of interest in this PR) --> from there we will be able to see how much fine-tuning is needed!

All 30 comments

I am running the T1 exvivo model on the DWI data (data of interest in this PR) --> from there we will be able to see how much fine-tuning is needed!

Herebelow the GM segmentation on T0000 of the provided DWI data:
dwi_seg

The contrast is different from the original data used to train the model.. the segmentation is not catastrophic but is not great.
I am confident that we could do a good transfer learning using this model if we had access to ~20 slices on few of subjects.

Great! @alexfoias can you please help generating those 20 slices? we just need a manual correction of the current predictions (which are not too bad)

@jcohenadad sure. where can I find the data ?

@jcohenadad sure. where can I find the data ?

@charleygros will follow-up with you

Oh! Thanks for helping @alexfoias !
The data and the model predictions are in duke/projects/ivadomed/gm_dwi_exvivo. Please feel free to move the dataset to a more appropriate place, if any

Additional Infos:

  • 40 slices on both images would be wonderful
  • grey matter
  • preferably quite sparse, eg slice # 100, 200, 300, etc instead of # 101, 102, 103 etc.
  • if your manual segmentation could have the suffix _seg-manual with these 40 slices only that would be fantastic

Many thanks

@charleygros So should I start from duke/projects/ivadomed//gm_dwi_exvivo/derivatives/anat/sub-3902_bottom/anat/sub-3902_bottom_dwi_T0000_seg.nii.gz and duke/projects/ivadomed//gm_dwi_exvivo/derivatives/anat/sub-3902_top/anat/sub-3902_top_dwi_T0000_seg.nii.gz ? Or do I have to do it from scratch ?

@charleygros Could you please answer my previous comment ? thanks

@charleygros Could you please answer my previous comment ? thanks

Apologies for delayed reply.

@charleygros So should I start from duke/projects/ivadomed//gm_dwi_exvivo/derivatives/anat/sub-3902_bottom/anat/sub-3902_bottom_dwi_T0000_seg.nii.gz and duke/projects/ivadomed//gm_dwi_exvivo/derivatives/anat/sub-3902_top/anat/sub-3902_top_dwi_T0000_seg.nii.gz ? Or do I have to do it from scratch ?

You are welcome to use *_seg.nii.gz if it helps, otherwise from scratch is good too. Whatever is easier for you! Thanks again!!

Hi All,

Thank you very much for help and appreciate your effort and time.

Cheers,

Ibrahim

Please let me know if you need more DW data.
Many thanks in advance

@charleygros sorry for the delay, but with the Big Sur upgrade I had some issue with FSLeyes. I have added the manual segmentations under duke/projects/ivadomed/gm_dwi_exvivo/derivatives/

Many thanks @alexfoias ! I got them now!

@alexfoias: Would it be possible to ask for 20 additional slices on both images?

I have updated the prediction files (eg duke/projects/ivadomed/gm_dwi_exvivo/derivatives/labels/sub-3902-bottom/anat/sub-3902-bottom_dwi_T0000_seg.nii.gz) --> the new model is significantly better than before.. but still not good enough to be used in practice.

If you could segment 20 more slices on both images (top and bottom) by updating the _seg_manual files (so we will endup with 60 slices on both images), that would be great!! Many thanks in advance

Hi @charleygros,

Sorry for the delay, I'll take care of it this afternoon. I'll let you know when it's done.

Sorry for the delay, I'll take care of it this afternoon. I'll let you know when it's done.

Nothing to be sorry about! Thanks again @alexfoias , this is really helpful

@charleygros I added more slices. I saved them in a new file *_seg_manual_new in case you want to keep also the ones with less slices, otherwise you can remove the old ones.

@charleygros I added more slices. I saved them in a new file *_seg_manual_new in case you want to keep also the ones with less slices, otherwise you can remove the old ones.

This is great @alexfoias !

Follow up: Grey matter model now works well. I contacted Ibrahim so that he could help us to generate some WM GT to train a multiclass model --> that's the one we will release and made available to the SCT community.

Follow up: Grey matter model now works well. I contacted Ibrahim so that he could help us to generate some WM GT to train a multiclass model --> that's the one we will release and made available to the SCT community.

don鈥檛 we want to generate SC GT, and then subtract the GM from the SC to ensure perfect interface between GM and WM?

don鈥檛 we want to generate SC GT, and then subtract the GM from the SC to ensure perfect interface between GM and WM?

With the normRelu final activation (cf SoftSeg multiclass) we can ensure mutually exclusive segmentation. But the "perfect interface" challenge is indeed not theoretically ensured. Let's do as you said, thanks for refreshing my memory.

Note: Based on recent experiments with SoftSeg: I would be curious to see how in practice the multiclass model would behave regarding this criteria: if it provides good interface (ie no background voxel between WM and GM) --> maybe we could go with this approach as it makes the processing easier (one model, one inference).

Note: Based on recent experiments with SoftSeg: I would be curious to see how in practice the multiclass model would behave regarding this criteria: if it provides good interface (ie no background voxel between WM and GM) --> maybe we could go with this approach as it makes the processing easier (one model, one inference).

That would be awesome indeed!!!

Hi SCT greatest experts ever,

Thank you all for all your effort and time to make this model powerful. @charleygros I'll be waiting for your instruction tomorrow 馃榾
Many thanks once again @alexfoias @jcohenadad @charleygros

Cheers,

Ibrahim

Hi @charleygros,

Sorry for the delay, manual binary mask is done. Please check the dataset link via email. Also, Please let me know if you need further adjustments or extra slices.

Many Thanks in advance!

Cheers,

Ibrahim

Hi All,
Hope you are doing well. Any updates so far on the Ex vivo SC model.

Many thanks in advance..

Cheers,

Ibrahim

Thank you for your message @ihattan2020 and apologies for the important delay. I will send updates by tomorrow mid-day.

Many thanks @charleygros for your updates. Great, looking forward hearing from you.

Cheers,

Ibrahim

Update: The ground-truth you generated looks great @ihattan2020. I performed some preprocessing on it and dataset assembling this morning. I will start the model training within the next hour, which should take less than a day. Next update by tomorrow midday. Cheers

Results were satisfying this morning but I think we can push it further: I have just added some extra data augmentation steps et started the training again. I will keep you posted again by tonight.
The last step is simply the integration into SCT so that you can use the model via sct_deepseg, which should not be long to do.

@ihattan2020 : The model has been successfully generated. I am now working on the integration within the SCT (see PR #3224 ), which should be finished by the end of the week.

@ihattan2020: It is now done :-)

Model and documentation here.

To use the model with SCT (as explained above): you can either use SCT master branch, or wait for the (very soon coming) next release (5.1.1).

Please let us know how it goes! Cheers

Was this page helpful?
0 / 5 - 0 ratings