{
  "id": 434855,
  "title": "Segmentation overlay",
  "url": "/competitions/rsna-2023-abdominal-trauma-detection/discussion/434855",
  "author_name": "Mohamed Ali",
  "post_date": "2023-08-26T19:36:52.507000",
  "votes": 0,
  "comment_count": 4,
  "views": 0,
  "content": "<p>Hello Guys,<br>\nI have been trying to visualize the segmented volumes on the dicom volumes but it seems that I am doing something wrong. The output volumes are not registered to each other at all.<br>\nThis is the following algorithm I use to match the segmented volume with the dicom scans</p>\n<ol>\n<li>Read the segmented volume using nibabel</li>\n<li>Find the corresponding series folder in the training data</li>\n<li>Convert the nibable object to ndarray -&gt; seg_vol</li>\n<li>Read the dicom scans in the series folder</li>\n<li>Sort the scans by their scan int(value) </li>\n<li>Concatenate them into one ndarray volume -&gt; dcm_vol</li>\n<li>Overlay scans from the seg_vol over the dcm_vol.</li>\n</ol>\n<p>The following is a sample volume training ['54183/33526'], segmentation ['33526'] that I processed and overlay. Please let me know what I am missing here.</p>",
  "messages": [
    {
      "id": 2410525,
      "postDate": "2023-08-27T03:51:59.743Z",
      "content": "<p>Hi The orientations are different in Nii and dcm files. You need to rotate and flip them in some dimensions to get them matched. I have shared a notebook about constructing 3D array of nii and dcm that might help. Good luck!</p>",
      "rawMarkdown": "Hi The orientations are different in Nii and dcm files. You need to rotate and flip them in some dimensions to get them matched. I have shared a notebook about constructing 3D array of nii and dcm that might help. Good luck!",
      "votes": 2,
      "replies": [
        {
          "id": 2423588,
          "postDate": "2023-09-04T17:21:48.443Z",
          "content": "<p>Could you please share the notebook here? :)</p>",
          "rawMarkdown": "Could you please share the notebook here? :)",
          "votes": 1,
          "replies": [
            {
              "id": 2445393,
              "postDate": "2023-09-18T19:34:28.260Z",
              "content": "<p><a href=\"https://www.kaggle.com/code/franklinshih0617/overlay-segmentations-segmentator-images-on-dcm\" target=\"_blank\">https://www.kaggle.com/code/franklinshih0617/overlay-segmentations-segmentator-images-on-dcm</a></p>\n<p>I overlaid the dcm with provided segmentation masked data. And I overlay on total-segmentator generated masks on dcm. Please check them out and ask me questions if any!</p>",
              "rawMarkdown": "https://www.kaggle.com/code/franklinshih0617/overlay-segmentations-segmentator-images-on-dcm\n\nI overlaid the dcm with provided segmentation masked data. And I overlay on total-segmentator generated masks on dcm. Please check them out and ask me questions if any!"
            },
            {
              "id": 2445419,
              "postDate": "2023-09-18T20:01:54.053Z",
              "content": "<p>I'm sorry I just saw your comment. Here is the notebook. I hope this is not too late:<br>\n<a href=\"url\" target=\"_blank\">https://www.kaggle.com/code/parhammostame/construct-3d-arrays-from-dcm-nii-3-view-angles</a></p>",
              "rawMarkdown": "I'm sorry I just saw your comment. Here is the notebook. I hope this is not too late:\n[https://www.kaggle.com/code/parhammostame/construct-3d-arrays-from-dcm-nii-3-view-angles](url)"
            }
          ]
        }
      ]
    },
    {
      "id": 2410297,
      "postDate": "2023-08-26T19:36:52.507Z",
      "content": "<p>Hello Guys,<br>\nI have been trying to visualize the segmented volumes on the dicom volumes but it seems that I am doing something wrong. The output volumes are not registered to each other at all.<br>\nThis is the following algorithm I use to match the segmented volume with the dicom scans</p>\n<ol>\n<li>Read the segmented volume using nibabel</li>\n<li>Find the corresponding series folder in the training data</li>\n<li>Convert the nibable object to ndarray -&gt; seg_vol</li>\n<li>Read the dicom scans in the series folder</li>\n<li>Sort the scans by their scan int(value) </li>\n<li>Concatenate them into one ndarray volume -&gt; dcm_vol</li>\n<li>Overlay scans from the seg_vol over the dcm_vol.</li>\n</ol>\n<p>The following is a sample volume training ['54183/33526'], segmentation ['33526'] that I processed and overlay. Please let me know what I am missing here.</p>",
      "rawMarkdown": "Hello Guys,\nI have been trying to visualize the segmented volumes on the dicom volumes but it seems that I am doing something wrong. The output volumes are not registered to each other at all.\nThis is the following algorithm I use to match the segmented volume with the dicom scans\n1. Read the segmented volume using nibabel\n2. Find the corresponding series folder in the training data\n3. Convert the nibable object to ndarray -> seg_vol\n4. Read the dicom scans in the series folder\n5. Sort the scans by their scan int(value) \n6. Concatenate them into one ndarray volume -> dcm_vol\n7. Overlay scans from the seg_vol over the dcm_vol.\n\nThe following is a sample volume training ['54183/33526'], segmentation ['33526'] that I processed and overlay. Please let me know what I am missing here.\n\n"
    }
  ],
  "comments": [
    {
      "id": 2410525,
      "author_name": "Parham Mostame",
      "author_url": "",
      "post_date": "2023-08-27T03:51:59.743000",
      "content": "<p>Hi The orientations are different in Nii and dcm files. You need to rotate and flip them in some dimensions to get them matched. I have shared a notebook about constructing 3D array of nii and dcm that might help. Good luck!</p>",
      "votes": 2,
      "replies": [
        {
          "id": 2423588,
          "author_name": "the real L",
          "author_url": "",
          "post_date": "2023-09-04T17:21:48.443000",
          "content": "<p>Could you please share the notebook here? :)</p>",
          "votes": 1,
          "replies": [
            {
              "id": 2445393,
              "author_name": "Franklin Shih0617",
              "author_url": "",
              "post_date": "2023-09-18T19:34:28.260000",
              "content": "<p><a href=\"https://www.kaggle.com/code/franklinshih0617/overlay-segmentations-segmentator-images-on-dcm\" target=\"_blank\">https://www.kaggle.com/code/franklinshih0617/overlay-segmentations-segmentator-images-on-dcm</a></p>\n<p>I overlaid the dcm with provided segmentation masked data. And I overlay on total-segmentator generated masks on dcm. Please check them out and ask me questions if any!</p>",
              "votes": 0,
              "replies": []
            },
            {
              "id": 2445419,
              "author_name": "Parham Mostame",
              "author_url": "",
              "post_date": "2023-09-18T20:01:54.053000",
              "content": "<p>I'm sorry I just saw your comment. Here is the notebook. I hope this is not too late:<br>\n<a href=\"url\" target=\"_blank\">https://www.kaggle.com/code/parhammostame/construct-3d-arrays-from-dcm-nii-3-view-angles</a></p>",
              "votes": 0,
              "replies": []
            }
          ]
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2410525": "Hi The orientations are different in Nii and dcm files. You need to rotate and flip them in some dimensions to get them matched. I have shared a notebook about constructing 3D array of nii and dcm that might help. Good luck!",
    "2410297": "Hello Guys,\nI have been trying to visualize the segmented volumes on the dicom volumes but it seems that I am doing something wrong. The output volumes are not registered to each other at all.\nThis is the following algorithm I use to match the segmented volume with the dicom scans\n1. Read the segmented volume using nibabel\n2. Find the corresponding series folder in the training data\n3. Convert the nibable object to ndarray -> seg_vol\n4. Read the dicom scans in the series folder\n5. Sort the scans by their scan int(value) \n6. Concatenate them into one ndarray volume -> dcm_vol\n7. Overlay scans from the seg_vol over the dcm_vol.\n\nThe following is a sample volume training ['54183/33526'], segmentation ['33526'] that I processed and overlay. Please let me know what I am missing here.\n\n"
  }
}