{"id":35,"date":"2011-12-21T21:35:57","date_gmt":"2011-12-22T02:35:57","guid":{"rendered":"https:\/\/peterabeles.com\/blog\/?p=35"},"modified":"2012-02-14T20:39:48","modified_gmt":"2012-02-15T01:39:48","slug":"converting-x-ray-images-into-jpeg","status":"publish","type":"post","link":"https:\/\/peterabeles.com\/blog\/?p=35","title":{"rendered":"Converting X-Ray Images into JPEG"},"content":{"rendered":"<p>While out scouting a rapid on the <a title=\"Stanislaus\" href=\"http:\/\/www.awetstate.com\/NStanislausR.html\">North Fork of the Stanislaus in California<\/a> I decided to take a closer look at the rocks down below by flinging my body rapidly face first into them.\u00a0 Some people might have mistaken this action for slipping.\u00a0 While doing so I twisted my middle finger and it has been swollen ever since.\u00a0 Hasn&#8217;t bother me much but my doctor thought I should get it x-rayed to be safe.<\/p>\n<div id=\"attachment_36\" style=\"width: 165px\" class=\"wp-caption alignright\"><a href=\"https:\/\/peterabeles.com\/blog\/wp-content\/uploads\/2011\/12\/blog_xray.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-36\" class=\"size-full wp-image-36\" title=\"Middle Finger X-Ray\" src=\"https:\/\/peterabeles.com\/blog\/wp-content\/uploads\/2011\/12\/blog_xray.jpg\" alt=\"\" width=\"155\" height=\"400\" srcset=\"https:\/\/peterabeles.com\/blog\/wp-content\/uploads\/2011\/12\/blog_xray.jpg 155w, https:\/\/peterabeles.com\/blog\/wp-content\/uploads\/2011\/12\/blog_xray-116x300.jpg 116w\" sizes=\"auto, (max-width: 155px) 100vw, 155px\" \/><\/a><p id=\"caption-attachment-36\" class=\"wp-caption-text\">One-finger salute X-Ray.  There was no fracture.<\/p><\/div>\n<p>This is how I came across a CD full of hand x-rays.\u00a0 Now most people would use a standardized format that everyone can understand.\u00a0 Being the medical field they have their own format to encapsulate standard formats and make them unreadable.\u00a0 All of these files had a &#8216;dcm&#8217; extension, which means they contain DICOM image files.\u00a0 A quick search online turned up several suggestions on how to convert the file and none of them worked.<\/p>\n<p>Using the unix &#8220;convert&#8221; command might have worked, but there seems to be problems if a loss less JPEG is encapsulated in the DICOM file.\u00a0 A bit more searching and I found out about <a href=\"http:\/\/dicom.offis.de\/dcmtk\">dcmtk <\/a>which is an open source project for reading and modifying these files.\u00a0 It provides several functions, such &#8220;dcm2pdf&#8221; or &#8220;dcmdjpeg&#8221; but these won&#8217;t create a jpeg directly.\u00a0 The command &#8216;dcmdump&#8217; shows information on the file and verified that it was in fact in lossless jpeg format.\u00a0 To extract a readable image from the DICOM file, follow these steps in Linux:<\/p>\n<ol>\n<li>install dcptk<\/li>\n<li>dcmdump INPUT.dcm<\/li>\n<li>dcmdjpeg INPUT.dcm OUTPUT.dcm<\/li>\n<li>dcmp2pgm OUTPUT.dcm image.pgm<\/li>\n<\/ol>\n<p>The second step verifies which image format is encapsulated and is used to determine which dcmd* command should be invoked.\u00a0 The third step converts the jpeg encoded DICOM into a standard format DICOM file.\u00a0 The fourth step converts the DICOM file into a &#8216;pgm&#8217; file.\u00a0 The pgm file can be viewed in most graphics program and can be easily converted into a jpeg file.\u00a0 To the right is one of the extracted x-ray images.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While out scouting a rapid on the North Fork of the Stanislaus in California I decided to take a closer look at the rocks down below by flinging my body rapidly face first into them.\u00a0 Some people might have mistaken this action for slipping.\u00a0 While doing so I twisted my middle finger and it has [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[8],"tags":[11,10,9],"class_list":["post-35","post","type-post","status-publish","format-standard","hentry","category-linux","tag-dcm","tag-dicom","tag-xray"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/peterabeles.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/35","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/peterabeles.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/peterabeles.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/peterabeles.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/peterabeles.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=35"}],"version-history":[{"count":7,"href":"https:\/\/peterabeles.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/35\/revisions"}],"predecessor-version":[{"id":71,"href":"https:\/\/peterabeles.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/35\/revisions\/71"}],"wp:attachment":[{"href":"https:\/\/peterabeles.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=35"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/peterabeles.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=35"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/peterabeles.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=35"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}