{
  "id": 170995,
  "title": "Dicom image",
  "url": "/competitions/osic-pulmonary-fibrosis-progression/discussion/170995",
  "author_name": "",
  "post_date": "2020-07-29T22:39:52.418107500Z",
  "votes": null,
  "comment_count": 3,
  "views": 0,
  "content": "<p>Hello;</p>\n\n<p>I'd like to know there is any details about the DICOM specification , for example  if \"16 bit DICOM images have values ranging from -32768 to 32768 while 8-bit grey-scale images store values from 0 to 255\"...</p>\n\n<p>Thanks</p>",
  "messages": [
    {
      "id": "951125",
      "postDate": "07/29/2020 22:39:52",
      "content": "<p>Hello;</p>\n\n<p>I'd like to know there is any details about the DICOM specification , for example  if \"16 bit DICOM images have values ranging from -32768 to 32768 while 8-bit grey-scale images store values from 0 to 255\"...</p>\n\n<p>Thanks</p>",
      "rawMarkdown": "Hello;\n\nI'd like to know there is any details about the DICOM specification , for example  if \"16 bit DICOM images have values ranging from -32768 to 32768 while 8-bit grey-scale images store values from 0 to 255\"...\n\nThanks",
      "votes": null
    },
    {
      "id": "951170",
      "postDate": "07/30/2020 00:43:27",
      "content": "<p>A few basics (off the top of my head, please excuse any inaccuracies):</p>\n\n<p>CT images are typically -2000 to 2000.</p>\n\n<p>This is too many shades of gray to easily look at, so usually you use a \"Window and Level\" to highlight a portion of the grayscale. This serves to give you good detail in a portion of the -2000 to 2000 at the cost of making things outside that range less distinct.</p>\n\n<p>So for lungs (which are largely air), we might apply a window of 1500 and level of -600.</p>\n\n<p>For soft tissues (heart, abdomen), we might apply a window of 400 and a level of 50.</p>\n\n<p>Since we are most interesting in the lungs for this competition, you might apply a lung window and level, so take values around -600 as the \"center\" and a range of +/- 256. Clip everything above or below -856 to -856 and everything above -344 to -344.</p>\n\n<p>Then scale the resulting 512 values to 0-255.</p>\n\n<p>I haven't implemented it, but I think it makes sense.</p>\n\n<p>If you simply scale the entire -2000 to 2000 range to 0-255, most of the datapoints will cluster around a small set of values, and your network might to differentiate them from each other.</p>\n\n<p>Also note, that sometimes DICOM images are not stored at quite the expected scale, so you need to inspect the results of this on each DICOM image. You might have to adjust the scale for some images.</p>\n\n<p>There are DICOM window/level/slope/intercept tags which are sometimes helpful. If you search the kaggle discussions you can find examples of the math to apply these tags.</p>\n\n<p>-Rich</p>",
      "rawMarkdown": "A few basics (off the top of my head, please excuse any inaccuracies):\n\nCT images are typically -2000 to 2000.\n\nThis is too many shades of gray to easily look at, so usually you use a \"Window and Level\" to highlight a portion of the grayscale. This serves to give you good detail in a portion of the -2000 to 2000 at the cost of making things outside that range less distinct.\n\nSo for lungs (which are largely air), we might apply a window of 1500 and level of -600.\n\nFor soft tissues (heart, abdomen), we might apply a window of 400 and a level of 50.\n\nSince we are most interesting in the lungs for this competition, you might apply a lung window and level, so take values around -600 as the \"center\" and a range of +/- 256. Clip everything above or below -856 to -856 and everything above -344 to -344.\n\nThen scale the resulting 512 values to 0-255.\n\nI haven't implemented it, but I think it makes sense.\n\nIf you simply scale the entire -2000 to 2000 range to 0-255, most of the datapoints will cluster around a small set of values, and your network might to differentiate them from each other.\n\nAlso note, that sometimes DICOM images are not stored at quite the expected scale, so you need to inspect the results of this on each DICOM image. You might have to adjust the scale for some images.\n\nThere are DICOM window/level/slope/intercept tags which are sometimes helpful. If you search the kaggle discussions you can find examples of the math to apply these tags.\n\n-Rich",
      "votes": null
    },
    {
      "id": "951179",
      "postDate": "07/30/2020 01:06:04",
      "content": "<p>Hi Mariam,\nCT Dicom images are stored in <a href=\"https://radiopaedia.org/articles/hounsfield-unit?lang=gb#%3a~%3atext=Hounsfield%20units%20%28HU%29%20are%20a,the%20measured%20attenuation%20coefficients%201.\">Hounsfield Units</a> . So, it ranges -as you see in the data- from -2000 to 2000. Each tissue has its own range of values. People usually apply windowing (using only a specific range of values) to select a specific range of values in the image according to the application. For example in <a href=\"/richardepstein\">@richardepstein</a> 's comment: you can apply a window of 1500 and a level of -600 to focus on the lung region. Window is basically the width, so with a center of -600 and a <em>range/width</em> of 1500, you are typically focusing on the values from (-600 - 1500/2) to (-600 + 1500/2) =&gt; -1350 to 150.</p>\n\n<p>I would suggest checking some of the notebooks as it might include visualization of this. Once you are done, you can rescale the resulting image to be within 0-255 as usual images.\nI hope this helps. Best of luck!</p>",
      "rawMarkdown": "Hi Mariam,\nCT Dicom images are stored in [Hounsfield Units](https://radiopaedia.org/articles/hounsfield-unit?lang=gb#:~:text=Hounsfield%20units%20(HU)%20are%20a,the%20measured%20attenuation%20coefficients%201.) . So, it ranges -as you see in the data- from -2000 to 2000. Each tissue has its own range of values. People usually apply windowing (using only a specific range of values) to select a specific range of values in the image according to the application. For example in @richardepstein 's comment: you can apply a window of 1500 and a level of -600 to focus on the lung region. Window is basically the width, so with a center of -600 and a *range/width* of 1500, you are typically focusing on the values from (-600 - 1500/2) to (-600 + 1500/2) =&gt; -1350 to 150.\n\nI would suggest checking some of the notebooks as it might include visualization of this. Once you are done, you can rescale the resulting image to be within 0-255 as usual images.\nI hope this helps. Best of luck!",
      "votes": null
    },
    {
      "id": "957817",
      "postDate": "08/04/2020 15:17:43",
      "content": "<p>Thanks A lot its very informative...</p>",
      "rawMarkdown": "Thanks A lot its very informative...",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 951170,
      "author_name": "richardepstein",
      "author_url": "",
      "post_date": "07/30/2020 00:43:27",
      "content": "<p>A few basics (off the top of my head, please excuse any inaccuracies):</p>\n\n<p>CT images are typically -2000 to 2000.</p>\n\n<p>This is too many shades of gray to easily look at, so usually you use a \"Window and Level\" to highlight a portion of the grayscale. This serves to give you good detail in a portion of the -2000 to 2000 at the cost of making things outside that range less distinct.</p>\n\n<p>So for lungs (which are largely air), we might apply a window of 1500 and level of -600.</p>\n\n<p>For soft tissues (heart, abdomen), we might apply a window of 400 and a level of 50.</p>\n\n<p>Since we are most interesting in the lungs for this competition, you might apply a lung window and level, so take values around -600 as the \"center\" and a range of +/- 256. Clip everything above or below -856 to -856 and everything above -344 to -344.</p>\n\n<p>Then scale the resulting 512 values to 0-255.</p>\n\n<p>I haven't implemented it, but I think it makes sense.</p>\n\n<p>If you simply scale the entire -2000 to 2000 range to 0-255, most of the datapoints will cluster around a small set of values, and your network might to differentiate them from each other.</p>\n\n<p>Also note, that sometimes DICOM images are not stored at quite the expected scale, so you need to inspect the results of this on each DICOM image. You might have to adjust the scale for some images.</p>\n\n<p>There are DICOM window/level/slope/intercept tags which are sometimes helpful. If you search the kaggle discussions you can find examples of the math to apply these tags.</p>\n\n<p>-Rich</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 951179,
      "author_name": "ahmedhshahin",
      "author_url": "",
      "post_date": "07/30/2020 01:06:04",
      "content": "<p>Hi Mariam,\nCT Dicom images are stored in <a href=\"https://radiopaedia.org/articles/hounsfield-unit?lang=gb#%3a~%3atext=Hounsfield%20units%20%28HU%29%20are%20a,the%20measured%20attenuation%20coefficients%201.\">Hounsfield Units</a> . So, it ranges -as you see in the data- from -2000 to 2000. Each tissue has its own range of values. People usually apply windowing (using only a specific range of values) to select a specific range of values in the image according to the application. For example in <a href=\"/richardepstein\">@richardepstein</a> 's comment: you can apply a window of 1500 and a level of -600 to focus on the lung region. Window is basically the width, so with a center of -600 and a <em>range/width</em> of 1500, you are typically focusing on the values from (-600 - 1500/2) to (-600 + 1500/2) =&gt; -1350 to 150.</p>\n\n<p>I would suggest checking some of the notebooks as it might include visualization of this. Once you are done, you can rescale the resulting image to be within 0-255 as usual images.\nI hope this helps. Best of luck!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 957817,
      "author_name": "mariamshehagmailcom",
      "author_url": "",
      "post_date": "08/04/2020 15:17:43",
      "content": "<p>Thanks A lot its very informative...</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "951125": "Hello;\n\nI'd like to know there is any details about the DICOM specification , for example  if \"16 bit DICOM images have values ranging from -32768 to 32768 while 8-bit grey-scale images store values from 0 to 255\"...\n\nThanks",
    "951170": "A few basics (off the top of my head, please excuse any inaccuracies):\n\nCT images are typically -2000 to 2000.\n\nThis is too many shades of gray to easily look at, so usually you use a \"Window and Level\" to highlight a portion of the grayscale. This serves to give you good detail in a portion of the -2000 to 2000 at the cost of making things outside that range less distinct.\n\nSo for lungs (which are largely air), we might apply a window of 1500 and level of -600.\n\nFor soft tissues (heart, abdomen), we might apply a window of 400 and a level of 50.\n\nSince we are most interesting in the lungs for this competition, you might apply a lung window and level, so take values around -600 as the \"center\" and a range of +/- 256. Clip everything above or below -856 to -856 and everything above -344 to -344.\n\nThen scale the resulting 512 values to 0-255.\n\nI haven't implemented it, but I think it makes sense.\n\nIf you simply scale the entire -2000 to 2000 range to 0-255, most of the datapoints will cluster around a small set of values, and your network might to differentiate them from each other.\n\nAlso note, that sometimes DICOM images are not stored at quite the expected scale, so you need to inspect the results of this on each DICOM image. You might have to adjust the scale for some images.\n\nThere are DICOM window/level/slope/intercept tags which are sometimes helpful. If you search the kaggle discussions you can find examples of the math to apply these tags.\n\n-Rich",
    "951179": "Hi Mariam,\nCT Dicom images are stored in [Hounsfield Units](https://radiopaedia.org/articles/hounsfield-unit?lang=gb#:~:text=Hounsfield%20units%20(HU)%20are%20a,the%20measured%20attenuation%20coefficients%201.) . So, it ranges -as you see in the data- from -2000 to 2000. Each tissue has its own range of values. People usually apply windowing (using only a specific range of values) to select a specific range of values in the image according to the application. For example in @richardepstein 's comment: you can apply a window of 1500 and a level of -600 to focus on the lung region. Window is basically the width, so with a center of -600 and a *range/width* of 1500, you are typically focusing on the values from (-600 - 1500/2) to (-600 + 1500/2) =&gt; -1350 to 150.\n\nI would suggest checking some of the notebooks as it might include visualization of this. Once you are done, you can rescale the resulting image to be within 0-255 as usual images.\nI hope this helps. Best of luck!",
    "957817": "Thanks A lot its very informative..."
  },
  "source": "meta"
}