ivadomed / model_seg_ms_mp2rage

Model repository for MS lesion segmentation on MP2RAGE data from University of Basel
MIT License
2 stars 0 forks source link

Is dilation necessary at inference time? #44

Open jcohenadad opened 2 years ago

jcohenadad commented 2 years ago

Dilation adds a line of code for users, so it would be nice if this step was not necessary. See e.g. this tutorial for using the new models: https://github.com/spinalcordtoolbox/spinalcordtoolbox/pull/3637#issuecomment-1021811734

I've tried without and with dilation (ball=5) in one subject (P007), and results are slightly different, but a more systematic comparison should be done in order to advise on the best course of action.

@uzaymacar do you have any suggestions/insights? I'm thinking that maybe in the future we could also train without dilation (I don't think it is really necessary because the SC will always be included in the cropped image, even without dilation).

joshuacwnewton commented 2 years ago

Dilation adds a line of code for users, so it would be nice if this step was not necessary. See e.g. this tutorial for using the new models: spinalcordtoolbox/spinalcordtoolbox#3637 (comment)

Perhaps I'm missing something, but I don't see a dilation step in the linked comment. Could you clarify what you mean by "line of code for our users"?

jcohenadad commented 2 years ago

Sorry for the lack of clarity. Indeed, the link to spinalcordtoolbox#3637 did not include the dilation step, which is precisely the point of this issue.

By default, dilation is performed during preprocessing, before training the model: https://github.com/ivadomed/model_seg_ms_mp2rage/blob/0dccf787f459a14c085fa7e4cf5e2da69e2edcd5/preprocessing/preprocess_data.sh#L123

And my suggestion would be to get rid of this dilation step.

uzaymacar commented 2 years ago

I saw dilation as an non-vital, extra preprocessing step to make sure we capture the ROI during inference and model development. For example, I would expect it to be helpful in cases where lesions are near the boundaries of the SC mask.

That being said, the following next steps can help us decide whether or not we can remove the dilation step safely: