/** * Decode the messages * * @return null */ function loadMessages() { $this->loadRefDicomExchange(); if ($this->_ref_dicom_exchange) { $this->_ref_dicom_exchange->decodeContent(); } $this->_messages = array(); $msg_array = explode('|', $this->messages); foreach ($msg_array as $msg) { $msg = explode('\\', $msg); $pdu = CDicomPDUFactory::decodePDU(base64_decode($msg[1])); $this->_messages[$msg[0]] = $pdu; if ($msg[0] == "A-Associate-AC" && $this->_ref_dicom_exchange) { $i = 1; foreach ($this->_ref_dicom_exchange->_requests as $_request) { $name = "{$_request->type_str}-RQ{$i}"; $this->_messages[$name] = $_request; $i++; } $i = 1; foreach ($this->_ref_dicom_exchange->_responses as $_response) { $name = "{$_response->type_str}-RSP{$i}"; $this->_messages[$name] = $_response; $i++; } } } }
/** * Return the value of the Modality (dataset 0x0008,0x0060) * * @param array $requested_datas The the data of the CFind request * @param CExchangeDicom $dicom_exchange The Exchange Dicom * * @return string */ protected static function getRequestedModality($requested_datas, $dicom_exchange) { $modality = ''; $config = $dicom_exchange->getConfigs(); /* Check if a value is configured for the modality */ if (isset($config->value_0008_0060)) { $modality = $config->value_0008_0060; } elseif (array_key_exists(0x8, $requested_datas) && array_key_exists(0x60, $requested_datas[0x8])) { /* We check if the dataset is in the data */ $modality = $requested_datas[0x8][0x60]->getValue(); } elseif (array_key_exists(0x40, $requested_datas) && array_key_exists(0x100, $requested_datas[0x40]) && ($dataset = $requested_datas[0x40][0x100]->getSequenceDataSet(0x8, 0x60))) { $modality = $dataset->getValue(); } return $modality; }