{
  "id": 356863,
  "title": "What is apply_voi_lut",
  "url": "/competitions/rsna-2022-cervical-spine-fracture-detection/discussion/356863",
  "author_name": "shashank069",
  "post_date": "2022-10-02T09:23:14.933000",
  "votes": 3,
  "comment_count": 3,
  "views": 0,
  "content": "<p>New to working with dicom images, and have seen a lot of notebooks using apply_voi_lut() on pixel array. What does this function exactly do?</p>",
  "messages": [
    {
      "id": 1973189,
      "postDate": "2022-10-05T14:04:04.623Z",
      "content": "<p>There aren't any VOI LUT sequences or functions in any of the training images for this comp. I checked.</p>\n<p>When using pydicom to export pixels, the apply_voi_lut() function checks for LUT sequence or function tags (0x0028, 0x3010) and (0x0028, 0x1056). If it finds either, it will apply the LUT to the raw pixel output. If those tags do not exist, it will use the default Window Center and Width tags (0x0028, 0x1050) and (0x0028, 0x1051) to create a linear LUT. If those tags do not exist, it will perform a standard normalization instead.</p>\n<p>So, for this competition, using apply_voi_lut() results in using the default WW/WC tags for windowing. This is usually fine for CT, but CAN create odd results in certain cases. Especially on MR where windowing is not always the same between slices.</p>\n<p>Check out the comments on this notebook about the subject from last years RNSA comp. -&gt; <a href=\"https://www.kaggle.com/code/returnofsputnik/why-does-voi-lut-create-these-shaded-bands/notebook\" target=\"_blank\">https://www.kaggle.com/code/returnofsputnik/why-does-voi-lut-create-these-shaded-bands/notebook</a></p>",
      "rawMarkdown": "There aren't any VOI LUT sequences or functions in any of the training images for this comp. I checked.\n\nWhen using pydicom to export pixels, the apply_voi_lut() function checks for LUT sequence or function tags (0x0028, 0x3010) and (0x0028, 0x1056). If it finds either, it will apply the LUT to the raw pixel output. If those tags do not exist, it will use the default Window Center and Width tags (0x0028, 0x1050) and (0x0028, 0x1051) to create a linear LUT. If those tags do not exist, it will perform a standard normalization instead.\n\nSo, for this competition, using apply_voi_lut() results in using the default WW/WC tags for windowing. This is usually fine for CT, but CAN create odd results in certain cases. Especially on MR where windowing is not always the same between slices.\n\nCheck out the comments on this notebook about the subject from last years RNSA comp. -> https://www.kaggle.com/code/returnofsputnik/why-does-voi-lut-create-these-shaded-bands/notebook",
      "votes": 3
    },
    {
      "id": 1966996,
      "postDate": "2022-10-02T09:23:14.933Z",
      "content": "<p>New to working with dicom images, and have seen a lot of notebooks using apply_voi_lut() on pixel array. What does this function exactly do?</p>",
      "rawMarkdown": "New to working with dicom images, and have seen a lot of notebooks using apply_voi_lut() on pixel array. What does this function exactly do?\n",
      "votes": 3
    },
    {
      "id": 1967646,
      "postDate": "2022-10-02T16:07:30.487Z",
      "content": "<p>VOI LUT stands for <strong>Value of Interest, Look up Table</strong>. If I understand correctly, it scales the data so the image has the <strong>brightness</strong> and <strong>contrast</strong> specified by the metadata in the dicom file. That's why the apply_voi_lut function takes as input both the pixel data and the dicom metadata.</p>\n<blockquote>\n  <p>The Value Of Interest(VOI) LUT transformation transforms the modality pixel values into pixel values which are meaningful for the user or the application. The VOI LUT is described by the VOI LUT Sequence (0028, 3010).</p>\n</blockquote>\n<p>You can read more about it here <a href=\"https://www.medicalconnections.co.uk/kb/Lookup-Tables#:~:text=Interest%20(VOI)%20Transform-,VOI%20LUT,Sequence%20(0028%2C%203010)\" target=\"_blank\">https://www.medicalconnections.co.uk/kb/Lookup-Tables#:~:text=Interest%20(VOI)%20Transform-,VOI%20LUT,Sequence%20(0028%2C%203010)</a>.</p>",
      "rawMarkdown": "VOI LUT stands for **Value of Interest, Look up Table**. If I understand correctly, it scales the data so the image has the **brightness** and **contrast** specified by the metadata in the dicom file. That's why the apply_voi_lut function takes as input both the pixel data and the dicom metadata.\n\n> The Value Of Interest(VOI) LUT transformation transforms the modality pixel values into pixel values which are meaningful for the user or the application. The VOI LUT is described by the VOI LUT Sequence (0028, 3010).\n\nYou can read more about it here https://www.medicalconnections.co.uk/kb/Lookup-Tables#:~:text=Interest%20(VOI)%20Transform-,VOI%20LUT,Sequence%20(0028%2C%203010).",
      "votes": 4
    },
    {
      "id": 1968383,
      "postDate": "2022-10-03T04:28:19.643Z",
      "content": "<p>I've used the function <code>apply_voi_lut()</code> naively without understanding it and had some errors with the function. You can see it in my notebook <a href=\"https://www.kaggle.com/code/junhyeonkwon/plot-subjects-outliers/notebook\" target=\"_blank\">here</a>, but in summary, some samples were wrongly clipped and ended up being completely bright or completely dark.</p>\n<p>I recommend doing the scaling manually using <code>.RescaleSlope</code> and <code>.RescaleIntercept</code>, which return pixel values in Houndsfield Unit.</p>",
      "rawMarkdown": "I've used the function ```apply_voi_lut()``` naively without understanding it and had some errors with the function. You can see it in my notebook [here](https://www.kaggle.com/code/junhyeonkwon/plot-subjects-outliers/notebook), but in summary, some samples were wrongly clipped and ended up being completely bright or completely dark.\n\nI recommend doing the scaling manually using ```.RescaleSlope``` and ```.RescaleIntercept```, which return pixel values in Houndsfield Unit.",
      "votes": 1
    }
  ],
  "comments": [
    {
      "id": 1973189,
      "author_name": "David Roberts",
      "author_url": "",
      "post_date": "2022-10-05T14:04:04.623000",
      "content": "<p>There aren't any VOI LUT sequences or functions in any of the training images for this comp. I checked.</p>\n<p>When using pydicom to export pixels, the apply_voi_lut() function checks for LUT sequence or function tags (0x0028, 0x3010) and (0x0028, 0x1056). If it finds either, it will apply the LUT to the raw pixel output. If those tags do not exist, it will use the default Window Center and Width tags (0x0028, 0x1050) and (0x0028, 0x1051) to create a linear LUT. If those tags do not exist, it will perform a standard normalization instead.</p>\n<p>So, for this competition, using apply_voi_lut() results in using the default WW/WC tags for windowing. This is usually fine for CT, but CAN create odd results in certain cases. Especially on MR where windowing is not always the same between slices.</p>\n<p>Check out the comments on this notebook about the subject from last years RNSA comp. -&gt; <a href=\"https://www.kaggle.com/code/returnofsputnik/why-does-voi-lut-create-these-shaded-bands/notebook\" target=\"_blank\">https://www.kaggle.com/code/returnofsputnik/why-does-voi-lut-create-these-shaded-bands/notebook</a></p>",
      "votes": 3,
      "replies": []
    },
    {
      "id": 1967646,
      "author_name": "Samuel Cortinhas",
      "author_url": "",
      "post_date": "2022-10-02T16:07:30.487000",
      "content": "<p>VOI LUT stands for <strong>Value of Interest, Look up Table</strong>. If I understand correctly, it scales the data so the image has the <strong>brightness</strong> and <strong>contrast</strong> specified by the metadata in the dicom file. That's why the apply_voi_lut function takes as input both the pixel data and the dicom metadata.</p>\n<blockquote>\n  <p>The Value Of Interest(VOI) LUT transformation transforms the modality pixel values into pixel values which are meaningful for the user or the application. The VOI LUT is described by the VOI LUT Sequence (0028, 3010).</p>\n</blockquote>\n<p>You can read more about it here <a href=\"https://www.medicalconnections.co.uk/kb/Lookup-Tables#:~:text=Interest%20(VOI)%20Transform-,VOI%20LUT,Sequence%20(0028%2C%203010)\" target=\"_blank\">https://www.medicalconnections.co.uk/kb/Lookup-Tables#:~:text=Interest%20(VOI)%20Transform-,VOI%20LUT,Sequence%20(0028%2C%203010)</a>.</p>",
      "votes": 4,
      "replies": []
    },
    {
      "id": 1968383,
      "author_name": "JunHyeonKwon",
      "author_url": "",
      "post_date": "2022-10-03T04:28:19.643000",
      "content": "<p>I've used the function <code>apply_voi_lut()</code> naively without understanding it and had some errors with the function. You can see it in my notebook <a href=\"https://www.kaggle.com/code/junhyeonkwon/plot-subjects-outliers/notebook\" target=\"_blank\">here</a>, but in summary, some samples were wrongly clipped and ended up being completely bright or completely dark.</p>\n<p>I recommend doing the scaling manually using <code>.RescaleSlope</code> and <code>.RescaleIntercept</code>, which return pixel values in Houndsfield Unit.</p>",
      "votes": 1,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1973189": "There aren't any VOI LUT sequences or functions in any of the training images for this comp. I checked.\n\nWhen using pydicom to export pixels, the apply_voi_lut() function checks for LUT sequence or function tags (0x0028, 0x3010) and (0x0028, 0x1056). If it finds either, it will apply the LUT to the raw pixel output. If those tags do not exist, it will use the default Window Center and Width tags (0x0028, 0x1050) and (0x0028, 0x1051) to create a linear LUT. If those tags do not exist, it will perform a standard normalization instead.\n\nSo, for this competition, using apply_voi_lut() results in using the default WW/WC tags for windowing. This is usually fine for CT, but CAN create odd results in certain cases. Especially on MR where windowing is not always the same between slices.\n\nCheck out the comments on this notebook about the subject from last years RNSA comp. -> https://www.kaggle.com/code/returnofsputnik/why-does-voi-lut-create-these-shaded-bands/notebook",
    "1966996": "New to working with dicom images, and have seen a lot of notebooks using apply_voi_lut() on pixel array. What does this function exactly do?\n",
    "1967646": "VOI LUT stands for **Value of Interest, Look up Table**. If I understand correctly, it scales the data so the image has the **brightness** and **contrast** specified by the metadata in the dicom file. That's why the apply_voi_lut function takes as input both the pixel data and the dicom metadata.\n\n> The Value Of Interest(VOI) LUT transformation transforms the modality pixel values into pixel values which are meaningful for the user or the application. The VOI LUT is described by the VOI LUT Sequence (0028, 3010).\n\nYou can read more about it here https://www.medicalconnections.co.uk/kb/Lookup-Tables#:~:text=Interest%20(VOI)%20Transform-,VOI%20LUT,Sequence%20(0028%2C%203010).",
    "1968383": "I've used the function ```apply_voi_lut()``` naively without understanding it and had some errors with the function. You can see it in my notebook [here](https://www.kaggle.com/code/junhyeonkwon/plot-subjects-outliers/notebook), but in summary, some samples were wrongly clipped and ended up being completely bright or completely dark.\n\nI recommend doing the scaling manually using ```.RescaleSlope``` and ```.RescaleIntercept```, which return pixel values in Houndsfield Unit."
  }
}