{
  "id": 537339,
  "title": "help! which hidden test dicom tag is causing notebook exception error?",
  "url": "/competitions/rsna-2024-lumbar-spine-degenerative-classification/discussion/537339",
  "author_name": "",
  "post_date": "2024-10-02T18:22:21.896667600Z",
  "votes": 9,
  "comment_count": 14,
  "views": 0,
  "content": "<p>My data reader passed all public kaggle train data but is stuck with \"notebook exception error\" for a few days.<br>\nI am running out of submissions and it is now impossible for me to \"submit and debug\".</p>\n<p>I wonder if anyone can help it identify which hidden dicom test tag is giving problem?</p>\n<ul>\n<li>ImagePositionPatient : ok for train and test</li>\n<li>SpacingBetweenSlices: ok for train, problem for test[1]</li>\n<li>pixel_array.shape : ok for train and test</li>\n</ul>\n<p>update:<br>\nthese are tested ok for test and train:</p>\n<ul>\n<li>ImageOrientationPatient: ok for train, ok for test</li>\n<li>PixelSpacing: ok for train, ok for test</li>\n</ul>\n<p>for the following, I never submitted without try-catch, so I do not know if they are issues </p>\n<ul>\n<li>SliceThickness: ok for train, ??? for test</li>\n<li>SliceLocation: ok for train, ??? for test</li>\n</ul>\n<p>also, verified problems: </p>\n<ul>\n<li>are some empty dicom folder in hidden test. </li>\n<li>images can be of different shapes within a dicom folder.</li>\n</ul>\n<p>If there are other issues, please let me know. thanks.</p>\n<p>reference:<br>\n[1] <a href=\"https://www.kaggle.com/competitions/rsna-2024-lumbar-spine-degenerative-classification/discussion/528284\" target=\"_blank\">https://www.kaggle.com/competitions/rsna-2024-lumbar-spine-degenerative-classification/discussion/528284</a></p>",
  "messages": [
    {
      "id": "3005279",
      "postDate": "10/02/2024 18:22:21",
      "content": "<p>My data reader passed all public kaggle train data but is stuck with \"notebook exception error\" for a few days.<br>\nI am running out of submissions and it is now impossible for me to \"submit and debug\".</p>\n<p>I wonder if anyone can help it identify which hidden dicom test tag is giving problem?</p>\n<ul>\n<li>ImagePositionPatient : ok for train and test</li>\n<li>SpacingBetweenSlices: ok for train, problem for test[1]</li>\n<li>pixel_array.shape : ok for train and test</li>\n</ul>\n<p>update:<br>\nthese are tested ok for test and train:</p>\n<ul>\n<li>ImageOrientationPatient: ok for train, ok for test</li>\n<li>PixelSpacing: ok for train, ok for test</li>\n</ul>\n<p>for the following, I never submitted without try-catch, so I do not know if they are issues </p>\n<ul>\n<li>SliceThickness: ok for train, ??? for test</li>\n<li>SliceLocation: ok for train, ??? for test</li>\n</ul>\n<p>also, verified problems: </p>\n<ul>\n<li>are some empty dicom folder in hidden test. </li>\n<li>images can be of different shapes within a dicom folder.</li>\n</ul>\n<p>If there are other issues, please let me know. thanks.</p>\n<p>reference:<br>\n[1] <a href=\"https://www.kaggle.com/competitions/rsna-2024-lumbar-spine-degenerative-classification/discussion/528284\" target=\"_blank\">https://www.kaggle.com/competitions/rsna-2024-lumbar-spine-degenerative-classification/discussion/528284</a></p>",
      "rawMarkdown": "My data reader passed all public kaggle train data but is stuck with \"notebook exception error\" for a few days.\nI am running out of submissions and it is now impossible for me to \"submit and debug\".\n\nI wonder if anyone can help it identify which hidden dicom test tag is giving problem?\n\n- ImagePositionPatient : ok for train and test\n- SpacingBetweenSlices: ok for train, problem for test[1]\n- pixel_array.shape : ok for train and test\n\nupdate:\nthese are tested ok for test and train:\n- ImageOrientationPatient: ok for train, ok for test\n- PixelSpacing: ok for train, ok for test\n\n\nfor the following, I never submitted without try-catch, so I do not know if they are issues \n- SliceThickness: ok for train, ??? for test\n- SliceLocation: ok for train, ??? for test\n\n\nalso, verified problems: \n- are some empty dicom folder in hidden test. \n- images can be of different shapes within a dicom folder.\n\nIf there are other issues, please let me know. thanks.\n\nreference:\n[1] https://www.kaggle.com/competitions/rsna-2024-lumbar-spine-degenerative-classification/discussion/528284",
      "votes": null
    },
    {
      "id": "3005390",
      "postDate": "10/02/2024 20:46:15",
      "content": "<p>I think is a sneaky bug in my case. But I've already lost 3 submissions since I've included Sagittal T2 3D projections. If that's the case I'm only using IPP,IOP and PixelSpacing from your shared 3D projection code. I've also wasted 5 GPU hours running the entire public train… a couple of times :__P</p>\n<p><a href=\"https://www.kaggle.com/code/hengck23/2d-to-3d-projection-for-dicom\" target=\"_blank\">https://www.kaggle.com/code/hengck23/2d-to-3d-projection-for-dicom</a></p>\n<p>`       xx,yy,zz = [],[],[]<br>\n        for i in range(len(dicom)):<br>\n             sx,sy,sz = [float(v) for v in dicom[i].ImagePositionPatient]<br>\n             o0, o1, o2, o3, o4, o5 = [float(v) for v in dicom[i].ImageOrientationPatient]<br>\n             delx,dely = dicom[i].PixelSpacing</p>\n<pre><code>     x,y  all_centers[i]:\n        xx.append(o0lx*x + o3ly*y + sx)\n        yy.append(o1lx*x + o4ly*y + sy)\n        zz.append(o2lx*x + o5ly*y + sz)`\n</code></pre>",
      "rawMarkdown": "I think is a sneaky bug in my case. But I've already lost 3 submissions since I've included Sagittal T2 3D projections. If that's the case I'm only using IPP,IOP and PixelSpacing from your shared 3D projection code. I've also wasted 5 GPU hours running the entire public train... a couple of times :__P\n\n https://www.kaggle.com/code/hengck23/2d-to-3d-projection-for-dicom\n\n`       xx,yy,zz = [],[],[]\n        for i in range(len(dicom)):\n             sx,sy,sz = [float(v) for v in dicom[i].ImagePositionPatient]\n             o0, o1, o2, o3, o4, o5 = [float(v) for v in dicom[i].ImageOrientationPatient]\n             delx,dely = dicom[i].PixelSpacing\n\n        for x,y in all_centers[i]:\n            xx.append(o0*delx*x + o3*dely*y + sx)\n            yy.append(o1*delx*x + o4*dely*y + sy)\n            zz.append(o2*delx*x + o5*dely*y + sz)`",
      "votes": null
    },
    {
      "id": "3005430",
      "postDate": "10/02/2024 22:04:35",
      "content": "<p>FYI, I directly used these DICOM tags: PixelSpacing, ImageOrientationPatient, ImagePositionPatient, Rows, Columns.<br>\nThese tags are used by <code>dcm.get()</code>, which allows missing values: SliceThinkness, RescaleSlope, RescaleIntercept. </p>",
      "rawMarkdown": "FYI, I directly used these DICOM tags: PixelSpacing, ImageOrientationPatient, ImagePositionPatient, Rows, Columns.\nThese tags are used by `dcm.get()`, which allows missing values: SliceThinkness, RescaleSlope, RescaleIntercept.",
      "votes": null
    },
    {
      "id": "3005434",
      "postDate": "10/02/2024 22:39:23",
      "content": "<p>One more submission error. I'm now pretty sure that there is something wrong with IPP, IOP or PixelSpacing with some Sagittal T2 file/folder.</p>",
      "rawMarkdown": "One more submission error. I'm now pretty sure that there is something wrong with IPP, IOP or PixelSpacing with some Sagittal T2 file/folder.",
      "votes": null
    },
    {
      "id": "3005707",
      "postDate": "10/03/2024 08:10:37",
      "content": "<p><a href=\"https://www.kaggle.com/sacuscreed\" target=\"_blank\">@sacuscreed</a> </p>\n<p>you are saying that all test axial-t2 have IOP,PixelSpacing,SliceThickness and the problem only occurs for sagittal-t2?</p>",
      "rawMarkdown": "sacuscreed \n\nyou are saying that all test axial-t2 have IOP,PixelSpacing,SliceThickness and the problem only occurs for sagittal-t2?",
      "votes": null
    },
    {
      "id": "3005711",
      "postDate": "10/03/2024 08:30:27",
      "content": "<p>My code started to give errors when I added segmented level coordinates to Sagittal T2 to 3D projection processing,. No errors projecting all other MRI segmented coordinates. So may be we should focus on Sagittal T2 to find the problem (no idea how many of them). But right now I'm not sure of nothing, I did other apparently trivial changes to the code at same time. Few days to finish and few submissions available. Tryng to define the correct way to solve it.</p>",
      "rawMarkdown": "My code started to give errors when I added segmented level coordinates to Sagittal T2 to 3D projection processing,. No errors projecting all other MRI segmented coordinates. So may be we should focus on Sagittal T2 to find the problem (no idea how many of them). But right now I'm not sure of nothing, I did other apparently trivial changes to the code at same time. Few days to finish and few submissions available. Tryng to define the correct way to solve it.",
      "votes": null
    },
    {
      "id": "3005895",
      "postDate": "10/03/2024 13:32:24",
      "content": "<p>I think this is the way. If the tag does not exist, it will return None instead of error.</p>",
      "rawMarkdown": "I think this is the way. If the tag does not exist, it will return None instead of error.",
      "votes": null
    },
    {
      "id": "3005919",
      "postDate": "10/03/2024 14:00:14",
      "content": "<p>I didn't understood at first read. So if the tag doen't exist and you try acces it directly it raises error but with dcm.get() is like a try/except.<br>\nIf that's the case thank you very much and I'll use if I get another submission error.</p>",
      "rawMarkdown": "I didn't understood at first read. So if the tag doen't exist and you try acces it directly it raises error but with dcm.get() is like a try/except.\nIf that's the case thank you very much and I'll use if I get another submission error.",
      "votes": null
    },
    {
      "id": "3005957",
      "postDate": "10/03/2024 14:53:48",
      "content": "<p>Oh, I only picked 1 of <code>Sagittal T2/STIR</code>, 1 of <code>Sagittal T1</code>, 1 of <code>Axial T2</code>. Probably there are bug series I skipped. </p>\n<p>In general, I believe the IPP, IOP, and PixelSpacing must all be present. If any of these are missing, it’s impossible to accurately map the image to physical coordinates. It’s fine to handle this with a try-except block to skip such problematic cases.</p>\n<p><a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> , The SliceThickness attribute is not always guaranteed to be present. Using <code>dcm.SliceThickness</code> may cause errors. I used <code>dcm.get('SliceThickness', 1)</code>.</p>",
      "rawMarkdown": "Oh, I only picked 1 of `Sagittal T2/STIR`, 1 of `Sagittal T1`, 1 of `Axial T2`. Probably there are bug series I skipped. \n\nIn general, I believe the IPP, IOP, and PixelSpacing must all be present. If any of these are missing, it’s impossible to accurately map the image to physical coordinates. It’s fine to handle this with a try-except block to skip such problematic cases.\n\n@hengck23 , The SliceThickness attribute is not always guaranteed to be present. Using `dcm.SliceThickness` may cause errors. I used `dcm.get('SliceThickness', 1)`.",
      "votes": null
    },
    {
      "id": "3005963",
      "postDate": "10/03/2024 15:03:38",
      "content": "<p>That makes sense, now I remember have changed also process all MRI available, not only first one. Then may be would be safe taking the first one available only.</p>",
      "rawMarkdown": "That makes sense, now I remember have changed also process all MRI available, not only first one. Then may be would be safe taking the first one available only.",
      "votes": null
    },
    {
      "id": "3005975",
      "postDate": "10/03/2024 15:23:55",
      "content": "<p>Hi, <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a>, </p>\n<p>I have had the similar issue and my workaround was to wrap the <strong>getitem</strong> in try except:</p>\n<pre><code>:\n     arr, study_id, series_id, ipp, iop\n Exception  e:\n     , , , , \n\n\n torch.no_grad():\n     i, batch  (tqdm(test_dl, desc=)):\n        :\n            image, study_id, series_id, ipp, iop = batch\n              study_id:\n                \n</code></pre>\n<p>It is not the most elegant solution and might not work for you since you guys fighting for every inch, but hope it serves well for others.</p>",
      "rawMarkdown": "Hi, @hengck23, \n\nI have had the similar issue and my workaround was to wrap the __getitem__ in try except:\n```python\ntry:\n    return arr, study_id, series_id, ipp, iop\nexcept Exception as e:\n    return 0, 0, 0, 0, 0\n\n\nwith torch.no_grad():\n    for i, batch in enumerate(tqdm(test_dl, desc='Predicting...')):\n        try:\n            image, study_id, series_id, ipp, iop = batch\n            if not study_id:\n                continue\n```\n\nIt is not the most elegant solution and might not work for you since you guys fighting for every inch, but hope it serves well for others.",
      "votes": null
    },
    {
      "id": "3006039",
      "postDate": "10/03/2024 16:50:03",
      "content": "<p>Must be last minut panic but I don't undestand anything. Well, at least I can confirm that IPP, IOP and PixelSpacing of evrything in hidden test is safe. If there is something wrong must be with another field.</p>\n<p>EDIT: I've also optimized memmory usage. May be loading evreything, 3D coordinates included caused not notified OOM in my case.</p>",
      "rawMarkdown": "Must be last minut panic but I don't undestand anything. Well, at least I can confirm that IPP, IOP and PixelSpacing of evrything in hidden test is safe. If there is something wrong must be with another field.\n\nEDIT: I've also optimized memmory usage. May be loading evreything, 3D coordinates included caused not notified OOM in my case.",
      "votes": null
    },
    {
      "id": "3006421",
      "postDate": "10/04/2024 06:07:29",
      "content": "<p>I have the same problem.</p>\n<p>I use try-except block.</p>",
      "rawMarkdown": "I have the same problem.\n\nI use try-except block.",
      "votes": null
    },
    {
      "id": "3006512",
      "postDate": "10/04/2024 08:56:52",
      "content": "<blockquote>\n  <p>I didn't understood at first read. So if the tag doen't exist and you try acces it directly it raises error but with dcm.get() is like a try/except.</p>\n</blockquote>\n<p>Yes, exactly. So if it returns None instead of some value, I handled it by try different approach instead for just that paritcular one. basically it is just a bit easier to handle try/except.</p>",
      "rawMarkdown": ">I didn't understood at first read. So if the tag doen't exist and you try acces it directly it raises error but with dcm.get() is like a try/except.\n\nYes, exactly. So if it returns None instead of some value, I handled it by try different approach instead for just that paritcular one. basically it is just a bit easier to handle try/except.",
      "votes": null
    },
    {
      "id": "3008250",
      "postDate": "10/06/2024 11:54:53",
      "content": "<p>\"Your notebook hit an unhandled error while rerunning your code. Note that the hidden dataset can be larger/smaller/different than the public dataset See more debugging tips\" An error that doen't shows when processing the entire training set… is very frustating. I've checked everything, no idea what can explode in test…</p>",
      "rawMarkdown": "\"Your notebook hit an unhandled error while rerunning your code. Note that the hidden dataset can be larger/smaller/different than the public dataset See more debugging tips\" An error that doen't shows when processing the entire training set... is very frustating. I've checked everything, no idea what can explode in test...",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 3005390,
      "author_name": "sacuscreed",
      "author_url": "",
      "post_date": "10/02/2024 20:46:15",
      "content": "<p>I think is a sneaky bug in my case. But I've already lost 3 submissions since I've included Sagittal T2 3D projections. If that's the case I'm only using IPP,IOP and PixelSpacing from your shared 3D projection code. I've also wasted 5 GPU hours running the entire public train… a couple of times :__P</p>\n<p><a href=\"https://www.kaggle.com/code/hengck23/2d-to-3d-projection-for-dicom\" target=\"_blank\">https://www.kaggle.com/code/hengck23/2d-to-3d-projection-for-dicom</a></p>\n<p>`       xx,yy,zz = [],[],[]<br>\n        for i in range(len(dicom)):<br>\n             sx,sy,sz = [float(v) for v in dicom[i].ImagePositionPatient]<br>\n             o0, o1, o2, o3, o4, o5 = [float(v) for v in dicom[i].ImageOrientationPatient]<br>\n             delx,dely = dicom[i].PixelSpacing</p>\n<pre><code>     x,y  all_centers[i]:\n        xx.append(o0lx*x + o3ly*y + sx)\n        yy.append(o1lx*x + o4ly*y + sy)\n        zz.append(o2lx*x + o5ly*y + sz)`\n</code></pre>",
      "votes": null,
      "replies": [
        {
          "id": 3005434,
          "author_name": "sacuscreed",
          "author_url": "",
          "post_date": "10/02/2024 22:39:23",
          "content": "<p>One more submission error. I'm now pretty sure that there is something wrong with IPP, IOP or PixelSpacing with some Sagittal T2 file/folder.</p>",
          "votes": null,
          "replies": [
            {
              "id": 3005707,
              "author_name": "hengck23",
              "author_url": "",
              "post_date": "10/03/2024 08:10:37",
              "content": "<p><a href=\"https://www.kaggle.com/sacuscreed\" target=\"_blank\">@sacuscreed</a> </p>\n<p>you are saying that all test axial-t2 have IOP,PixelSpacing,SliceThickness and the problem only occurs for sagittal-t2?</p>",
              "votes": null,
              "replies": [
                {
                  "id": 3005711,
                  "author_name": "sacuscreed",
                  "author_url": "",
                  "post_date": "10/03/2024 08:30:27",
                  "content": "<p>My code started to give errors when I added segmented level coordinates to Sagittal T2 to 3D projection processing,. No errors projecting all other MRI segmented coordinates. So may be we should focus on Sagittal T2 to find the problem (no idea how many of them). But right now I'm not sure of nothing, I did other apparently trivial changes to the code at same time. Few days to finish and few submissions available. Tryng to define the correct way to solve it.</p>",
                  "votes": null,
                  "replies": []
                }
              ]
            },
            {
              "id": 3005957,
              "author_name": "together",
              "author_url": "",
              "post_date": "10/03/2024 14:53:48",
              "content": "<p>Oh, I only picked 1 of <code>Sagittal T2/STIR</code>, 1 of <code>Sagittal T1</code>, 1 of <code>Axial T2</code>. Probably there are bug series I skipped. </p>\n<p>In general, I believe the IPP, IOP, and PixelSpacing must all be present. If any of these are missing, it’s impossible to accurately map the image to physical coordinates. It’s fine to handle this with a try-except block to skip such problematic cases.</p>\n<p><a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> , The SliceThickness attribute is not always guaranteed to be present. Using <code>dcm.SliceThickness</code> may cause errors. I used <code>dcm.get('SliceThickness', 1)</code>.</p>",
              "votes": null,
              "replies": [
                {
                  "id": 3005963,
                  "author_name": "sacuscreed",
                  "author_url": "",
                  "post_date": "10/03/2024 15:03:38",
                  "content": "<p>That makes sense, now I remember have changed also process all MRI available, not only first one. Then may be would be safe taking the first one available only.</p>",
                  "votes": null,
                  "replies": []
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "id": 3005430,
      "author_name": "together",
      "author_url": "",
      "post_date": "10/02/2024 22:04:35",
      "content": "<p>FYI, I directly used these DICOM tags: PixelSpacing, ImageOrientationPatient, ImagePositionPatient, Rows, Columns.<br>\nThese tags are used by <code>dcm.get()</code>, which allows missing values: SliceThinkness, RescaleSlope, RescaleIntercept. </p>",
      "votes": null,
      "replies": [
        {
          "id": 3005895,
          "author_name": "sunpnwt12",
          "author_url": "",
          "post_date": "10/03/2024 13:32:24",
          "content": "<p>I think this is the way. If the tag does not exist, it will return None instead of error.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 3005919,
          "author_name": "sacuscreed",
          "author_url": "",
          "post_date": "10/03/2024 14:00:14",
          "content": "<p>I didn't understood at first read. So if the tag doen't exist and you try acces it directly it raises error but with dcm.get() is like a try/except.<br>\nIf that's the case thank you very much and I'll use if I get another submission error.</p>",
          "votes": null,
          "replies": [
            {
              "id": 3006512,
              "author_name": "sunpnwt12",
              "author_url": "",
              "post_date": "10/04/2024 08:56:52",
              "content": "<blockquote>\n  <p>I didn't understood at first read. So if the tag doen't exist and you try acces it directly it raises error but with dcm.get() is like a try/except.</p>\n</blockquote>\n<p>Yes, exactly. So if it returns None instead of some value, I handled it by try different approach instead for just that paritcular one. basically it is just a bit easier to handle try/except.</p>",
              "votes": null,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 3005975,
      "author_name": "sergiosaharovskiy",
      "author_url": "",
      "post_date": "10/03/2024 15:23:55",
      "content": "<p>Hi, <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a>, </p>\n<p>I have had the similar issue and my workaround was to wrap the <strong>getitem</strong> in try except:</p>\n<pre><code>:\n     arr, study_id, series_id, ipp, iop\n Exception  e:\n     , , , , \n\n\n torch.no_grad():\n     i, batch  (tqdm(test_dl, desc=)):\n        :\n            image, study_id, series_id, ipp, iop = batch\n              study_id:\n                \n</code></pre>\n<p>It is not the most elegant solution and might not work for you since you guys fighting for every inch, but hope it serves well for others.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 3006039,
      "author_name": "sacuscreed",
      "author_url": "",
      "post_date": "10/03/2024 16:50:03",
      "content": "<p>Must be last minut panic but I don't undestand anything. Well, at least I can confirm that IPP, IOP and PixelSpacing of evrything in hidden test is safe. If there is something wrong must be with another field.</p>\n<p>EDIT: I've also optimized memmory usage. May be loading evreything, 3D coordinates included caused not notified OOM in my case.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 3006421,
      "author_name": "chihantsai",
      "author_url": "",
      "post_date": "10/04/2024 06:07:29",
      "content": "<p>I have the same problem.</p>\n<p>I use try-except block.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 3008250,
      "author_name": "sacuscreed",
      "author_url": "",
      "post_date": "10/06/2024 11:54:53",
      "content": "<p>\"Your notebook hit an unhandled error while rerunning your code. Note that the hidden dataset can be larger/smaller/different than the public dataset See more debugging tips\" An error that doen't shows when processing the entire training set… is very frustating. I've checked everything, no idea what can explode in test…</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "3005279": "My data reader passed all public kaggle train data but is stuck with \"notebook exception error\" for a few days.\nI am running out of submissions and it is now impossible for me to \"submit and debug\".\n\nI wonder if anyone can help it identify which hidden dicom test tag is giving problem?\n\n- ImagePositionPatient : ok for train and test\n- SpacingBetweenSlices: ok for train, problem for test[1]\n- pixel_array.shape : ok for train and test\n\nupdate:\nthese are tested ok for test and train:\n- ImageOrientationPatient: ok for train, ok for test\n- PixelSpacing: ok for train, ok for test\n\n\nfor the following, I never submitted without try-catch, so I do not know if they are issues \n- SliceThickness: ok for train, ??? for test\n- SliceLocation: ok for train, ??? for test\n\n\nalso, verified problems: \n- are some empty dicom folder in hidden test. \n- images can be of different shapes within a dicom folder.\n\nIf there are other issues, please let me know. thanks.\n\nreference:\n[1] https://www.kaggle.com/competitions/rsna-2024-lumbar-spine-degenerative-classification/discussion/528284",
    "3005390": "I think is a sneaky bug in my case. But I've already lost 3 submissions since I've included Sagittal T2 3D projections. If that's the case I'm only using IPP,IOP and PixelSpacing from your shared 3D projection code. I've also wasted 5 GPU hours running the entire public train... a couple of times :__P\n\n https://www.kaggle.com/code/hengck23/2d-to-3d-projection-for-dicom\n\n`       xx,yy,zz = [],[],[]\n        for i in range(len(dicom)):\n             sx,sy,sz = [float(v) for v in dicom[i].ImagePositionPatient]\n             o0, o1, o2, o3, o4, o5 = [float(v) for v in dicom[i].ImageOrientationPatient]\n             delx,dely = dicom[i].PixelSpacing\n\n        for x,y in all_centers[i]:\n            xx.append(o0*delx*x + o3*dely*y + sx)\n            yy.append(o1*delx*x + o4*dely*y + sy)\n            zz.append(o2*delx*x + o5*dely*y + sz)`",
    "3005430": "FYI, I directly used these DICOM tags: PixelSpacing, ImageOrientationPatient, ImagePositionPatient, Rows, Columns.\nThese tags are used by `dcm.get()`, which allows missing values: SliceThinkness, RescaleSlope, RescaleIntercept.",
    "3005434": "One more submission error. I'm now pretty sure that there is something wrong with IPP, IOP or PixelSpacing with some Sagittal T2 file/folder.",
    "3005707": "sacuscreed \n\nyou are saying that all test axial-t2 have IOP,PixelSpacing,SliceThickness and the problem only occurs for sagittal-t2?",
    "3005711": "My code started to give errors when I added segmented level coordinates to Sagittal T2 to 3D projection processing,. No errors projecting all other MRI segmented coordinates. So may be we should focus on Sagittal T2 to find the problem (no idea how many of them). But right now I'm not sure of nothing, I did other apparently trivial changes to the code at same time. Few days to finish and few submissions available. Tryng to define the correct way to solve it.",
    "3005895": "I think this is the way. If the tag does not exist, it will return None instead of error.",
    "3005919": "I didn't understood at first read. So if the tag doen't exist and you try acces it directly it raises error but with dcm.get() is like a try/except.\nIf that's the case thank you very much and I'll use if I get another submission error.",
    "3005957": "Oh, I only picked 1 of `Sagittal T2/STIR`, 1 of `Sagittal T1`, 1 of `Axial T2`. Probably there are bug series I skipped. \n\nIn general, I believe the IPP, IOP, and PixelSpacing must all be present. If any of these are missing, it’s impossible to accurately map the image to physical coordinates. It’s fine to handle this with a try-except block to skip such problematic cases.\n\n@hengck23 , The SliceThickness attribute is not always guaranteed to be present. Using `dcm.SliceThickness` may cause errors. I used `dcm.get('SliceThickness', 1)`.",
    "3005963": "That makes sense, now I remember have changed also process all MRI available, not only first one. Then may be would be safe taking the first one available only.",
    "3005975": "Hi, @hengck23, \n\nI have had the similar issue and my workaround was to wrap the __getitem__ in try except:\n```python\ntry:\n    return arr, study_id, series_id, ipp, iop\nexcept Exception as e:\n    return 0, 0, 0, 0, 0\n\n\nwith torch.no_grad():\n    for i, batch in enumerate(tqdm(test_dl, desc='Predicting...')):\n        try:\n            image, study_id, series_id, ipp, iop = batch\n            if not study_id:\n                continue\n```\n\nIt is not the most elegant solution and might not work for you since you guys fighting for every inch, but hope it serves well for others.",
    "3006039": "Must be last minut panic but I don't undestand anything. Well, at least I can confirm that IPP, IOP and PixelSpacing of evrything in hidden test is safe. If there is something wrong must be with another field.\n\nEDIT: I've also optimized memmory usage. May be loading evreything, 3D coordinates included caused not notified OOM in my case.",
    "3006421": "I have the same problem.\n\nI use try-except block.",
    "3006512": ">I didn't understood at first read. So if the tag doen't exist and you try acces it directly it raises error but with dcm.get() is like a try/except.\n\nYes, exactly. So if it returns None instead of some value, I handled it by try different approach instead for just that paritcular one. basically it is just a bit easier to handle try/except.",
    "3008250": "\"Your notebook hit an unhandled error while rerunning your code. Note that the hidden dataset can be larger/smaller/different than the public dataset See more debugging tips\" An error that doen't shows when processing the entire training set... is very frustating. I've checked everything, no idea what can explode in test..."
  },
  "source": "meta"
}