{
  "id": 350760,
  "title": "Some helping tool and code (e.g. align segmentation orientation)",
  "url": "/competitions/rsna-2022-cervical-spine-fracture-detection/discussion/350760",
  "author_name": "hengck23",
  "post_date": "2022-09-07T01:02:19.664000",
  "votes": 26,
  "comment_count": 9,
  "views": 0,
  "content": "<p>it is helpful (and important) to visualise the annotation and results.  <br>\nthere are many free dicom viewer.  <br>\nhere, i am using ITK-SNAP</p>\n<p>code to realign segmentation orientation</p>\n<p>update!!! you probably need to cast to .astype(np.uint8) for seg_data below</p>\n<pre><code>import nibabel as nib\n\n#https://stackoverflow.com/questions/66231763/how-to-check-nifti-image-is-in-the-right-orientation-position-with-python\ndef set_orientation_like(seg, nii):\n    nii_xyz = nib.aff2axcodes(nii.affine)\n    seg_data = seg.get_fdata().astype(np.uint8)  ##updated!!!\n    seg_xyz  = nib.aff2axcodes(seg.affine)\n\n    if nii_xyz[0] != seg_xyz[0]: #'L':\n        seg_data = np.flip(seg_data, axis=0)\n    if nii_xyz[1] != seg_xyz[1]: # 'P':\n        seg_data = np.flip(seg_data, axis=1)\n    if nii_xyz[2] != seg_xyz[2]: # 'S':\n        seg_data = np.flip(seg_data, axis=2)\n    fixed = nib.Nifti1Image(seg_data, nii.affine, nii.header)\n    return fixed\n</code></pre>\n<p><a href=\"https://ibb.co/QXqc86f\"><img src=\"https://i.ibb.co/x3csmMD/Selection-161.png\" alt=\"Selection-161\"></a></p>",
  "messages": [
    {
      "id": 1929305,
      "postDate": "2022-09-07T01:02:19.663Z",
      "content": "<p>it is helpful (and important) to visualise the annotation and results.  <br>\nthere are many free dicom viewer.  <br>\nhere, i am using ITK-SNAP</p>\n<p>code to realign segmentation orientation</p>\n<p>update!!! you probably need to cast to .astype(np.uint8) for seg_data below</p>\n<pre><code>import nibabel as nib\n\n#https://stackoverflow.com/questions/66231763/how-to-check-nifti-image-is-in-the-right-orientation-position-with-python\ndef set_orientation_like(seg, nii):\n    nii_xyz = nib.aff2axcodes(nii.affine)\n    seg_data = seg.get_fdata().astype(np.uint8)  ##updated!!!\n    seg_xyz  = nib.aff2axcodes(seg.affine)\n\n    if nii_xyz[0] != seg_xyz[0]: #'L':\n        seg_data = np.flip(seg_data, axis=0)\n    if nii_xyz[1] != seg_xyz[1]: # 'P':\n        seg_data = np.flip(seg_data, axis=1)\n    if nii_xyz[2] != seg_xyz[2]: # 'S':\n        seg_data = np.flip(seg_data, axis=2)\n    fixed = nib.Nifti1Image(seg_data, nii.affine, nii.header)\n    return fixed\n</code></pre>\n<p><a href=\"https://ibb.co/QXqc86f\"><img src=\"https://i.ibb.co/x3csmMD/Selection-161.png\" alt=\"Selection-161\"></a></p>",
      "rawMarkdown": "it is helpful (and important) to visualise the annotation and results.  \nthere are many free dicom viewer.  \nhere, i am using ITK-SNAP\n\ncode to realign segmentation orientation\n\nupdate!!! you probably need to cast to .astype(np.uint8) for seg\\_data below\n```\nimport nibabel as nib\n\n#https://stackoverflow.com/questions/66231763/how-to-check-nifti-image-is-in-the-right-orientation-position-with-python\ndef set_orientation_like(seg, nii):\n    nii_xyz = nib.aff2axcodes(nii.affine)\n    seg_data = seg.get_fdata().astype(np.uint8)  ##updated!!!\n    seg_xyz  = nib.aff2axcodes(seg.affine)\n\n    if nii_xyz[0] != seg_xyz[0]: #'L':\n        seg_data = np.flip(seg_data, axis=0)\n    if nii_xyz[1] != seg_xyz[1]: # 'P':\n        seg_data = np.flip(seg_data, axis=1)\n    if nii_xyz[2] != seg_xyz[2]: # 'S':\n        seg_data = np.flip(seg_data, axis=2)\n    fixed = nib.Nifti1Image(seg_data, nii.affine, nii.header)\n    return fixed\n\n\n\n```\n\n\n\n<a href=\"https://ibb.co/QXqc86f\"><img src=\"https://i.ibb.co/x3csmMD/Selection-161.png\" alt=\"Selection-161\" border=\"0\"></a>",
      "votes": 26
    },
    {
      "id": 1929602,
      "postDate": "2022-09-07T08:00:33.280Z",
      "content": "<p>this is how fracture looks like<br>\n<a href=\"https://ibb.co/zHyLQyk\"><img src=\"https://i.ibb.co/Pz7bF7S/Selection-169.png\" alt=\"Selection-169\"></a></p>\n<p>i worked with detecting and localising fracture in x-rays images before. Last time i used about 60k image-labelled xray images and the model is able to localize fracture  up to accuracy of about 90%. This can be revealed by the CAM heatmap. I used resnet50d on 2048x2048 xray images.</p>\n<p>I believed the results for spine CT would be good if we can get many,many train samples. But again getting train samples itself could be a problem in medical applications</p>\n<hr>\n<p>at least for my previous work on xray, fracture for one type bones is useful for detection on other bones.</p>",
      "rawMarkdown": "this is how fracture looks like\n<a href=\"https://ibb.co/zHyLQyk\"><img src=\"https://i.ibb.co/Pz7bF7S/Selection-169.png\" alt=\"Selection-169\" border=\"0\"></a>\n\n\ni worked with detecting and localising fracture in x-rays images before. Last time i used about 60k image-labelled xray images and the model is able to localize fracture  up to accuracy of about 90%. This can be revealed by the CAM heatmap. I used resnet50d on 2048x2048 xray images.\n\nI believed the results for spine CT would be good if we can get many,many train samples. But again getting train samples itself could be a problem in medical applications\n\n---\n\nat least for my previous work on xray, fracture for one type bones is useful for detection on other bones.\n\n",
      "votes": 1,
      "replies": [
        {
          "id": 1929640,
          "postDate": "2022-09-07T08:31:36.533Z",
          "content": "<p>On which dataset did you get 90% accuracy for bone fracture detection ?</p>",
          "rawMarkdown": "On which dataset did you get 90% accuracy for bone fracture detection ?"
        },
        {
          "id": 1929656,
          "postDate": "2022-09-07T08:57:23.760Z",
          "content": "<p>private hospital dataset from my client</p>",
          "rawMarkdown": "private hospital dataset from my client"
        },
        {
          "id": 1929666,
          "postDate": "2022-09-07T09:04:05.117Z",
          "content": "<p>there has been discussion on how to use aux label like segmentation and bounding box, it should be done like this</p>\n<p><a href=\"https://ibb.co/s5cnc4j\"><img src=\"https://i.ibb.co/n3494yr/Selection-170.png\" alt=\"Selection-170\"></a></p>\n<p>basically aux label is used to constraint your activation map in the last layer before GAP classifier<br>\n<a href=\"https://www.nature.com/articles/s41467-021-21311-3.pdf\" target=\"_blank\">https://www.nature.com/articles/s41467-021-21311-3.pdf</a></p>\n<p>then you can use human point click annotation, etc to correct pseudo aux label to create more aux label.<br>\nthis is what i done in my xray bones detection project</p>",
          "rawMarkdown": "there has been discussion on how to use aux label like segmentation and bounding box, it should be done like this\n\n<a href=\"https://ibb.co/s5cnc4j\"><img src=\"https://i.ibb.co/n3494yr/Selection-170.png\" alt=\"Selection-170\" border=\"0\"></a>\n\nbasically aux label is used to constraint your activation map in the last layer before GAP classifier\nhttps://www.nature.com/articles/s41467-021-21311-3.pdf\n\nthen you can use human point click annotation, etc to correct pseudo aux label to create more aux label.\nthis is what i done in my xray bones detection project"
        },
        {
          "id": 1929688,
          "postDate": "2022-09-07T09:23:51.990Z",
          "content": "<p>Thanks very much for sharing!</p>",
          "rawMarkdown": "Thanks very much for sharing!\n"
        }
      ]
    },
    {
      "id": 1929343,
      "postDate": "2022-09-07T02:05:44.517Z",
      "content": "<p>3d volume rendering using 3d slicer  <br>\n<a href=\"https://www.slicer.org/\" target=\"_blank\">https://www.slicer.org/</a></p>\n<p><a href=\"https://ibb.co/GVJY7Qk\"><img src=\"https://i.ibb.co/D7bc4fk/Selection-163.png\" alt=\"Selection-163\"></a></p>\n<p>helps to visualize the slicing</p>\n<p><a href=\"https://ibb.co/88C11CY\"><img src=\"https://i.ibb.co/zfMqqM6/Selection-164.png\" alt=\"Selection-164\"></a></p>\n<p>3D Slicer Tutorial - Spine Model<br>\n<a href=\"https://www.youtube.com/watch?v=DxHp7k9oKE8\" target=\"_blank\">https://www.youtube.com/watch?v=DxHp7k9oKE8</a></p>\n<p>3D Slicer Tutorial: How to Segment a Lumbar Vertebrae<br>\n<a href=\"https://www.youtube.com/watch?v=GGgP89uTOLo\" target=\"_blank\">https://www.youtube.com/watch?v=GGgP89uTOLo</a><br>\n<a href=\"https://www.youtube.com/watch?v=Uht6Fwtr9hE&amp;t=535s\" target=\"_blank\">https://www.youtube.com/watch?v=Uht6Fwtr9hE&amp;t=535s</a></p>\n<p>Region Growing Segmentation with 3DSlicer<br>\n<a href=\"https://www.youtube.com/watch?v=YGbiFh0r3EA\" target=\"_blank\">https://www.youtube.com/watch?v=YGbiFh0r3EA</a></p>",
      "rawMarkdown": "3d volume rendering using 3d slicer  \nhttps://www.slicer.org/\n\n<a href=\"https://ibb.co/GVJY7Qk\"><img src=\"https://i.ibb.co/D7bc4fk/Selection-163.png\" alt=\"Selection-163\" border=\"0\"></a>\n\nhelps to visualize the slicing\n\n<a href=\"https://ibb.co/88C11CY\"><img src=\"https://i.ibb.co/zfMqqM6/Selection-164.png\" alt=\"Selection-164\" border=\"0\"></a>\n\n3D Slicer Tutorial - Spine Model\nhttps://www.youtube.com/watch?v=DxHp7k9oKE8\n\n3D Slicer Tutorial: How to Segment a Lumbar Vertebrae\nhttps://www.youtube.com/watch?v=GGgP89uTOLo\nhttps://www.youtube.com/watch?v=Uht6Fwtr9hE&t=535s\n\nRegion Growing Segmentation with 3DSlicer\nhttps://www.youtube.com/watch?v=YGbiFh0r3EA",
      "votes": 1,
      "replies": [
        {
          "id": 1929673,
          "postDate": "2022-09-07T09:10:21.933Z",
          "content": "<p>for fanciful rendering</p>\n<p><a href=\"https://github.com/tommybazar/TBRaymarchProject\" target=\"_blank\">https://github.com/tommybazar/TBRaymarchProject</a>  <br>\n\"Allows volumetric rendering of DICOM and .MHD data with Unreal Engine.\"  </p>",
          "rawMarkdown": "for fanciful rendering\n\nhttps://github.com/tommybazar/TBRaymarchProject  \n\"Allows volumetric rendering of DICOM and .MHD data with Unreal Engine.\"  "
        }
      ]
    },
    {
      "id": 1929306,
      "postDate": "2022-09-07T01:06:04.997Z",
      "content": "<p>code to convert dicom images to nii</p>\n<pre><code>import SimpleITK as sitk\n\ndf = pd.read_csv(data_dir+'/train.csv')#, index_col='cell_id')\nfor i,d in df.iterrows():\n    print(i, d.StudyInstanceUID)\n    study_instance = d.StudyInstanceUID #   '1.2.826.0.1.3680043.780'\n\n    series_id = sitk.ImageSeriesReader.GetGDCMSeriesIDs(directory=dicom_dir+'/%s'%study_instance)\n    series_file  = sitk.ImageSeriesReader.GetGDCMSeriesFileNames(\n        dicom_dir+'/%s'%study_instance, series_id[0]\n    )\n    series_reader = sitk.ImageSeriesReader()\n    series_reader.SetFileNames(series_file)\n    series_reader.LoadPrivateTagsOn()\n    image = series_reader.Execute()\n\n    print(series_id)\n    print(str(series_file).replace(',',',\\n'))\n    print(image)\n\n    if 0:\n        npy = sitk.GetArrayFromImage(image)\n        npy = npy-npy.min()\n        npy = npy/npy.max()\n\n        for t in range(len(npy)):\n            image_show('npy', npy[t])\n            cv2.waitKey(0)\n\n    nii_file = nii_dir+'/%s.nii.gz'%study_instance\n    sitk.WriteImage(\n        image=image, fileName=nii_file, useCompression=True\n    )\n</code></pre>",
      "rawMarkdown": "code to convert dicom images to nii\n\n```\nimport SimpleITK as sitk\n\ndf = pd.read_csv(data_dir+'/train.csv')#, index_col='cell_id')\nfor i,d in df.iterrows():\n    print(i, d.StudyInstanceUID)\n    study_instance = d.StudyInstanceUID #   '1.2.826.0.1.3680043.780'\n\n    series_id = sitk.ImageSeriesReader.GetGDCMSeriesIDs(directory=dicom_dir+'/%s'%study_instance)\n    series_file  = sitk.ImageSeriesReader.GetGDCMSeriesFileNames(\n        dicom_dir+'/%s'%study_instance, series_id[0]\n    )\n    series_reader = sitk.ImageSeriesReader()\n    series_reader.SetFileNames(series_file)\n    series_reader.LoadPrivateTagsOn()\n    image = series_reader.Execute()\n\n    print(series_id)\n    print(str(series_file).replace(',',',\\n'))\n    print(image)\n\n    if 0:\n        npy = sitk.GetArrayFromImage(image)\n        npy = npy-npy.min()\n        npy = npy/npy.max()\n\n        for t in range(len(npy)):\n            image_show('npy', npy[t])\n            cv2.waitKey(0)\n\n    nii_file = nii_dir+'/%s.nii.gz'%study_instance\n    sitk.WriteImage(\n        image=image, fileName=nii_file, useCompression=True\n    )\n\n\n```",
      "votes": 1
    },
    {
      "id": 1929322,
      "postDate": "2022-09-07T01:36:54.417Z",
      "content": "<p>you can also use itk-snap to view the 3d  class activation map (CAM)<br>\nhow to overlay image: <a href=\"https://www.youtube.com/watch?v=xX5HpT67ico\" target=\"_blank\">https://www.youtube.com/watch?v=xX5HpT67ico</a></p>\n<p><a href=\"https://ibb.co/f2TyC9v\"><img src=\"https://i.ibb.co/37Pj0vz/Selection-162.png\" alt=\"Selection-162\"></a></p>\n<p>in this case my model has make the decision based on noise.  <br>\nthis method is good to debug your algorithm.</p>",
      "rawMarkdown": "you can also use itk-snap to view the 3d  class activation map (CAM)\nhow to overlay image: https://www.youtube.com/watch?v=xX5HpT67ico\n\n<a href=\"https://ibb.co/f2TyC9v\"><img src=\"https://i.ibb.co/37Pj0vz/Selection-162.png\" alt=\"Selection-162\" border=\"0\"></a>\n\nin this case my model has make the decision based on noise.  \nthis method is good to debug your algorithm.",
      "votes": 2
    }
  ],
  "comments": [
    {
      "id": 1929602,
      "author_name": "hengck23",
      "author_url": "",
      "post_date": "2022-09-07T08:00:33.280000",
      "content": "<p>this is how fracture looks like<br>\n<a href=\"https://ibb.co/zHyLQyk\"><img src=\"https://i.ibb.co/Pz7bF7S/Selection-169.png\" alt=\"Selection-169\"></a></p>\n<p>i worked with detecting and localising fracture in x-rays images before. Last time i used about 60k image-labelled xray images and the model is able to localize fracture  up to accuracy of about 90%. This can be revealed by the CAM heatmap. I used resnet50d on 2048x2048 xray images.</p>\n<p>I believed the results for spine CT would be good if we can get many,many train samples. But again getting train samples itself could be a problem in medical applications</p>\n<hr>\n<p>at least for my previous work on xray, fracture for one type bones is useful for detection on other bones.</p>",
      "votes": 1,
      "replies": [
        {
          "id": 1929640,
          "author_name": "Optimo",
          "author_url": "",
          "post_date": "2022-09-07T08:31:36.533000",
          "content": "<p>On which dataset did you get 90% accuracy for bone fracture detection ?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1929656,
          "author_name": "hengck23",
          "author_url": "",
          "post_date": "2022-09-07T08:57:23.760000",
          "content": "<p>private hospital dataset from my client</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1929666,
          "author_name": "hengck23",
          "author_url": "",
          "post_date": "2022-09-07T09:04:05.117000",
          "content": "<p>there has been discussion on how to use aux label like segmentation and bounding box, it should be done like this</p>\n<p><a href=\"https://ibb.co/s5cnc4j\"><img src=\"https://i.ibb.co/n3494yr/Selection-170.png\" alt=\"Selection-170\"></a></p>\n<p>basically aux label is used to constraint your activation map in the last layer before GAP classifier<br>\n<a href=\"https://www.nature.com/articles/s41467-021-21311-3.pdf\" target=\"_blank\">https://www.nature.com/articles/s41467-021-21311-3.pdf</a></p>\n<p>then you can use human point click annotation, etc to correct pseudo aux label to create more aux label.<br>\nthis is what i done in my xray bones detection project</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1929688,
          "author_name": "Optimo",
          "author_url": "",
          "post_date": "2022-09-07T09:23:51.990000",
          "content": "<p>Thanks very much for sharing!</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1929343,
      "author_name": "hengck23",
      "author_url": "",
      "post_date": "2022-09-07T02:05:44.517000",
      "content": "<p>3d volume rendering using 3d slicer  <br>\n<a href=\"https://www.slicer.org/\" target=\"_blank\">https://www.slicer.org/</a></p>\n<p><a href=\"https://ibb.co/GVJY7Qk\"><img src=\"https://i.ibb.co/D7bc4fk/Selection-163.png\" alt=\"Selection-163\"></a></p>\n<p>helps to visualize the slicing</p>\n<p><a href=\"https://ibb.co/88C11CY\"><img src=\"https://i.ibb.co/zfMqqM6/Selection-164.png\" alt=\"Selection-164\"></a></p>\n<p>3D Slicer Tutorial - Spine Model<br>\n<a href=\"https://www.youtube.com/watch?v=DxHp7k9oKE8\" target=\"_blank\">https://www.youtube.com/watch?v=DxHp7k9oKE8</a></p>\n<p>3D Slicer Tutorial: How to Segment a Lumbar Vertebrae<br>\n<a href=\"https://www.youtube.com/watch?v=GGgP89uTOLo\" target=\"_blank\">https://www.youtube.com/watch?v=GGgP89uTOLo</a><br>\n<a href=\"https://www.youtube.com/watch?v=Uht6Fwtr9hE&amp;t=535s\" target=\"_blank\">https://www.youtube.com/watch?v=Uht6Fwtr9hE&amp;t=535s</a></p>\n<p>Region Growing Segmentation with 3DSlicer<br>\n<a href=\"https://www.youtube.com/watch?v=YGbiFh0r3EA\" target=\"_blank\">https://www.youtube.com/watch?v=YGbiFh0r3EA</a></p>",
      "votes": 1,
      "replies": [
        {
          "id": 1929673,
          "author_name": "hengck23",
          "author_url": "",
          "post_date": "2022-09-07T09:10:21.933000",
          "content": "<p>for fanciful rendering</p>\n<p><a href=\"https://github.com/tommybazar/TBRaymarchProject\" target=\"_blank\">https://github.com/tommybazar/TBRaymarchProject</a>  <br>\n\"Allows volumetric rendering of DICOM and .MHD data with Unreal Engine.\"  </p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1929306,
      "author_name": "hengck23",
      "author_url": "",
      "post_date": "2022-09-07T01:06:04.997000",
      "content": "<p>code to convert dicom images to nii</p>\n<pre><code>import SimpleITK as sitk\n\ndf = pd.read_csv(data_dir+'/train.csv')#, index_col='cell_id')\nfor i,d in df.iterrows():\n    print(i, d.StudyInstanceUID)\n    study_instance = d.StudyInstanceUID #   '1.2.826.0.1.3680043.780'\n\n    series_id = sitk.ImageSeriesReader.GetGDCMSeriesIDs(directory=dicom_dir+'/%s'%study_instance)\n    series_file  = sitk.ImageSeriesReader.GetGDCMSeriesFileNames(\n        dicom_dir+'/%s'%study_instance, series_id[0]\n    )\n    series_reader = sitk.ImageSeriesReader()\n    series_reader.SetFileNames(series_file)\n    series_reader.LoadPrivateTagsOn()\n    image = series_reader.Execute()\n\n    print(series_id)\n    print(str(series_file).replace(',',',\\n'))\n    print(image)\n\n    if 0:\n        npy = sitk.GetArrayFromImage(image)\n        npy = npy-npy.min()\n        npy = npy/npy.max()\n\n        for t in range(len(npy)):\n            image_show('npy', npy[t])\n            cv2.waitKey(0)\n\n    nii_file = nii_dir+'/%s.nii.gz'%study_instance\n    sitk.WriteImage(\n        image=image, fileName=nii_file, useCompression=True\n    )\n</code></pre>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 1929322,
      "author_name": "hengck23",
      "author_url": "",
      "post_date": "2022-09-07T01:36:54.417000",
      "content": "<p>you can also use itk-snap to view the 3d  class activation map (CAM)<br>\nhow to overlay image: <a href=\"https://www.youtube.com/watch?v=xX5HpT67ico\" target=\"_blank\">https://www.youtube.com/watch?v=xX5HpT67ico</a></p>\n<p><a href=\"https://ibb.co/f2TyC9v\"><img src=\"https://i.ibb.co/37Pj0vz/Selection-162.png\" alt=\"Selection-162\"></a></p>\n<p>in this case my model has make the decision based on noise.  <br>\nthis method is good to debug your algorithm.</p>",
      "votes": 2,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1929305": "it is helpful (and important) to visualise the annotation and results.  \nthere are many free dicom viewer.  \nhere, i am using ITK-SNAP\n\ncode to realign segmentation orientation\n\nupdate!!! you probably need to cast to .astype(np.uint8) for seg\\_data below\n```\nimport nibabel as nib\n\n#https://stackoverflow.com/questions/66231763/how-to-check-nifti-image-is-in-the-right-orientation-position-with-python\ndef set_orientation_like(seg, nii):\n    nii_xyz = nib.aff2axcodes(nii.affine)\n    seg_data = seg.get_fdata().astype(np.uint8)  ##updated!!!\n    seg_xyz  = nib.aff2axcodes(seg.affine)\n\n    if nii_xyz[0] != seg_xyz[0]: #'L':\n        seg_data = np.flip(seg_data, axis=0)\n    if nii_xyz[1] != seg_xyz[1]: # 'P':\n        seg_data = np.flip(seg_data, axis=1)\n    if nii_xyz[2] != seg_xyz[2]: # 'S':\n        seg_data = np.flip(seg_data, axis=2)\n    fixed = nib.Nifti1Image(seg_data, nii.affine, nii.header)\n    return fixed\n\n\n\n```\n\n\n\n<a href=\"https://ibb.co/QXqc86f\"><img src=\"https://i.ibb.co/x3csmMD/Selection-161.png\" alt=\"Selection-161\" border=\"0\"></a>",
    "1929602": "this is how fracture looks like\n<a href=\"https://ibb.co/zHyLQyk\"><img src=\"https://i.ibb.co/Pz7bF7S/Selection-169.png\" alt=\"Selection-169\" border=\"0\"></a>\n\n\ni worked with detecting and localising fracture in x-rays images before. Last time i used about 60k image-labelled xray images and the model is able to localize fracture  up to accuracy of about 90%. This can be revealed by the CAM heatmap. I used resnet50d on 2048x2048 xray images.\n\nI believed the results for spine CT would be good if we can get many,many train samples. But again getting train samples itself could be a problem in medical applications\n\n---\n\nat least for my previous work on xray, fracture for one type bones is useful for detection on other bones.\n\n",
    "1929343": "3d volume rendering using 3d slicer  \nhttps://www.slicer.org/\n\n<a href=\"https://ibb.co/GVJY7Qk\"><img src=\"https://i.ibb.co/D7bc4fk/Selection-163.png\" alt=\"Selection-163\" border=\"0\"></a>\n\nhelps to visualize the slicing\n\n<a href=\"https://ibb.co/88C11CY\"><img src=\"https://i.ibb.co/zfMqqM6/Selection-164.png\" alt=\"Selection-164\" border=\"0\"></a>\n\n3D Slicer Tutorial - Spine Model\nhttps://www.youtube.com/watch?v=DxHp7k9oKE8\n\n3D Slicer Tutorial: How to Segment a Lumbar Vertebrae\nhttps://www.youtube.com/watch?v=GGgP89uTOLo\nhttps://www.youtube.com/watch?v=Uht6Fwtr9hE&t=535s\n\nRegion Growing Segmentation with 3DSlicer\nhttps://www.youtube.com/watch?v=YGbiFh0r3EA",
    "1929306": "code to convert dicom images to nii\n\n```\nimport SimpleITK as sitk\n\ndf = pd.read_csv(data_dir+'/train.csv')#, index_col='cell_id')\nfor i,d in df.iterrows():\n    print(i, d.StudyInstanceUID)\n    study_instance = d.StudyInstanceUID #   '1.2.826.0.1.3680043.780'\n\n    series_id = sitk.ImageSeriesReader.GetGDCMSeriesIDs(directory=dicom_dir+'/%s'%study_instance)\n    series_file  = sitk.ImageSeriesReader.GetGDCMSeriesFileNames(\n        dicom_dir+'/%s'%study_instance, series_id[0]\n    )\n    series_reader = sitk.ImageSeriesReader()\n    series_reader.SetFileNames(series_file)\n    series_reader.LoadPrivateTagsOn()\n    image = series_reader.Execute()\n\n    print(series_id)\n    print(str(series_file).replace(',',',\\n'))\n    print(image)\n\n    if 0:\n        npy = sitk.GetArrayFromImage(image)\n        npy = npy-npy.min()\n        npy = npy/npy.max()\n\n        for t in range(len(npy)):\n            image_show('npy', npy[t])\n            cv2.waitKey(0)\n\n    nii_file = nii_dir+'/%s.nii.gz'%study_instance\n    sitk.WriteImage(\n        image=image, fileName=nii_file, useCompression=True\n    )\n\n\n```",
    "1929322": "you can also use itk-snap to view the 3d  class activation map (CAM)\nhow to overlay image: https://www.youtube.com/watch?v=xX5HpT67ico\n\n<a href=\"https://ibb.co/f2TyC9v\"><img src=\"https://i.ibb.co/37Pj0vz/Selection-162.png\" alt=\"Selection-162\" border=\"0\"></a>\n\nin this case my model has make the decision based on noise.  \nthis method is good to debug your algorithm."
  }
}