isDicom($fname); if (!$isDicom) { echo "File is not DICOM. Please try again"; exit(); } $res = $dicom->parse($fname); if (isset($dicom->_elements[0x7FE0][0x0010])) { // Récupère les tags Dicom qui nous intéressent if (isset($dicom->_elements[0x0018][0x602c])) { $physicalDeltaX = $dicom->_elements[0x0018][0x602c][0]->value; } if (isset($dicom->_elements[0x0018][0x602e])) { $physicalDeltaY = $dicom->_elements[0x0018][0x602e][0]->value; } if (isset($dicom->_elements[0x0028][0x0030])) { $pixelspacingX = $dicom->_elements[0x0028][0x0030][0]->value; } if (isset($dicom->_elements[0x0028][0x0030])) { $pixelspacingY = $dicom->_elements[0x0028][0x0030][1]->value; } // Return the resource image alone $images = $dicom->imagecreatefromDICOM($fname); if (!empty($images)) { foreach ($images as $im) { // Cryptage de l'image header("Content-type:image/jpeg"); $dimh = imagesx($im); $dimv = imagesy($im); $ncol = ($dimv * 12) / 100; $red = 0; $green = 0; $blue = 0; $background = imagecolorallocate($im, $red, $green, $blue); $white = imagecolorallocate($im, 255, 255, 255); ImageFilledRectangle($im, 0, 0, $dimh, $ncol, $background); ImageFilledRectangle($im, 0, ($dimv - $ncol), $dimh, $dimv, $background); $idpatient = $_GET{'idpatient'}; $lastname = $_GET{'lastname'}; $firstname = $_GET{'firstname'}; $sex = $_GET{'sex'}; $birthdate = $_GET{'birthdate'}; $text_h = $dimv - imagefontheight(12) - 20; $text_v = 20; imagestring($im, 12, $text_v, $text_h, $lastname.' '.$firstname.' '.$birthdate.' ('.$sex.') '.$idpatient, $white); // Enregistrement de l'image imagejpeg($im, $fname.".jpg", 100); imagejpeg($im, $fname.".jpg"); chmod($fname.".jpg", 0755); imagedestroy($im); } } } // on retourne les Tags print($filename); print('_TAG_'); print ($physicalDeltaX); print('_TAG_'); print ($physicalDeltaY); print('_TAG_'); print ($pixelspacingX); print('_TAG_'); print ($pixelspacingY); print('_TAG_'); ?>