{
  "id": 513401,
  "title": "Transform samples to unified plane",
  "url": "/competitions/rsna-2024-lumbar-spine-degenerative-classification/discussion/513401",
  "author_name": "",
  "post_date": "2024-06-20T02:50:34.122578600Z",
  "votes": 1,
  "comment_count": 3,
  "views": 0,
  "content": "<p>Hi all, I'm trying to figure how to convert dimensions of the sagittal and coronal samples to axial, in order to somewhat be able to use all of the data in the same backbone layer. I'm wondering if anyone knows how to do this properly in numpy.</p>",
  "messages": [
    {
      "id": "2880065",
      "postDate": "06/20/2024 02:50:34",
      "content": "<p>Hi all, I'm trying to figure how to convert dimensions of the sagittal and coronal samples to axial, in order to somewhat be able to use all of the data in the same backbone layer. I'm wondering if anyone knows how to do this properly in numpy.</p>",
      "rawMarkdown": "Hi all, I'm trying to figure how to convert dimensions of the sagittal and coronal samples to axial, in order to somewhat be able to use all of the data in the same backbone layer. I'm wondering if anyone knows how to do this properly in numpy.",
      "votes": null
    },
    {
      "id": "2884226",
      "postDate": "06/22/2024 11:07:27",
      "content": "<p>I take it you are trying to <strong>reorient</strong> sagittal T1 and T2 series to axial.<br>\nSome context: I have tried <code>torchio</code> library to read volumes. Previous post on this is here: <a href=\"https://www.kaggle.com/competitions/rsna-2024-lumbar-spine-degenerative-classification/discussion/510606#2863142\" target=\"_blank\">https://www.kaggle.com/competitions/rsna-2024-lumbar-spine-degenerative-classification/discussion/510606#2863142</a></p>\n<p>Most Axial series as in RAI orientation (some are RSA). All <code>Sagittal T1</code> and <code>Sagittal T2/STIR</code> series are in ASL orientation.<br>\nIn <code>torchio</code>, you can use <code>ScalarImage</code> class to read a DICOM series (caveats below) and use in built transforms such as <code>torchio.transforms.ToCanonical</code> to reorient the volume and get the final NumPy array of the volume.</p>\n<p>You can also check out <code>medio</code> library. It's <code>read_img</code> function takes <code>desired_ornt</code> as a parameter to which you can pass \"RAI\" to get a NumPy array of the reoriented volume and a metadata object with properties of the volume.</p>\n<p>Some caveats:</p>\n<ul>\n<li>Using this technique for Axial type series is difficult as most scans in these series contains groups of DICOMs with different orientations. It is very unstructured and there are variations even between series in the same study.</li>\n<li>In the Sagittal type series, there are following series with error preventing accurate volume generation: 2713404254, 3780389705, 2052598012, 2064757886</li>\n<li>Note that each series volume will have different pixel spacing in each direction. You need to either normalize the pixel spacing to a standard or train your model to accept volumes different pixel spacing.</li>\n</ul>",
      "rawMarkdown": "I take it you are trying to **reorient** sagittal T1 and T2 series to axial.\nSome context: I have tried `torchio` library to read volumes. Previous post on this is here: https://www.kaggle.com/competitions/rsna-2024-lumbar-spine-degenerative-classification/discussion/510606#2863142\n\nMost Axial series as in RAI orientation (some are RSA). All `Sagittal T1` and `Sagittal T2/STIR` series are in ASL orientation.\nIn `torchio`, you can use `ScalarImage` class to read a DICOM series (caveats below) and use in built transforms such as `torchio.transforms.ToCanonical` to reorient the volume and get the final NumPy array of the volume.\n\nYou can also check out `medio` library. It's `read_img` function takes `desired_ornt` as a parameter to which you can pass \"RAI\" to get a NumPy array of the reoriented volume and a metadata object with properties of the volume.\n\nSome caveats:\n- Using this technique for Axial type series is difficult as most scans in these series contains groups of DICOMs with different orientations. It is very unstructured and there are variations even between series in the same study.\n- In the Sagittal type series, there are following series with error preventing accurate volume generation: 2713404254, 3780389705, 2052598012, 2064757886\n- Note that each series volume will have different pixel spacing in each direction. You need to either normalize the pixel spacing to a standard or train your model to accept volumes different pixel spacing.",
      "votes": null
    },
    {
      "id": "2886835",
      "postDate": "06/23/2024 20:18:30",
      "content": "<p>Thanks for the help! I've been reading in dicom files, making the 3d stack, then using the spacing info to resample with scipy.ndimage.zoom(). I'll look into torchio to see if that will work better.<br>\nI'm wondering what the reason those 4 Sagittal series couldnt have volume generation was?</p>",
      "rawMarkdown": "Thanks for the help! I've been reading in dicom files, making the 3d stack, then using the spacing info to resample with scipy.ndimage.zoom(). I'll look into torchio to see if that will work better.\nI'm wondering what the reason those 4 Sagittal series couldnt have volume generation was?",
      "votes": null
    },
    {
      "id": "2887398",
      "postDate": "06/24/2024 07:29:41",
      "content": "<p>Those 4 had missing slices or extra duplicate slices. If you pass it without filtering / accounting for it, you will get a garbage result.</p>",
      "rawMarkdown": "Those 4 had missing slices or extra duplicate slices. If you pass it without filtering / accounting for it, you will get a garbage result.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2884226,
      "author_name": "coderrkj",
      "author_url": "",
      "post_date": "06/22/2024 11:07:27",
      "content": "<p>I take it you are trying to <strong>reorient</strong> sagittal T1 and T2 series to axial.<br>\nSome context: I have tried <code>torchio</code> library to read volumes. Previous post on this is here: <a href=\"https://www.kaggle.com/competitions/rsna-2024-lumbar-spine-degenerative-classification/discussion/510606#2863142\" target=\"_blank\">https://www.kaggle.com/competitions/rsna-2024-lumbar-spine-degenerative-classification/discussion/510606#2863142</a></p>\n<p>Most Axial series as in RAI orientation (some are RSA). All <code>Sagittal T1</code> and <code>Sagittal T2/STIR</code> series are in ASL orientation.<br>\nIn <code>torchio</code>, you can use <code>ScalarImage</code> class to read a DICOM series (caveats below) and use in built transforms such as <code>torchio.transforms.ToCanonical</code> to reorient the volume and get the final NumPy array of the volume.</p>\n<p>You can also check out <code>medio</code> library. It's <code>read_img</code> function takes <code>desired_ornt</code> as a parameter to which you can pass \"RAI\" to get a NumPy array of the reoriented volume and a metadata object with properties of the volume.</p>\n<p>Some caveats:</p>\n<ul>\n<li>Using this technique for Axial type series is difficult as most scans in these series contains groups of DICOMs with different orientations. It is very unstructured and there are variations even between series in the same study.</li>\n<li>In the Sagittal type series, there are following series with error preventing accurate volume generation: 2713404254, 3780389705, 2052598012, 2064757886</li>\n<li>Note that each series volume will have different pixel spacing in each direction. You need to either normalize the pixel spacing to a standard or train your model to accept volumes different pixel spacing.</li>\n</ul>",
      "votes": null,
      "replies": [
        {
          "id": 2886835,
          "author_name": "henryhornung",
          "author_url": "",
          "post_date": "06/23/2024 20:18:30",
          "content": "<p>Thanks for the help! I've been reading in dicom files, making the 3d stack, then using the spacing info to resample with scipy.ndimage.zoom(). I'll look into torchio to see if that will work better.<br>\nI'm wondering what the reason those 4 Sagittal series couldnt have volume generation was?</p>",
          "votes": null,
          "replies": [
            {
              "id": 2887398,
              "author_name": "coderrkj",
              "author_url": "",
              "post_date": "06/24/2024 07:29:41",
              "content": "<p>Those 4 had missing slices or extra duplicate slices. If you pass it without filtering / accounting for it, you will get a garbage result.</p>",
              "votes": null,
              "replies": []
            }
          ]
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2880065": "Hi all, I'm trying to figure how to convert dimensions of the sagittal and coronal samples to axial, in order to somewhat be able to use all of the data in the same backbone layer. I'm wondering if anyone knows how to do this properly in numpy.",
    "2884226": "I take it you are trying to **reorient** sagittal T1 and T2 series to axial.\nSome context: I have tried `torchio` library to read volumes. Previous post on this is here: https://www.kaggle.com/competitions/rsna-2024-lumbar-spine-degenerative-classification/discussion/510606#2863142\n\nMost Axial series as in RAI orientation (some are RSA). All `Sagittal T1` and `Sagittal T2/STIR` series are in ASL orientation.\nIn `torchio`, you can use `ScalarImage` class to read a DICOM series (caveats below) and use in built transforms such as `torchio.transforms.ToCanonical` to reorient the volume and get the final NumPy array of the volume.\n\nYou can also check out `medio` library. It's `read_img` function takes `desired_ornt` as a parameter to which you can pass \"RAI\" to get a NumPy array of the reoriented volume and a metadata object with properties of the volume.\n\nSome caveats:\n- Using this technique for Axial type series is difficult as most scans in these series contains groups of DICOMs with different orientations. It is very unstructured and there are variations even between series in the same study.\n- In the Sagittal type series, there are following series with error preventing accurate volume generation: 2713404254, 3780389705, 2052598012, 2064757886\n- Note that each series volume will have different pixel spacing in each direction. You need to either normalize the pixel spacing to a standard or train your model to accept volumes different pixel spacing.",
    "2886835": "Thanks for the help! I've been reading in dicom files, making the 3d stack, then using the spacing info to resample with scipy.ndimage.zoom(). I'll look into torchio to see if that will work better.\nI'm wondering what the reason those 4 Sagittal series couldnt have volume generation was?",
    "2887398": "Those 4 had missing slices or extra duplicate slices. If you pass it without filtering / accounting for it, you will get a garbage result."
  },
  "source": "meta"
}