{
  "id": 176155,
  "title": "Basic questions about (dicom) image data",
  "url": "/competitions/osic-pulmonary-fibrosis-progression/discussion/176155",
  "author_name": "",
  "post_date": "2020-08-20T17:28:09.144958800Z",
  "votes": 3,
  "comment_count": 6,
  "views": 0,
  "content": "<p>I recently join the comp and still exploring, I have searched over discussions and kernels for my questions but couldn't find clear answer (but theres chance i missed them)</p>\n<p>My basic questions are: </p>\n<ol>\n<li>Regular image with RGB or gray scale is between 0~255, why the image here has range from e.g. -3000 to 4000? What exactly does these value/units represent? (any explanation of what is behind the scene is appreciated) </li>\n<li>I saw many discussion/kernel mentioned Hounsfield units (HU) and transformation to it, from what I searched online, seems like this is an unit that shows radio density in reference of water and air. Why this is possibly needed/preferred for a. medical practice b. build a ML model (i.e. can't we just leave the pixel value as it is)?</li>\n<li>Pixel spacing, from online info, this represents the physical distance between two pixels. I never encountered such info from past work with images, Could someone explain again, why could this possibly benefits for a. medical aspect b. model building (e.g. shall we utilize this in some image transformations and why)?</li>\n</ol>\n<p>Thanks! </p>",
  "messages": [
    {
      "id": "979199",
      "postDate": "08/20/2020 17:28:09",
      "content": "<p>I recently join the comp and still exploring, I have searched over discussions and kernels for my questions but couldn't find clear answer (but theres chance i missed them)</p>\n<p>My basic questions are: </p>\n<ol>\n<li>Regular image with RGB or gray scale is between 0~255, why the image here has range from e.g. -3000 to 4000? What exactly does these value/units represent? (any explanation of what is behind the scene is appreciated) </li>\n<li>I saw many discussion/kernel mentioned Hounsfield units (HU) and transformation to it, from what I searched online, seems like this is an unit that shows radio density in reference of water and air. Why this is possibly needed/preferred for a. medical practice b. build a ML model (i.e. can't we just leave the pixel value as it is)?</li>\n<li>Pixel spacing, from online info, this represents the physical distance between two pixels. I never encountered such info from past work with images, Could someone explain again, why could this possibly benefits for a. medical aspect b. model building (e.g. shall we utilize this in some image transformations and why)?</li>\n</ol>\n<p>Thanks! </p>",
      "rawMarkdown": "I recently join the comp and still exploring, I have searched over discussions and kernels for my questions but couldn't find clear answer (but theres chance i missed them)\n\nMy basic questions are: \n\n1. Regular image with RGB or gray scale is between 0~255, why the image here has range from e.g. -3000 to 4000? What exactly does these value/units represent? (any explanation of what is behind the scene is appreciated) \n2. I saw many discussion/kernel mentioned Hounsfield units (HU) and transformation to it, from what I searched online, seems like this is an unit that shows radio density in reference of water and air. Why this is possibly needed/preferred for a. medical practice b. build a ML model (i.e. can't we just leave the pixel value as it is)?\n3. Pixel spacing, from online info, this represents the physical distance between two pixels. I never encountered such info from past work with images, Could someone explain again, why could this possibly benefits for a. medical aspect b. model building (e.g. shall we utilize this in some image transformations and why)?\n\nThanks!",
      "votes": null
    },
    {
      "id": "979490",
      "postDate": "08/20/2020 22:08:42",
      "content": "<p>Hi, I will try to address your questions but maybe reading an article about DICOM will be a better help.</p>\n<ol>\n<li>Correct. Actually, pixel values here correlate with the Hounsfield units (HU) (your second question), which is useful for describing radio-density.<br>\nOne step back, how do we take these images? CT is a 3D reconstruction version of the conventional X-Ray, so we acquire the X-Ray image by directing X-Ray radiation and receiving the result of the human body's absorption of this radiation. To make things clearer, dense tissues absorb (block) a high amount of radiation, conversely, non-dense tissues absorb a very small amount of radiation. For example, bone is dense, so it absorbs a high amount, so we receive a small amount of radiation on the film (only a small amount passes through the bone because the rest has been absorbed), so bone appears white! On the other hand, water or gas are not dense, so absorb only a small amount, if any, so most of the radiation passes, so we see these areas black (look inside the lung, black area means gas). Dense tissues have higher HU values, water and gas have low values, so HU scale describes this, makes sense? Hence why this scale is important for us here.</li>\n<li>I hope I already answered this in the previous point</li>\n<li>Pixel spacing: I think we agree that CT scans the human body, each pixel/voxel (a voxel is the pixel in case of 3D) represents a part of the body. Spacing is the physical real dimension that this pixel represents. For example, if I told you that this lung has a volume of 1000 pixels, and each voxel has a resolution of 0.5x0.5x0.5 mm3, then what is the volume of this lung in mm? right, 1000x0.5x0.5x0.5=125mm3 (Clearly, I made up numbers :D). </li>\n</ol>\n<p>I hope things make sense now and you understand what happens, although I still recommend reading an article about DICOM. Also, I tried to explain things in a simple language, could be inaccurate in some cases. </p>",
      "rawMarkdown": "Hi, I will try to address your questions but maybe reading an article about DICOM will be a better help.\n1. Correct. Actually, pixel values here correlate with the Hounsfield units (HU) (your second question), which is useful for describing radio-density.\nOne step back, how do we take these images? CT is a 3D reconstruction version of the conventional X-Ray, so we acquire the X-Ray image by directing X-Ray radiation and receiving the result of the human body's absorption of this radiation. To make things clearer, dense tissues absorb (block) a high amount of radiation, conversely, non-dense tissues absorb a very small amount of radiation. For example, bone is dense, so it absorbs a high amount, so we receive a small amount of radiation on the film (only a small amount passes through the bone because the rest has been absorbed), so bone appears white! On the other hand, water or gas are not dense, so absorb only a small amount, if any, so most of the radiation passes, so we see these areas black (look inside the lung, black area means gas). Dense tissues have higher HU values, water and gas have low values, so HU scale describes this, makes sense? Hence why this scale is important for us here.\n2. I hope I already answered this in the previous point\n3. Pixel spacing: I think we agree that CT scans the human body, each pixel/voxel (a voxel is the pixel in case of 3D) represents a part of the body. Spacing is the physical real dimension that this pixel represents. For example, if I told you that this lung has a volume of 1000 pixels, and each voxel has a resolution of 0.5x0.5x0.5 mm3, then what is the volume of this lung in mm? right, 1000x0.5x0.5x0.5=125mm3 (Clearly, I made up numbers :D). \n\nI hope things make sense now and you understand what happens, although I still recommend reading an article about DICOM. Also, I tried to explain things in a simple language, could be inaccurate in some cases.",
      "votes": null
    },
    {
      "id": "979539",
      "postDate": "08/20/2020 23:48:38",
      "content": "<p>See this link:</p>\n<p><a href=\"https://www.kaggle.com/c/osic-pulmonary-fibrosis-progression/discussion/170995#951170\" target=\"_blank\">https://www.kaggle.com/c/osic-pulmonary-fibrosis-progression/discussion/170995#951170</a></p>\n<p>In terms of why there is pixel spacing - many images you take don't have an implicit measurement. If you take a photograph, you don't have an actual size of the items in the picture. For a CT scan, we know the size of the actual patient and we want to be able to do things like measure the size of a nodule or the lung. So the pixel spacing tells you the physical size of anything you see on the image. Since the images of different patients don't all have the same pixel spacing, you could scale them to match each other. I would expect that within one patient's CT scan all the pixel spacing is the same.</p>",
      "rawMarkdown": "See this link:\n\nhttps://www.kaggle.com/c/osic-pulmonary-fibrosis-progression/discussion/170995#951170\n\nIn terms of why there is pixel spacing - many images you take don't have an implicit measurement. If you take a photograph, you don't have an actual size of the items in the picture. For a CT scan, we know the size of the actual patient and we want to be able to do things like measure the size of a nodule or the lung. So the pixel spacing tells you the physical size of anything you see on the image. Since the images of different patients don't all have the same pixel spacing, you could scale them to match each other. I would expect that within one patient's CT scan all the pixel spacing is the same.",
      "votes": null
    },
    {
      "id": "979560",
      "postDate": "08/21/2020 00:14:17",
      "content": "<p>Thanks for the detailed explanations. I see…, </p>\n<p>1, 2. the raw pixel value reflects the absorption property, but to be more intuitive/easier understanding to us, we convert the value to HU as 0hu represents water, 100hu fat etc. And I guess we do so by using the <strong>RescaleIntercept</strong> and <strong>RescaleSlope</strong>?  (although i noticed in our training data all slope is value 1, i wonder is that expected?) Last question on this is, if i understood correctly, to convert to hu is just for us understand the image easier, but to computers it should not matter, so I could just feed this raw pixel value directly into a cnn, would that be correct?</p>\n<p>3 . so its for volume calculation, thanks for the example, although in the data the spacing is 2d, so i imagine we would need the slice thickness to approximate a volume for e.g. a 512x512 image ~ 512  x 512 x SpacingX x SpacingY x Slicethickness</p>",
      "rawMarkdown": "Thanks for the detailed explanations. I see..., \n\n1, 2. the raw pixel value reflects the absorption property, but to be more intuitive/easier understanding to us, we convert the value to HU as 0hu represents water, 100hu fat etc. And I guess we do so by using the **RescaleIntercept** and **RescaleSlope**?  (although i noticed in our training data all slope is value 1, i wonder is that expected?) Last question on this is, if i understood correctly, to convert to hu is just for us understand the image easier, but to computers it should not matter, so I could just feed this raw pixel value directly into a cnn, would that be correct?\n\n3 . so its for volume calculation, thanks for the example, although in the data the spacing is 2d, so i imagine we would need the slice thickness to approximate a volume for e.g. a 512x512 image ~ 512  x 512 x SpacingX x SpacingY x Slicethickness",
      "votes": null
    },
    {
      "id": "979568",
      "postDate": "08/21/2020 00:34:00",
      "content": "<p>thanks for the link.. ah so the pixel value itself is mostly in hu unit already, although except i saw in EDA kernels some people do the conversion to hu when slope is not 1, i guess these were not originally in hu unit.</p>\n<p>and from your comment the link you shared, the window center and width in dicom is indicating the range of HU that represents lungs, i imagine this is needed as not all CT device used were similar, so e.g. some clinic could produce CT image where lungs lives in a different HU range than others, is that correct?</p>",
      "rawMarkdown": "thanks for the link.. ah so the pixel value itself is mostly in hu unit already, although except i saw in EDA kernels some people do the conversion to hu when slope is not 1, i guess these were not originally in hu unit.\n\nand from your comment the link you shared, the window center and width in dicom is indicating the range of HU that represents lungs, i imagine this is needed as not all CT device used were similar, so e.g. some clinic could produce CT image where lungs lives in a different HU range than others, is that correct?",
      "votes": null
    },
    {
      "id": "979581",
      "postDate": "08/21/2020 00:51:28",
      "content": "<p>Normally the hours hounsfield units are the same for all CT scanners. </p>\n<p>If you combine the pixel values with the slope and intercept you should end up with standard hounsfield units. </p>\n<p>The window/ level are applied to focus on the part of the range of hounsfield units that are relevant. If you used the entire range and scales to 0 to 255 you would have most of your pixels in a very small range. </p>",
      "rawMarkdown": "Normally the hours hounsfield units are the same for all CT scanners. \n\nIf you combine the pixel values with the slope and intercept you should end up with standard hounsfield units. \n\nThe window/ level are applied to focus on the part of the range of hounsfield units that are relevant. If you used the entire range and scales to 0 to 255 you would have most of your pixels in a very small range.",
      "votes": null
    },
    {
      "id": "980199",
      "postDate": "08/21/2020 11:46:34",
      "content": "<p>got it… also I saw this from dicom dictionary</p>\n<blockquote>\n  <p>If Image Type (0008,0008) Value 1 is ORIGINAL and Value 3 is not LOCALIZER, and Multi-energy CT Acquisition (0018,9361) is either absent or NO, output units shall be Hounsfield Units (HU).</p>\n</blockquote>\n<p>so we may not need to do the conversion if above condition is satisfied. And I guess standard hounsfield units, is saying the CT scanner values  CT that are calibrated with reference to water.</p>\n<p>Last question on window and width, what you said makes sense, although when i checked the width and window value in our dataset, I saw there is width values = -1500 which is invalid, also sometimes the center and width is two dimensional: center: (-500.0, 40.0), width=(1500.0, 350.0), how do we interpret this? its saying we have two parts of ranges that are both relevant to lungs?</p>",
      "rawMarkdown": "got it... also I saw this from dicom dictionary\n\n> If Image Type (0008,0008) Value 1 is ORIGINAL and Value 3 is not LOCALIZER, and Multi-energy CT Acquisition (0018,9361) is either absent or NO, output units shall be Hounsfield Units (HU).\n\nso we may not need to do the conversion if above condition is satisfied. And I guess standard hounsfield units, is saying the CT scanner values  CT that are calibrated with reference to water.\n\nLast question on window and width, what you said makes sense, although when i checked the width and window value in our dataset, I saw there is width values = -1500 which is invalid, also sometimes the center and width is two dimensional: center: (-500.0, 40.0), width=(1500.0, 350.0), how do we interpret this? its saying we have two parts of ranges that are both relevant to lungs?",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 979490,
      "author_name": "ahmedhshahin",
      "author_url": "",
      "post_date": "08/20/2020 22:08:42",
      "content": "<p>Hi, I will try to address your questions but maybe reading an article about DICOM will be a better help.</p>\n<ol>\n<li>Correct. Actually, pixel values here correlate with the Hounsfield units (HU) (your second question), which is useful for describing radio-density.<br>\nOne step back, how do we take these images? CT is a 3D reconstruction version of the conventional X-Ray, so we acquire the X-Ray image by directing X-Ray radiation and receiving the result of the human body's absorption of this radiation. To make things clearer, dense tissues absorb (block) a high amount of radiation, conversely, non-dense tissues absorb a very small amount of radiation. For example, bone is dense, so it absorbs a high amount, so we receive a small amount of radiation on the film (only a small amount passes through the bone because the rest has been absorbed), so bone appears white! On the other hand, water or gas are not dense, so absorb only a small amount, if any, so most of the radiation passes, so we see these areas black (look inside the lung, black area means gas). Dense tissues have higher HU values, water and gas have low values, so HU scale describes this, makes sense? Hence why this scale is important for us here.</li>\n<li>I hope I already answered this in the previous point</li>\n<li>Pixel spacing: I think we agree that CT scans the human body, each pixel/voxel (a voxel is the pixel in case of 3D) represents a part of the body. Spacing is the physical real dimension that this pixel represents. For example, if I told you that this lung has a volume of 1000 pixels, and each voxel has a resolution of 0.5x0.5x0.5 mm3, then what is the volume of this lung in mm? right, 1000x0.5x0.5x0.5=125mm3 (Clearly, I made up numbers :D). </li>\n</ol>\n<p>I hope things make sense now and you understand what happens, although I still recommend reading an article about DICOM. Also, I tried to explain things in a simple language, could be inaccurate in some cases. </p>",
      "votes": null,
      "replies": [
        {
          "id": 979560,
          "author_name": "samshipengs",
          "author_url": "",
          "post_date": "08/21/2020 00:14:17",
          "content": "<p>Thanks for the detailed explanations. I see…, </p>\n<p>1, 2. the raw pixel value reflects the absorption property, but to be more intuitive/easier understanding to us, we convert the value to HU as 0hu represents water, 100hu fat etc. And I guess we do so by using the <strong>RescaleIntercept</strong> and <strong>RescaleSlope</strong>?  (although i noticed in our training data all slope is value 1, i wonder is that expected?) Last question on this is, if i understood correctly, to convert to hu is just for us understand the image easier, but to computers it should not matter, so I could just feed this raw pixel value directly into a cnn, would that be correct?</p>\n<p>3 . so its for volume calculation, thanks for the example, although in the data the spacing is 2d, so i imagine we would need the slice thickness to approximate a volume for e.g. a 512x512 image ~ 512  x 512 x SpacingX x SpacingY x Slicethickness</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 979539,
      "author_name": "richardepstein",
      "author_url": "",
      "post_date": "08/20/2020 23:48:38",
      "content": "<p>See this link:</p>\n<p><a href=\"https://www.kaggle.com/c/osic-pulmonary-fibrosis-progression/discussion/170995#951170\" target=\"_blank\">https://www.kaggle.com/c/osic-pulmonary-fibrosis-progression/discussion/170995#951170</a></p>\n<p>In terms of why there is pixel spacing - many images you take don't have an implicit measurement. If you take a photograph, you don't have an actual size of the items in the picture. For a CT scan, we know the size of the actual patient and we want to be able to do things like measure the size of a nodule or the lung. So the pixel spacing tells you the physical size of anything you see on the image. Since the images of different patients don't all have the same pixel spacing, you could scale them to match each other. I would expect that within one patient's CT scan all the pixel spacing is the same.</p>",
      "votes": null,
      "replies": [
        {
          "id": 979568,
          "author_name": "samshipengs",
          "author_url": "",
          "post_date": "08/21/2020 00:34:00",
          "content": "<p>thanks for the link.. ah so the pixel value itself is mostly in hu unit already, although except i saw in EDA kernels some people do the conversion to hu when slope is not 1, i guess these were not originally in hu unit.</p>\n<p>and from your comment the link you shared, the window center and width in dicom is indicating the range of HU that represents lungs, i imagine this is needed as not all CT device used were similar, so e.g. some clinic could produce CT image where lungs lives in a different HU range than others, is that correct?</p>",
          "votes": null,
          "replies": [
            {
              "id": 979581,
              "author_name": "richardepstein",
              "author_url": "",
              "post_date": "08/21/2020 00:51:28",
              "content": "<p>Normally the hours hounsfield units are the same for all CT scanners. </p>\n<p>If you combine the pixel values with the slope and intercept you should end up with standard hounsfield units. </p>\n<p>The window/ level are applied to focus on the part of the range of hounsfield units that are relevant. If you used the entire range and scales to 0 to 255 you would have most of your pixels in a very small range. </p>",
              "votes": null,
              "replies": []
            },
            {
              "id": 980199,
              "author_name": "samshipengs",
              "author_url": "",
              "post_date": "08/21/2020 11:46:34",
              "content": "<p>got it… also I saw this from dicom dictionary</p>\n<blockquote>\n  <p>If Image Type (0008,0008) Value 1 is ORIGINAL and Value 3 is not LOCALIZER, and Multi-energy CT Acquisition (0018,9361) is either absent or NO, output units shall be Hounsfield Units (HU).</p>\n</blockquote>\n<p>so we may not need to do the conversion if above condition is satisfied. And I guess standard hounsfield units, is saying the CT scanner values  CT that are calibrated with reference to water.</p>\n<p>Last question on window and width, what you said makes sense, although when i checked the width and window value in our dataset, I saw there is width values = -1500 which is invalid, also sometimes the center and width is two dimensional: center: (-500.0, 40.0), width=(1500.0, 350.0), how do we interpret this? its saying we have two parts of ranges that are both relevant to lungs?</p>",
              "votes": null,
              "replies": []
            }
          ]
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "979199": "I recently join the comp and still exploring, I have searched over discussions and kernels for my questions but couldn't find clear answer (but theres chance i missed them)\n\nMy basic questions are: \n\n1. Regular image with RGB or gray scale is between 0~255, why the image here has range from e.g. -3000 to 4000? What exactly does these value/units represent? (any explanation of what is behind the scene is appreciated) \n2. I saw many discussion/kernel mentioned Hounsfield units (HU) and transformation to it, from what I searched online, seems like this is an unit that shows radio density in reference of water and air. Why this is possibly needed/preferred for a. medical practice b. build a ML model (i.e. can't we just leave the pixel value as it is)?\n3. Pixel spacing, from online info, this represents the physical distance between two pixels. I never encountered such info from past work with images, Could someone explain again, why could this possibly benefits for a. medical aspect b. model building (e.g. shall we utilize this in some image transformations and why)?\n\nThanks!",
    "979490": "Hi, I will try to address your questions but maybe reading an article about DICOM will be a better help.\n1. Correct. Actually, pixel values here correlate with the Hounsfield units (HU) (your second question), which is useful for describing radio-density.\nOne step back, how do we take these images? CT is a 3D reconstruction version of the conventional X-Ray, so we acquire the X-Ray image by directing X-Ray radiation and receiving the result of the human body's absorption of this radiation. To make things clearer, dense tissues absorb (block) a high amount of radiation, conversely, non-dense tissues absorb a very small amount of radiation. For example, bone is dense, so it absorbs a high amount, so we receive a small amount of radiation on the film (only a small amount passes through the bone because the rest has been absorbed), so bone appears white! On the other hand, water or gas are not dense, so absorb only a small amount, if any, so most of the radiation passes, so we see these areas black (look inside the lung, black area means gas). Dense tissues have higher HU values, water and gas have low values, so HU scale describes this, makes sense? Hence why this scale is important for us here.\n2. I hope I already answered this in the previous point\n3. Pixel spacing: I think we agree that CT scans the human body, each pixel/voxel (a voxel is the pixel in case of 3D) represents a part of the body. Spacing is the physical real dimension that this pixel represents. For example, if I told you that this lung has a volume of 1000 pixels, and each voxel has a resolution of 0.5x0.5x0.5 mm3, then what is the volume of this lung in mm? right, 1000x0.5x0.5x0.5=125mm3 (Clearly, I made up numbers :D). \n\nI hope things make sense now and you understand what happens, although I still recommend reading an article about DICOM. Also, I tried to explain things in a simple language, could be inaccurate in some cases.",
    "979539": "See this link:\n\nhttps://www.kaggle.com/c/osic-pulmonary-fibrosis-progression/discussion/170995#951170\n\nIn terms of why there is pixel spacing - many images you take don't have an implicit measurement. If you take a photograph, you don't have an actual size of the items in the picture. For a CT scan, we know the size of the actual patient and we want to be able to do things like measure the size of a nodule or the lung. So the pixel spacing tells you the physical size of anything you see on the image. Since the images of different patients don't all have the same pixel spacing, you could scale them to match each other. I would expect that within one patient's CT scan all the pixel spacing is the same.",
    "979560": "Thanks for the detailed explanations. I see..., \n\n1, 2. the raw pixel value reflects the absorption property, but to be more intuitive/easier understanding to us, we convert the value to HU as 0hu represents water, 100hu fat etc. And I guess we do so by using the **RescaleIntercept** and **RescaleSlope**?  (although i noticed in our training data all slope is value 1, i wonder is that expected?) Last question on this is, if i understood correctly, to convert to hu is just for us understand the image easier, but to computers it should not matter, so I could just feed this raw pixel value directly into a cnn, would that be correct?\n\n3 . so its for volume calculation, thanks for the example, although in the data the spacing is 2d, so i imagine we would need the slice thickness to approximate a volume for e.g. a 512x512 image ~ 512  x 512 x SpacingX x SpacingY x Slicethickness",
    "979568": "thanks for the link.. ah so the pixel value itself is mostly in hu unit already, although except i saw in EDA kernels some people do the conversion to hu when slope is not 1, i guess these were not originally in hu unit.\n\nand from your comment the link you shared, the window center and width in dicom is indicating the range of HU that represents lungs, i imagine this is needed as not all CT device used were similar, so e.g. some clinic could produce CT image where lungs lives in a different HU range than others, is that correct?",
    "979581": "Normally the hours hounsfield units are the same for all CT scanners. \n\nIf you combine the pixel values with the slope and intercept you should end up with standard hounsfield units. \n\nThe window/ level are applied to focus on the part of the range of hounsfield units that are relevant. If you used the entire range and scales to 0 to 255 you would have most of your pixels in a very small range.",
    "980199": "got it... also I saw this from dicom dictionary\n\n> If Image Type (0008,0008) Value 1 is ORIGINAL and Value 3 is not LOCALIZER, and Multi-energy CT Acquisition (0018,9361) is either absent or NO, output units shall be Hounsfield Units (HU).\n\nso we may not need to do the conversion if above condition is satisfied. And I guess standard hounsfield units, is saying the CT scanner values  CT that are calibrated with reference to water.\n\nLast question on window and width, what you said makes sense, although when i checked the width and window value in our dataset, I saw there is width values = -1500 which is invalid, also sometimes the center and width is two dimensional: center: (-500.0, 40.0), width=(1500.0, 350.0), how do we interpret this? its saying we have two parts of ranges that are both relevant to lungs?"
  },
  "source": "meta"
}