{
  "id": 19378,
  "title": "Approximating Heart SAX orientation from DICOM",
  "url": "/competitions/second-annual-data-science-bowl/discussion/19378",
  "author_name": "udibr",
  "post_date": "2016-03-08T00:48:11.063000",
  "votes": 5,
  "comment_count": 0,
  "views": 304,
  "content": "<p>It looks like you can approximate the orientation of the patient: lying on back or side using the following code:</p>\n\n<pre><code>    avg_image_orientations = np.array([\n        0.61659826,  0.77685789, -0.12766521,\n        -0.39722351,  0.16699159, -0.90234914])\n    image_orientation = np.array(d.ImageOrientationPatient)\n    y = np.dot(image_orientation[:3], avg_image_orientations[:3])\n    x = np.dot(image_orientation[:3], avg_image_orientations[3:])\n    angle = np.arctan2(y, x) / np.pi * 180 - 75\n</code></pre>\n\n<p><code>d</code> is a DICOM image.\nIf you plot a histogram of the values you can see that the studies  divide into two groups and if you rotate the SAX images you see that indeed the LV appears to be in the same orientation in all images. I found that there are some variability inside a study.</p>\n\n<p><img src=\"https://github.com/udibr/DSB2/blob/master/heart_orientation.png?raw=true\" alt=\"enter image description here\" title></p>",
  "messages": [
    {
      "id": 110758,
      "postDate": "2016-03-08T00:48:11.063Z",
      "content": "<p>It looks like you can approximate the orientation of the patient: lying on back or side using the following code:</p>\n\n<pre><code>    avg_image_orientations = np.array([\n        0.61659826,  0.77685789, -0.12766521,\n        -0.39722351,  0.16699159, -0.90234914])\n    image_orientation = np.array(d.ImageOrientationPatient)\n    y = np.dot(image_orientation[:3], avg_image_orientations[:3])\n    x = np.dot(image_orientation[:3], avg_image_orientations[3:])\n    angle = np.arctan2(y, x) / np.pi * 180 - 75\n</code></pre>\n\n<p><code>d</code> is a DICOM image.\nIf you plot a histogram of the values you can see that the studies  divide into two groups and if you rotate the SAX images you see that indeed the LV appears to be in the same orientation in all images. I found that there are some variability inside a study.</p>\n\n<p><img src=\"https://github.com/udibr/DSB2/blob/master/heart_orientation.png?raw=true\" alt=\"enter image description here\" title></p>",
      "rawMarkdown": "It looks like you can approximate the orientation of the patient: lying on back or side using the following code:\r\n\r\n        avg_image_orientations = np.array([\r\n            0.61659826,  0.77685789, -0.12766521,\r\n            -0.39722351,  0.16699159, -0.90234914])\r\n        image_orientation = np.array(d.ImageOrientationPatient)\r\n        y = np.dot(image_orientation[:3], avg_image_orientations[:3])\r\n        x = np.dot(image_orientation[:3], avg_image_orientations[3:])\r\n        angle = np.arctan2(y, x) / np.pi * 180 - 75\r\n\r\n`d` is a DICOM image.\r\nIf you plot a histogram of the values you can see that the studies  divide into two groups and if you rotate the SAX images you see that indeed the LV appears to be in the same orientation in all images. I found that there are some variability inside a study.\r\n\r\n![enter image description here][1]\r\n\r\n\r\n  [1]: https://github.com/udibr/DSB2/blob/master/heart_orientation.png?raw=true",
      "votes": 5
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "110758": "It looks like you can approximate the orientation of the patient: lying on back or side using the following code:\r\n\r\n        avg_image_orientations = np.array([\r\n            0.61659826,  0.77685789, -0.12766521,\r\n            -0.39722351,  0.16699159, -0.90234914])\r\n        image_orientation = np.array(d.ImageOrientationPatient)\r\n        y = np.dot(image_orientation[:3], avg_image_orientations[:3])\r\n        x = np.dot(image_orientation[:3], avg_image_orientations[3:])\r\n        angle = np.arctan2(y, x) / np.pi * 180 - 75\r\n\r\n`d` is a DICOM image.\r\nIf you plot a histogram of the values you can see that the studies  divide into two groups and if you rotate the SAX images you see that indeed the LV appears to be in the same orientation in all images. I found that there are some variability inside a study.\r\n\r\n![enter image description here][1]\r\n\r\n\r\n  [1]: https://github.com/udibr/DSB2/blob/master/heart_orientation.png?raw=true"
  }
}