neuropoly / totalspineseg

Segmentation of vertebrae, intervertebral discs, spinal cord and CSF from MRI images.
5 stars 0 forks source link

Issue when subject has 4 lumbar vertebrae #30

Closed yw7 closed 4 hours ago

yw7 commented 1 month ago

As seen in the attached image (whole_amuPAM50016_T1w) the 2 steps approach is not working when the subject has 4 lumbar vertebrae: image

yw7 commented 1 month ago

The isue originate from the second step model, when no L5 present the L5-S IVD is not present then the model confuses the sacrum and L5 because from the binary mask point of view if there is no odd IVD mask above (L5-S) it is L5 then from the anatomy point of view it is the sacrum. To address this issue we need to make the model use the anatomy to segment the sacrum and the the odd IVD mask to make the oddqeven vertebrae and IVD so we will input the second model for each image another set of image+seg in wich the odd IVD mask point to the even IVD mask and also the odd and even IVD and mask are switched in the output then the model will learn the required behavior:

The issue originates from the second-step model. When L5 is not present (L5-S IVD is absent), the model confuses the sacrum and L5. This confusion arises because, from a binary mask perspective, if there is no odd IVD mask above (L5-S), it is considered to be L5. However, from an anatomical point of view, it should be identified as the sacrum.

To address this issue, we need to modify the model. Specifically:

We will input a second model for each image, where the odd IVD mask points to the even IVD mask, and the odd and even IVD masks are switched in the output. This approach will help the model learn the correct behavior.

image

yw7 commented 4 hours ago

Done here https://github.com/neuropoly/totalspineseg/commit/9cd774ef29191c06d38b17006622b7294095d419