示例#1
0
 /**
  * Prepare the datas for creating a A-Associate-AC PDU
  *
  * @param CDicomPDUAAssociateRQ $associate_rq The A-Associate-RQ PDU
  *
  * @return array
  *
  * @todo handle the user info sub items
  */
 protected function prepareAAssociateACPDU(CDicomPDUAAssociateRQ $associate_rq)
 {
     $datas = array("protocol_version" => 1, "called_AEtitle" => $associate_rq->called_AE_title, "calling_AEtitle" => $associate_rq->calling_AE_title, "application_context" => array("name" => $associate_rq->application_context->name), "presentation_contexts" => array(), "user_info" => array("sub_items" => array("CDicomPDUItemMaximumLength" => array("maximum_length" => 32768), "CDicomPDUItemImplementationClassUID" => array("uid" => CAppUI::conf("dicom implementation_sop_class")), "CDicomPDUItemImplementationVersionName" => array("version_name" => CAppUI::conf("dicom implementation_version")))));
     foreach ($associate_rq->presentation_contexts as $presentation_context) {
         $reason = 0;
         if (!CDicomDictionary::isSOPClassSupported($presentation_context->abstract_syntax->name)) {
             $reason = 3;
         }
         $transfer_syntaxes = array();
         foreach ($presentation_context->transfer_syntaxes as $_transfer_syntax) {
             if (CDicomDictionary::isTransferSyntaxSupported($_transfer_syntax->name)) {
                 $transfer_syntaxes[] = $_transfer_syntax->name;
             }
         }
         if (in_array("1.2.840.10008.1.2", $transfer_syntaxes)) {
             $transfer_syntax = "1.2.840.10008.1.2";
         } else {
             if (count($transfer_syntaxes) == 0) {
                 $reason = 4;
             }
             $transfer_syntax = $transfer_syntaxes[0];
         }
         $datas["presentation_contexts"][] = array("id" => $presentation_context->id, "reason" => $reason, "transfer_syntax" => array("name" => $transfer_syntax));
     }
     return $datas;
 }
示例#2
0
 /**
  * Calculate the length of the value
  * 
  * @return null
  */
 protected function calculateLength()
 {
     $vr_def = CDicomDictionary::getValueRepresentation($this->vr);
     if ($vr_def['Fixed'] == 1) {
         $this->length = $vr_def['Length'];
     } elseif (is_array($this->value)) {
         $this->length = 0;
     } else {
         $this->length = strlen($this->value);
     }
 }