<?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");
}
?> |