ivadomed / canproco

Code for preprocessing the CanProCo brain and spinal cord dataset
MIT License
4 stars 1 forks source link

Issue with contrast-agnostic soft SC predictions #72

Open naga-karthik opened 11 months ago

naga-karthik commented 11 months ago

I was going through contrast-agnostic soft predictions on PSIR/STIR images along with @valosekj and found an issue with this line:

https://github.com/ivadomed/canproco/blob/7316f4cff9bac0c72f2db0582b091b2b319e32ac/segment_sc_contrast-agnostic/01_segment_sc_contrast-agnostic.sh#L181C12-L181C12

While it seems like this line adds 4 predictions (the original + 3 flipped), in reality it is indeed adding only 2 predictions. The max value of the soft prediction is 2 (see the picture below)

incorrect max value Screen Shot 2023-12-12 at 6 40 01 PM

I corrected this line locally using -add only once and the images to add in a list:

sct_maths -i sub-cal056_ses-M0_STIR_flip_x_pred_back.nii.gz -add sub-cal056_ses-M0_STIR_flip_y_pred_back.nii.gz sub-cal056_ses-M0_STIR_flip_z_pred_back.nii.gz sub-cal056_ses-M0_STIR_pred.nii.gz -o sub-cal056_ses-M0_STIR_pred_sum4.nii.gz

and got the following result:

correct max value Screen Shot 2023-12-12 at 6 42 05 PM

This error should not have affected an immediate results as these predictions were binarized here. However, these soft preds cannot be used for re-training the contrast-agnostic model with STIR/PSIR contrasts.

valosekj commented 11 months ago

Yeah, sorry, my mistake. I should have used only a single -add. I do not know why I used -add three times.