{
  "id": 529899,
  "title": "More segmentations",
  "url": "/competitions/rsna-2024-lumbar-spine-degenerative-classification/discussion/529899",
  "author_name": "",
  "post_date": "2024-08-23T12:58:18.400763900Z",
  "votes": 12,
  "comment_count": 6,
  "views": 0,
  "content": "<p>Hi,</p>\n<p>I was experimenting with projecting sagittal slices onto axial images. Let's say you've trained your first segmentation model to identify the spine levels. After that, you might want to find the closest axial slices to a specific point, like this:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6259210%2F348948d791094b9629a47d2165593745%2Fprojection1.png?generation=1724417246458296&amp;alt=media\" alt=\"\"></p>\n<p>In the example above, I expected this result. We project the first and last sagittal ImagePositionPatient (in magenta) and the middle sagittal slice (in red). This approach gives us all the information needed to crop the region of interest (ROI) for training our classification model.</p>\n<p>There’s nothing new here, really—this has been shared by others before.</p>\n<p>But what if we encounter something like this? (same magenta boundary sagittal projections and middle red slice):</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6259210%2F6c126b89f3929fbadc92a31f1d9fd74f%2Fprojection2.jfif?generation=1724417341984712&amp;alt=media\" alt=\"\"></p>\n<p>Here, we can clearly see that the middle projection is significantly off-center.</p>\n<p>To obtain a proper ROI center, we could train another segmentation model using the coordinates provided by the organizers, like this:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6259210%2Fa4e5c24d37b66f7182ddf75f0b77e4bf%2Fprojection3.jfif?generation=1724417573947974&amp;alt=media\" alt=\"\"></p>\n<p>Now it’s your turn—good luck!</p>",
  "messages": [
    {
      "id": "2968011",
      "postDate": "08/23/2024 12:58:18",
      "content": "<p>Hi,</p>\n<p>I was experimenting with projecting sagittal slices onto axial images. Let's say you've trained your first segmentation model to identify the spine levels. After that, you might want to find the closest axial slices to a specific point, like this:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6259210%2F348948d791094b9629a47d2165593745%2Fprojection1.png?generation=1724417246458296&amp;alt=media\" alt=\"\"></p>\n<p>In the example above, I expected this result. We project the first and last sagittal ImagePositionPatient (in magenta) and the middle sagittal slice (in red). This approach gives us all the information needed to crop the region of interest (ROI) for training our classification model.</p>\n<p>There’s nothing new here, really—this has been shared by others before.</p>\n<p>But what if we encounter something like this? (same magenta boundary sagittal projections and middle red slice):</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6259210%2F6c126b89f3929fbadc92a31f1d9fd74f%2Fprojection2.jfif?generation=1724417341984712&amp;alt=media\" alt=\"\"></p>\n<p>Here, we can clearly see that the middle projection is significantly off-center.</p>\n<p>To obtain a proper ROI center, we could train another segmentation model using the coordinates provided by the organizers, like this:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6259210%2Fa4e5c24d37b66f7182ddf75f0b77e4bf%2Fprojection3.jfif?generation=1724417573947974&amp;alt=media\" alt=\"\"></p>\n<p>Now it’s your turn—good luck!</p>",
      "rawMarkdown": "Hi,\n\nI was experimenting with projecting sagittal slices onto axial images. Let's say you've trained your first segmentation model to identify the spine levels. After that, you might want to find the closest axial slices to a specific point, like this:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6259210%2F348948d791094b9629a47d2165593745%2Fprojection1.png?generation=1724417246458296&alt=media)\n\n\nIn the example above, I expected this result. We project the first and last sagittal ImagePositionPatient (in magenta) and the middle sagittal slice (in red). This approach gives us all the information needed to crop the region of interest (ROI) for training our classification model.\n\nThere’s nothing new here, really—this has been shared by others before.\n\nBut what if we encounter something like this? (same magenta boundary sagittal projections and middle red slice):\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6259210%2F6c126b89f3929fbadc92a31f1d9fd74f%2Fprojection2.jfif?generation=1724417341984712&alt=media)\n\nHere, we can clearly see that the middle projection is significantly off-center.\n\nTo obtain a proper ROI center, we could train another segmentation model using the coordinates provided by the organizers, like this:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6259210%2Fa4e5c24d37b66f7182ddf75f0b77e4bf%2Fprojection3.jfif?generation=1724417573947974&alt=media)\n\nNow it’s your turn—good luck!",
      "votes": null
    },
    {
      "id": "2968087",
      "postDate": "08/23/2024 14:11:33",
      "content": "<p>Hi. <a href=\"https://www.kaggle.com/code/hengck23/ver-1-demo-workflow-2-stage-approach\" target=\"_blank\">HENGCK23</a> shared how to assign axial slices to segmented sagittal levels. For your purposes this could be done just viceversa rigth? I mean, use shared \"3D World\" to assign sagittal slices to segmented axial sides (or middle sides point).</p>",
      "rawMarkdown": "Hi. [HENGCK23](https://www.kaggle.com/code/hengck23/ver-1-demo-workflow-2-stage-approach) shared how to assign axial slices to segmented sagittal levels. For your purposes this could be done just viceversa rigth? I mean, use shared \"3D World\" to assign sagittal slices to segmented axial sides (or middle sides point).",
      "votes": null
    },
    {
      "id": "2968119",
      "postDate": "08/23/2024 14:55:07",
      "content": "<p><a href=\"https://www.kaggle.com/sacuscreed\" target=\"_blank\">@sacuscreed</a> assignment of the slices by the levels is not a problem.  The problem is to get the centroid on the axial central canal.</p>",
      "rawMarkdown": "sacuscreed assignment of the slices by the levels is not a problem.  The problem is to get the centroid on the axial central canal.",
      "votes": null
    },
    {
      "id": "2968134",
      "postDate": "08/23/2024 15:12:53",
      "content": "<p>As you shared:</p>\n<p>Left and right segmentation on axial slice.</p>\n<p>centroid = (L+R)/2</p>\n<p>DICOM projections to get the Sagittal slices closer to that centroid.</p>\n<p>The problem would be that this centroid changes significantly across the slices. So bassically closer sagittal slices will change from an axial slice to another.</p>",
      "rawMarkdown": "As you shared:\n\nLeft and right segmentation on axial slice.\n\ncentroid = (L+R)/2\n\nDICOM projections to get the Sagittal slices closer to that centroid.\n\nThe problem would be that this centroid changes significantly across the slices. So bassically closer sagittal slices will change from an axial slice to another.",
      "votes": null
    },
    {
      "id": "2968140",
      "postDate": "08/23/2024 15:19:55",
      "content": "<p>so it means for your pipeline you do not find the centroid, but rather taking the entire axial slice, which gives 0.47 LB overall :D?</p>",
      "rawMarkdown": "so it means for your pipeline you do not find the centroid, but rather taking the entire axial slice, which gives 0.47 LB overall :D?",
      "votes": null
    },
    {
      "id": "2968166",
      "postDate": "08/23/2024 15:39:12",
      "content": "<p>UPS. No comments. Actually, no. I think I've already shared that I reproduced  sagittal T1 segementation (from foraminal_UNet_ViT_train at code section) to all volumes. So I think yes, I find centroids. If they are levels and sides at corresponding slices.</p>\n<p>And once you have L and R, the spine is very close to (L+R)/2. That I use to determine the axial level (Axial Levels at code section). Any suggestions are wellcome.</p>\n<p>EDIT: May be I'm wrong but I still avoid using metadata. May be I've just lucky overfitted public. We'll see, two months to go.</p>",
      "rawMarkdown": "UPS. No comments. Actually, no. I think I've already shared that I reproduced  sagittal T1 segementation (from foraminal_UNet_ViT_train at code section) to all volumes. So I think yes, I find centroids. If they are levels and sides at corresponding slices.\n\nAnd once you have L and R, the spine is very close to (L+R)/2. That I use to determine the axial level (Axial Levels at code section). Any suggestions are wellcome.\n\nEDIT: May be I'm wrong but I still avoid using metadata. May be I've just lucky overfitted public. We'll see, two months to go.",
      "votes": null
    },
    {
      "id": "2968206",
      "postDate": "08/23/2024 16:12:28",
      "content": "<p>:D, no worries. Generally, there are more T1 slices for the study than T2. They cover foraminal left and right which give you the center of axial by simple (L+R)/2. As you mentioned, it is not reliable, at least what I see by projecting T2.</p>",
      "rawMarkdown": ":D, no worries. Generally, there are more T1 slices for the study than T2. They cover foraminal left and right which give you the center of axial by simple (L+R)/2. As you mentioned, it is not reliable, at least what I see by projecting T2.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2968087,
      "author_name": "sacuscreed",
      "author_url": "",
      "post_date": "08/23/2024 14:11:33",
      "content": "<p>Hi. <a href=\"https://www.kaggle.com/code/hengck23/ver-1-demo-workflow-2-stage-approach\" target=\"_blank\">HENGCK23</a> shared how to assign axial slices to segmented sagittal levels. For your purposes this could be done just viceversa rigth? I mean, use shared \"3D World\" to assign sagittal slices to segmented axial sides (or middle sides point).</p>",
      "votes": null,
      "replies": [
        {
          "id": 2968119,
          "author_name": "sergiosaharovskiy",
          "author_url": "",
          "post_date": "08/23/2024 14:55:07",
          "content": "<p><a href=\"https://www.kaggle.com/sacuscreed\" target=\"_blank\">@sacuscreed</a> assignment of the slices by the levels is not a problem.  The problem is to get the centroid on the axial central canal.</p>",
          "votes": null,
          "replies": [
            {
              "id": 2968134,
              "author_name": "sacuscreed",
              "author_url": "",
              "post_date": "08/23/2024 15:12:53",
              "content": "<p>As you shared:</p>\n<p>Left and right segmentation on axial slice.</p>\n<p>centroid = (L+R)/2</p>\n<p>DICOM projections to get the Sagittal slices closer to that centroid.</p>\n<p>The problem would be that this centroid changes significantly across the slices. So bassically closer sagittal slices will change from an axial slice to another.</p>",
              "votes": null,
              "replies": [
                {
                  "id": 2968140,
                  "author_name": "sergiosaharovskiy",
                  "author_url": "",
                  "post_date": "08/23/2024 15:19:55",
                  "content": "<p>so it means for your pipeline you do not find the centroid, but rather taking the entire axial slice, which gives 0.47 LB overall :D?</p>",
                  "votes": null,
                  "replies": [
                    {
                      "id": 2968166,
                      "author_name": "sacuscreed",
                      "author_url": "",
                      "post_date": "08/23/2024 15:39:12",
                      "content": "<p>UPS. No comments. Actually, no. I think I've already shared that I reproduced  sagittal T1 segementation (from foraminal_UNet_ViT_train at code section) to all volumes. So I think yes, I find centroids. If they are levels and sides at corresponding slices.</p>\n<p>And once you have L and R, the spine is very close to (L+R)/2. That I use to determine the axial level (Axial Levels at code section). Any suggestions are wellcome.</p>\n<p>EDIT: May be I'm wrong but I still avoid using metadata. May be I've just lucky overfitted public. We'll see, two months to go.</p>",
                      "votes": null,
                      "replies": [
                        {
                          "id": 2968206,
                          "author_name": "sergiosaharovskiy",
                          "author_url": "",
                          "post_date": "08/23/2024 16:12:28",
                          "content": "<p>:D, no worries. Generally, there are more T1 slices for the study than T2. They cover foraminal left and right which give you the center of axial by simple (L+R)/2. As you mentioned, it is not reliable, at least what I see by projecting T2.</p>",
                          "votes": null,
                          "replies": []
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2968011": "Hi,\n\nI was experimenting with projecting sagittal slices onto axial images. Let's say you've trained your first segmentation model to identify the spine levels. After that, you might want to find the closest axial slices to a specific point, like this:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6259210%2F348948d791094b9629a47d2165593745%2Fprojection1.png?generation=1724417246458296&alt=media)\n\n\nIn the example above, I expected this result. We project the first and last sagittal ImagePositionPatient (in magenta) and the middle sagittal slice (in red). This approach gives us all the information needed to crop the region of interest (ROI) for training our classification model.\n\nThere’s nothing new here, really—this has been shared by others before.\n\nBut what if we encounter something like this? (same magenta boundary sagittal projections and middle red slice):\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6259210%2F6c126b89f3929fbadc92a31f1d9fd74f%2Fprojection2.jfif?generation=1724417341984712&alt=media)\n\nHere, we can clearly see that the middle projection is significantly off-center.\n\nTo obtain a proper ROI center, we could train another segmentation model using the coordinates provided by the organizers, like this:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6259210%2Fa4e5c24d37b66f7182ddf75f0b77e4bf%2Fprojection3.jfif?generation=1724417573947974&alt=media)\n\nNow it’s your turn—good luck!",
    "2968087": "Hi. [HENGCK23](https://www.kaggle.com/code/hengck23/ver-1-demo-workflow-2-stage-approach) shared how to assign axial slices to segmented sagittal levels. For your purposes this could be done just viceversa rigth? I mean, use shared \"3D World\" to assign sagittal slices to segmented axial sides (or middle sides point).",
    "2968119": "sacuscreed assignment of the slices by the levels is not a problem.  The problem is to get the centroid on the axial central canal.",
    "2968134": "As you shared:\n\nLeft and right segmentation on axial slice.\n\ncentroid = (L+R)/2\n\nDICOM projections to get the Sagittal slices closer to that centroid.\n\nThe problem would be that this centroid changes significantly across the slices. So bassically closer sagittal slices will change from an axial slice to another.",
    "2968140": "so it means for your pipeline you do not find the centroid, but rather taking the entire axial slice, which gives 0.47 LB overall :D?",
    "2968166": "UPS. No comments. Actually, no. I think I've already shared that I reproduced  sagittal T1 segementation (from foraminal_UNet_ViT_train at code section) to all volumes. So I think yes, I find centroids. If they are levels and sides at corresponding slices.\n\nAnd once you have L and R, the spine is very close to (L+R)/2. That I use to determine the axial level (Axial Levels at code section). Any suggestions are wellcome.\n\nEDIT: May be I'm wrong but I still avoid using metadata. May be I've just lucky overfitted public. We'll see, two months to go.",
    "2968206": ":D, no worries. Generally, there are more T1 slices for the study than T2. They cover foraminal left and right which give you the center of axial by simple (L+R)/2. As you mentioned, it is not reliable, at least what I see by projecting T2."
  },
  "source": "meta"
}