{
  "id": 244377,
  "title": "How to use dicom image with CNN",
  "url": "/competitions/siim-covid19-detection/discussion/244377",
  "author_name": "",
  "post_date": "2021-06-06T14:01:24.964932100Z",
  "votes": 2,
  "comment_count": 4,
  "views": 0,
  "content": "<p>How can I feed dicom Images to CNN</p>",
  "messages": [
    {
      "id": "1338508",
      "postDate": "06/06/2021 14:01:24",
      "content": "<p>How can I feed dicom Images to CNN</p>",
      "rawMarkdown": "How can I feed dicom Images to CNN",
      "votes": null
    },
    {
      "id": "1338865",
      "postDate": "06/06/2021 19:41:05",
      "content": "<p>After loading the DICOM file, you have the image as numpy array in ds.pixel_array. From here you can do anything you want - you can feed it to a CNN as it, resize it, or save it in another format. </p>",
      "rawMarkdown": "After loading the DICOM file, you have the image as numpy array in ds.pixel_array. From here you can do anything you want - you can feed it to a CNN as it, resize it, or save it in another format.",
      "votes": null
    },
    {
      "id": "1338994",
      "postDate": "06/06/2021 23:52:45",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/nur988\" target=\"_blank\">@nur988</a> </p>\n<p>no need to use the raw files/ Dataset (dicom Images)</p>\n<p>see here some Kagglers made jpg , png images from the dataset.</p>\n<p><a href=\"https://www.kaggle.com/h053473666/siimcovid19-512-img-png-600-study-png\" target=\"_blank\">https://www.kaggle.com/h053473666/siimcovid19-512-img-png-600-study-png</a><br>\n<a href=\"https://www.kaggle.com/awsaf49/siimcovid19-1024-jpg-image-dataset\" target=\"_blank\">https://www.kaggle.com/awsaf49/siimcovid19-1024-jpg-image-dataset</a><br>\n<a href=\"https://www.kaggle.com/awsaf49/siimcovid19-256-jpg-image-dataset\" target=\"_blank\">https://www.kaggle.com/awsaf49/siimcovid19-256-jpg-image-dataset</a></p>\n<p>More here<br>\n<a href=\"https://www.kaggle.com/search?q=siimcovid19+in%3Adatasets\" target=\"_blank\">https://www.kaggle.com/search?q=siimcovid19+in%3Adatasets</a></p>",
      "rawMarkdown": "Hi @nur988 \n\nno need to use the raw files/ Dataset (dicom Images)\n\nsee here some Kagglers made jpg , png images from the dataset.\n\nhttps://www.kaggle.com/h053473666/siimcovid19-512-img-png-600-study-png\nhttps://www.kaggle.com/awsaf49/siimcovid19-1024-jpg-image-dataset\nhttps://www.kaggle.com/awsaf49/siimcovid19-256-jpg-image-dataset\n\nMore here\nhttps://www.kaggle.com/search?q=siimcovid19+in%3Adatasets",
      "votes": null
    },
    {
      "id": "1339106",
      "postDate": "06/07/2021 03:33:40",
      "content": "<p>To work with dicom images, there is a python package called <a href=\"https://pypi.org/project/pydicom/\" target=\"_blank\">pydicom</a>.<br>\nThe pydicom package allows us to extract all of the metadata from a set of DICOM files and store them in a way that is easy to access.</p>\n<p><strong>Read a DICOM file</strong><br>\n<code>my_dicom = pydicom.dcmread(“MY_DICOM.dcm”)</code><br>\n<strong>Access the actual pixel data of the image</strong><br>\n<code>my_dicom_image = my_dicom.pixel_array</code><br>\n<strong>Show the Image</strong><br>\n<code>matplotlib.pyplot.imshow(my_dicom_image, cmap = ‘gray’)</code></p>\n<p><strong>P.S.</strong> : data returned in my_dicom.pixel_array will be in the coordinate format [y,x].</p>",
      "rawMarkdown": "To work with dicom images, there is a python package called [pydicom](https://pypi.org/project/pydicom/).\nThe pydicom package allows us to extract all of the metadata from a set of DICOM files and store them in a way that is easy to access.\n\n**Read a DICOM file**\n`my_dicom = pydicom.dcmread(“MY_DICOM.dcm”)`\n**Access the actual pixel data of the image**\n`my_dicom_image = my_dicom.pixel_array `\n**Show the Image**\n`matplotlib.pyplot.imshow(my_dicom_image, cmap = ‘gray’)`\n\n**P.S.** : data returned in my_dicom.pixel_array will be in the coordinate format [y,x].",
      "votes": null
    },
    {
      "id": "1340380",
      "postDate": "06/07/2021 20:36:48",
      "content": "<p>I made a notebook a couple weeks ago that shows how to feed raw DICOM pixels into a CNN. In this case, I added a layer to InceptionV3. </p>\n<p><a href=\"https://www.kaggle.com/davidbroberts/dicom-full-range-pixels-as-cnn-input\" target=\"_blank\">https://www.kaggle.com/davidbroberts/dicom-full-range-pixels-as-cnn-input</a></p>",
      "rawMarkdown": "I made a notebook a couple weeks ago that shows how to feed raw DICOM pixels into a CNN. In this case, I added a layer to InceptionV3. \n\nhttps://www.kaggle.com/davidbroberts/dicom-full-range-pixels-as-cnn-input",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1338865,
      "author_name": "parzukrofila",
      "author_url": "",
      "post_date": "06/06/2021 19:41:05",
      "content": "<p>After loading the DICOM file, you have the image as numpy array in ds.pixel_array. From here you can do anything you want - you can feed it to a CNN as it, resize it, or save it in another format. </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1338994,
      "author_name": "faisalalsrheed",
      "author_url": "",
      "post_date": "06/06/2021 23:52:45",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/nur988\" target=\"_blank\">@nur988</a> </p>\n<p>no need to use the raw files/ Dataset (dicom Images)</p>\n<p>see here some Kagglers made jpg , png images from the dataset.</p>\n<p><a href=\"https://www.kaggle.com/h053473666/siimcovid19-512-img-png-600-study-png\" target=\"_blank\">https://www.kaggle.com/h053473666/siimcovid19-512-img-png-600-study-png</a><br>\n<a href=\"https://www.kaggle.com/awsaf49/siimcovid19-1024-jpg-image-dataset\" target=\"_blank\">https://www.kaggle.com/awsaf49/siimcovid19-1024-jpg-image-dataset</a><br>\n<a href=\"https://www.kaggle.com/awsaf49/siimcovid19-256-jpg-image-dataset\" target=\"_blank\">https://www.kaggle.com/awsaf49/siimcovid19-256-jpg-image-dataset</a></p>\n<p>More here<br>\n<a href=\"https://www.kaggle.com/search?q=siimcovid19+in%3Adatasets\" target=\"_blank\">https://www.kaggle.com/search?q=siimcovid19+in%3Adatasets</a></p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1339106,
      "author_name": "adish333",
      "author_url": "",
      "post_date": "06/07/2021 03:33:40",
      "content": "<p>To work with dicom images, there is a python package called <a href=\"https://pypi.org/project/pydicom/\" target=\"_blank\">pydicom</a>.<br>\nThe pydicom package allows us to extract all of the metadata from a set of DICOM files and store them in a way that is easy to access.</p>\n<p><strong>Read a DICOM file</strong><br>\n<code>my_dicom = pydicom.dcmread(“MY_DICOM.dcm”)</code><br>\n<strong>Access the actual pixel data of the image</strong><br>\n<code>my_dicom_image = my_dicom.pixel_array</code><br>\n<strong>Show the Image</strong><br>\n<code>matplotlib.pyplot.imshow(my_dicom_image, cmap = ‘gray’)</code></p>\n<p><strong>P.S.</strong> : data returned in my_dicom.pixel_array will be in the coordinate format [y,x].</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1340380,
      "author_name": "davidbroberts",
      "author_url": "",
      "post_date": "06/07/2021 20:36:48",
      "content": "<p>I made a notebook a couple weeks ago that shows how to feed raw DICOM pixels into a CNN. In this case, I added a layer to InceptionV3. </p>\n<p><a href=\"https://www.kaggle.com/davidbroberts/dicom-full-range-pixels-as-cnn-input\" target=\"_blank\">https://www.kaggle.com/davidbroberts/dicom-full-range-pixels-as-cnn-input</a></p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1338508": "How can I feed dicom Images to CNN",
    "1338865": "After loading the DICOM file, you have the image as numpy array in ds.pixel_array. From here you can do anything you want - you can feed it to a CNN as it, resize it, or save it in another format.",
    "1338994": "Hi @nur988 \n\nno need to use the raw files/ Dataset (dicom Images)\n\nsee here some Kagglers made jpg , png images from the dataset.\n\nhttps://www.kaggle.com/h053473666/siimcovid19-512-img-png-600-study-png\nhttps://www.kaggle.com/awsaf49/siimcovid19-1024-jpg-image-dataset\nhttps://www.kaggle.com/awsaf49/siimcovid19-256-jpg-image-dataset\n\nMore here\nhttps://www.kaggle.com/search?q=siimcovid19+in%3Adatasets",
    "1339106": "To work with dicom images, there is a python package called [pydicom](https://pypi.org/project/pydicom/).\nThe pydicom package allows us to extract all of the metadata from a set of DICOM files and store them in a way that is easy to access.\n\n**Read a DICOM file**\n`my_dicom = pydicom.dcmread(“MY_DICOM.dcm”)`\n**Access the actual pixel data of the image**\n`my_dicom_image = my_dicom.pixel_array `\n**Show the Image**\n`matplotlib.pyplot.imshow(my_dicom_image, cmap = ‘gray’)`\n\n**P.S.** : data returned in my_dicom.pixel_array will be in the coordinate format [y,x].",
    "1340380": "I made a notebook a couple weeks ago that shows how to feed raw DICOM pixels into a CNN. In this case, I added a layer to InceptionV3. \n\nhttps://www.kaggle.com/davidbroberts/dicom-full-range-pixels-as-cnn-input"
  },
  "source": "meta"
}