{
  "id": 369815,
  "title": "Why use \"windowing\" on mammography images?",
  "url": "/competitions/rsna-breast-cancer-detection/discussion/369815",
  "author_name": "David Roberts",
  "post_date": "2022-12-01T14:14:51.551000",
  "votes": 18,
  "comment_count": 7,
  "views": 0,
  "content": "<p>I made a simple notebook to demonstrate why to use windowing on mammography (or any DICOM) images versus simple normalization.</p>\n<p>Since most DICOM files have ranges greater than 0-255 (8 bit), applying standard normalization techniques results in loss of information. Since there is no way around this loss, the best we can do is to pick the \"most valuable\" range of pixels to normalize. This is what \"windowing\" is .. and it's critical to human readers being able to interpret images.</p>\n<p>It will also help with exports to JPG/PNG.</p>\n<p>Notebook-&gt; <a href=\"https://www.kaggle.com/davidbroberts/mammography-apply-windowing\" target=\"_blank\">https://www.kaggle.com/davidbroberts/mammography-apply-windowing</a></p>",
  "messages": [
    {
      "id": 2051605,
      "postDate": "2022-12-01T14:14:51.550Z",
      "content": "<p>I made a simple notebook to demonstrate why to use windowing on mammography (or any DICOM) images versus simple normalization.</p>\n<p>Since most DICOM files have ranges greater than 0-255 (8 bit), applying standard normalization techniques results in loss of information. Since there is no way around this loss, the best we can do is to pick the \"most valuable\" range of pixels to normalize. This is what \"windowing\" is .. and it's critical to human readers being able to interpret images.</p>\n<p>It will also help with exports to JPG/PNG.</p>\n<p>Notebook-&gt; <a href=\"https://www.kaggle.com/davidbroberts/mammography-apply-windowing\" target=\"_blank\">https://www.kaggle.com/davidbroberts/mammography-apply-windowing</a></p>",
      "rawMarkdown": "I made a simple notebook to demonstrate why to use windowing on mammography (or any DICOM) images versus simple normalization.\n\nSince most DICOM files have ranges greater than 0-255 (8 bit), applying standard normalization techniques results in loss of information. Since there is no way around this loss, the best we can do is to pick the \"most valuable\" range of pixels to normalize. This is what \"windowing\" is .. and it's critical to human readers being able to interpret images.\n\nIt will also help with exports to JPG/PNG.\n\nNotebook-> https://www.kaggle.com/davidbroberts/mammography-apply-windowing",
      "votes": 17
    },
    {
      "id": 2051747,
      "postDate": "2022-12-01T15:46:52.017Z",
      "content": "<p>Very interesting work! But just would like to point that while focusing on the \"most valuable range of pixel information\" might be useful to a human, it doesn't necessarily have to be useful to a CV model.</p>\n<p>It might just as well be that having the values on a DICOM representation be compressed to a narrow range, but where the mean or some other characteristic carries signal, all that can be more useful to a DL model than having the values normalized to a range common across all examples.</p>\n<p>This is a fun thing to think about and finding a representation that works well for CV models is an interesting problem to solve 🙂 For instance, a CV model is quite likely to work better with having the values zero centered and scaled by standard deviation than having each range of values for a given image projected onto some predefined range of values common across all the examples.</p>\n<p>Anyhow -- I don't know what the answer to this is, but certainly interesting to think about this and experiment 🙌</p>",
      "rawMarkdown": "Very interesting work! But just would like to point that while focusing on the \"most valuable range of pixel information\" might be useful to a human, it doesn't necessarily have to be useful to a CV model.\n\nIt might just as well be that having the values on a DICOM representation be compressed to a narrow range, but where the mean or some other characteristic carries signal, all that can be more useful to a DL model than having the values normalized to a range common across all examples.\n\nThis is a fun thing to think about and finding a representation that works well for CV models is an interesting problem to solve 🙂 For instance, a CV model is quite likely to work better with having the values zero centered and scaled by standard deviation than having each range of values for a given image projected onto some predefined range of values common across all the examples.\n\nAnyhow -- I don't know what the answer to this is, but certainly interesting to think about this and experiment 🙌",
      "votes": 1,
      "replies": [
        {
          "id": 2051756,
          "postDate": "2022-12-01T15:52:58.797Z",
          "content": "<p>The problem is, normalization from 16 bit to 8 bit is a lossy operation. You always lose data. In the case of radiography, the importance lies in the difference between densities. These differences can't be represented as accurately with 8 bit numbers as they can with 10, 12 or 16 bit numbers like DICOM uses.</p>\n<p>The overall idea is to not destroy the density/contrast balance by allowing outlying pixels to skew the normalization to the point images appear \"washed out\" .. or the contrast is too low.</p>",
          "rawMarkdown": "The problem is, normalization from 16 bit to 8 bit is a lossy operation. You always lose data. In the case of radiography, the importance lies in the difference between densities. These differences can't be represented as accurately with 8 bit numbers as they can with 10, 12 or 16 bit numbers like DICOM uses.\n\nThe overall idea is to not destroy the density/contrast balance by allowing outlying pixels to skew the normalization to the point images appear \"washed out\" .. or the contrast is too low.",
          "votes": 5
        },
        {
          "id": 2051848,
          "postDate": "2022-12-01T16:47:01.427Z",
          "content": "<p>Great idea <a href=\"https://www.kaggle.com/davidbroberts\" target=\"_blank\">@davidbroberts</a>! Besides the results speak for themselves!!</p>",
          "rawMarkdown": "Great idea @davidbroberts! Besides the results speak for themselves!!"
        },
        {
          "id": 2051920,
          "postDate": "2022-12-01T18:03:49.453Z",
          "rawMarkdown": "",
          "isDeleted": true
        },
        {
          "id": 2051935,
          "postDate": "2022-12-01T18:22:11.410Z",
          "content": "<p>one idea will be just to stack different normalizations as channel, and generate multi chanel  input to NN</p>",
          "rawMarkdown": "one idea will be just to stack different normalizations as channel, and generate multi chanel  input to NN",
          "votes": 14
        }
      ]
    },
    {
      "id": 2053345,
      "postDate": "2022-12-03T06:20:51.813Z",
      "content": "<p>a better solution is to use the window to shift the values but don't cap the values (e.g. use 16-bit float png/pmg )</p>",
      "rawMarkdown": "a better solution is to use the window to shift the values but don't cap the values (e.g. use 16-bit float png/pmg )",
      "votes": 2,
      "replies": [
        {
          "id": 2053799,
          "postDate": "2022-12-03T16:11:20.163Z",
          "content": "<p>Good point <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a>, I'm not sure if that would make it better in all cases though. I've thought about this very issue for a couple years now. I am afraid that we'll lose the high contrast details by NOT standardizing to 8 bit. In the case of mammography, we're not looking for subtle, soft tissue differences as much as we are looking for dense stuff that is much \"brighter\" than the surrounding tissue. We're not using the pixel values (like we would use H.U. in CT), so the actual values are irrelevant. Windowing allows us to selectively group pixels to maximize the contrast to other pixels.</p>\n<p>I'd love to see a study done on this. I believe windowing is absolutely necessary in some, but not all DICOM cases. I've always been adverse to applying any single standardization across all DICOM images in a dataset though.</p>",
          "rawMarkdown": "Good point @hengck23, I'm not sure if that would make it better in all cases though. I've thought about this very issue for a couple years now. I am afraid that we'll lose the high contrast details by NOT standardizing to 8 bit. In the case of mammography, we're not looking for subtle, soft tissue differences as much as we are looking for dense stuff that is much \"brighter\" than the surrounding tissue. We're not using the pixel values (like we would use H.U. in CT), so the actual values are irrelevant. Windowing allows us to selectively group pixels to maximize the contrast to other pixels.\n\nI'd love to see a study done on this. I believe windowing is absolutely necessary in some, but not all DICOM cases. I've always been adverse to applying any single standardization across all DICOM images in a dataset though."
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 2051747,
      "author_name": "Radek Osmulski",
      "author_url": "",
      "post_date": "2022-12-01T15:46:52.017000",
      "content": "<p>Very interesting work! But just would like to point that while focusing on the \"most valuable range of pixel information\" might be useful to a human, it doesn't necessarily have to be useful to a CV model.</p>\n<p>It might just as well be that having the values on a DICOM representation be compressed to a narrow range, but where the mean or some other characteristic carries signal, all that can be more useful to a DL model than having the values normalized to a range common across all examples.</p>\n<p>This is a fun thing to think about and finding a representation that works well for CV models is an interesting problem to solve 🙂 For instance, a CV model is quite likely to work better with having the values zero centered and scaled by standard deviation than having each range of values for a given image projected onto some predefined range of values common across all the examples.</p>\n<p>Anyhow -- I don't know what the answer to this is, but certainly interesting to think about this and experiment 🙌</p>",
      "votes": 1,
      "replies": [
        {
          "id": 2051756,
          "author_name": "David Roberts",
          "author_url": "",
          "post_date": "2022-12-01T15:52:58.797000",
          "content": "<p>The problem is, normalization from 16 bit to 8 bit is a lossy operation. You always lose data. In the case of radiography, the importance lies in the difference between densities. These differences can't be represented as accurately with 8 bit numbers as they can with 10, 12 or 16 bit numbers like DICOM uses.</p>\n<p>The overall idea is to not destroy the density/contrast balance by allowing outlying pixels to skew the normalization to the point images appear \"washed out\" .. or the contrast is too low.</p>",
          "votes": 5,
          "replies": []
        },
        {
          "id": 2051848,
          "author_name": "Gianetan",
          "author_url": "",
          "post_date": "2022-12-01T16:47:01.427000",
          "content": "<p>Great idea <a href=\"https://www.kaggle.com/davidbroberts\" target=\"_blank\">@davidbroberts</a>! Besides the results speak for themselves!!</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 2051920,
          "author_name": "",
          "author_url": "",
          "post_date": "2022-12-01T18:03:49.453000",
          "content": "",
          "votes": 0,
          "replies": []
        },
        {
          "id": 2051935,
          "author_name": "DrHB",
          "author_url": "",
          "post_date": "2022-12-01T18:22:11.410000",
          "content": "<p>one idea will be just to stack different normalizations as channel, and generate multi chanel  input to NN</p>",
          "votes": 14,
          "replies": []
        }
      ]
    },
    {
      "id": 2053345,
      "author_name": "hengck23",
      "author_url": "",
      "post_date": "2022-12-03T06:20:51.813000",
      "content": "<p>a better solution is to use the window to shift the values but don't cap the values (e.g. use 16-bit float png/pmg )</p>",
      "votes": 2,
      "replies": [
        {
          "id": 2053799,
          "author_name": "David Roberts",
          "author_url": "",
          "post_date": "2022-12-03T16:11:20.163000",
          "content": "<p>Good point <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a>, I'm not sure if that would make it better in all cases though. I've thought about this very issue for a couple years now. I am afraid that we'll lose the high contrast details by NOT standardizing to 8 bit. In the case of mammography, we're not looking for subtle, soft tissue differences as much as we are looking for dense stuff that is much \"brighter\" than the surrounding tissue. We're not using the pixel values (like we would use H.U. in CT), so the actual values are irrelevant. Windowing allows us to selectively group pixels to maximize the contrast to other pixels.</p>\n<p>I'd love to see a study done on this. I believe windowing is absolutely necessary in some, but not all DICOM cases. I've always been adverse to applying any single standardization across all DICOM images in a dataset though.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2051605": "I made a simple notebook to demonstrate why to use windowing on mammography (or any DICOM) images versus simple normalization.\n\nSince most DICOM files have ranges greater than 0-255 (8 bit), applying standard normalization techniques results in loss of information. Since there is no way around this loss, the best we can do is to pick the \"most valuable\" range of pixels to normalize. This is what \"windowing\" is .. and it's critical to human readers being able to interpret images.\n\nIt will also help with exports to JPG/PNG.\n\nNotebook-> https://www.kaggle.com/davidbroberts/mammography-apply-windowing",
    "2051747": "Very interesting work! But just would like to point that while focusing on the \"most valuable range of pixel information\" might be useful to a human, it doesn't necessarily have to be useful to a CV model.\n\nIt might just as well be that having the values on a DICOM representation be compressed to a narrow range, but where the mean or some other characteristic carries signal, all that can be more useful to a DL model than having the values normalized to a range common across all examples.\n\nThis is a fun thing to think about and finding a representation that works well for CV models is an interesting problem to solve 🙂 For instance, a CV model is quite likely to work better with having the values zero centered and scaled by standard deviation than having each range of values for a given image projected onto some predefined range of values common across all the examples.\n\nAnyhow -- I don't know what the answer to this is, but certainly interesting to think about this and experiment 🙌",
    "2053345": "a better solution is to use the window to shift the values but don't cap the values (e.g. use 16-bit float png/pmg )"
  }
}