File_DICOM allows reading and modifying of DICOM files. DICOM stands for Digital Imaging and COmmunications in Medicine, and is a standard for creating, storing and transfering digital images (X-rays, tomography) and related information used in medicine. This package in particular does not support the exchange/transfer of DICOM data, nor any network related functionality. More information on the DICOM standard can be found at the NEMA site.
Please be aware that any use of the information produced by this package for diagnosing purposes is strongly discouraged by the author. See here for more information.
Using it
File_DICOM can be used to accomplish two things, to retrieve data from a file (including image data), and to set new values for that data (allowing to write the modified file).
Let's see how we could show some relevant data from a DICOM file and export it's image data at the same time.
<?php require_once('File/DICOM.php'); $dicom = new File_DICOM(); $res = $dicom->parse("test.dcm"); // check for errors if (PEAR::isError($res)) { die("Error: ".$res->getMessage()."\n"); } // show a few attributes of the DICOM file using group and element index echo 'StudyDate : '.$dicom->getValue(0x0008, 0x0020)."\n"; echo 'Image Date : '.$dicom->getValue(0x0008, 0x0023)."\n"; echo 'Image Type : '.$dicom->getValue(0x0008, 0x0008)."\n"; echo 'Study Time : '.$dicom->getValue(0x0008, 0x0030)."\n"; echo 'Institution Name : '.$dicom->getValue(0x0008, 0x0080)."\n"; echo 'Manufacturer : '.$dicom->getValue(0x0008, 0x0070)."\n"; echo 'Manufacturer Model Name : '.$dicom->getValue(0x0008, 0x1090)."\n"; // or using element name echo 'Patient Name : '.$dicom->getValue('PatientName')."\n"; echo 'Patient Age : '.$dicom->getValue('PatientAge')."\n"; // dump a PGM image from the file data $res = $dicom->dumpImage('test.pgm'); if (PEAR::isError($res)) { die("Error: ".$res->getMessage()."\n"); } ?>
Deliver First Class Web Sites: 101 Essential Checklists Want to learn how to make your web sites usable and accessible? Want to ensure that your sites meet current best practice, without spending hours trawling through incomprehensible specifications and recommendations from dozens of different books, research papers, and web sites? Want to make sure that the sites you build are "right the first time," requiring no costly redevelopments?