/** * Decode the PDU * * @param CDicomStreamReader $stream_reader The stream reader * * @return null */ function decodePDU(CDicomStreamReader $stream_reader) { $stream_reader->skip(1); $this->result = $stream_reader->readUInt8(); $this->source = $stream_reader->readUInt8(); $this->diagnostic = $stream_reader->readUInt8(); }
/** * Decode the Presentation Syntax * * @param CDicomStreamReader $stream_reader The stream reader * * @return void */ function decodeItem(CDicomStreamReader $stream_reader) { $this->id = $stream_reader->readUInt8(); $stream_reader->skip(3); $this->abstract_syntax = CDicomPDUItemFactory::decodeItem($stream_reader); $this->transfer_syntaxes = CDicomPDUItemFactory::decodeConsecutiveItemsByType($stream_reader, 0x40); }
/** * Decode the Sop Class Extended Negociation * * @param CDicomStreamReader $stream_reader The stream reader * * @return null */ function decodeItem(CDicomStreamReader $stream_reader) { $this->uid_length = $stream_reader->readUInt16(); $this->sop_class_uid = $stream_reader->readUID($this->uid_length); $this->sca_support = $stream_reader->readUInt8(); $stream_reader->skip(1); $this->sca_digital_signature_support = $stream_reader->readUInt8(); $stream_reader->skip(1); $this->sca_element_coercion = $stream_reader->readUInt8(); $stream_reader->skip(1); }
/** * Decode the Presentation Syntax * * @param CDicomStreamReader $stream_reader The stream reader * * @return null */ function decodeItem(CDicomStreamReader $stream_reader) { $this->id = $stream_reader->readUInt8(); $stream_reader->skip(1); $this->reason = $stream_reader->readUInt8(); $stream_reader->skip(1); $this->transfer_syntax = CDicomPDUItemFactory::decodeItem($stream_reader); }
/** * Read the type of the PDU from the stream * * @param CDicomStreamReader $stream The stream reader * * @return string */ static function readType(CDicomStreamReader $stream) { $tmp = $stream->readUInt8(); $stream->skip(1); return self::getPDUClass($tmp); }
/** * Decode the data set with the explicit VR * * @param CDicomStreamReader $stream_reader The stream reader * * @param string $endianness The endianness, must be equal to "BE" (Big Endian) or "LE" (Little Endian) * * @return null */ protected function decodeExplicit(CDicomStreamReader $stream_reader, $endianness) { $this->group_number = $stream_reader->readUInt16($endianness); $this->element_number = $stream_reader->readUInt16($endianness); $this->vr = $stream_reader->readString(2); if (in_array($this->vr, array("OB", "OW", "OF", "SQ", "UT", "UN"))) { $stream_reader->skip(2); $stream_reader->readUInt32($this->length, $endianness); } else { $stream_reader->readUInt16($this->length, $endianness); } if ($this->length > 0 && $this->length < 0xffffffff || $this->vr == "SQ") { $this->decodeValue($stream_reader, $endianness); } }
/** * Check if the message is well formed * * @param string $msg The message * * @param CInteropActor $actor The actor who sent the message * * @return boolean */ function isWellFormed($msg, CInteropActor $actor = null) { $stream = fopen("php://temp", 'w+'); fwrite($stream, $msg); $stream_reader = new CDicomStreamReader($stream); $stream_reader->rewind(); $type = $stream_reader->readHexByte(); if ($type != "04") { $stream_reader->close(); return false; } $stream_reader->skip(1); $length = $stream_reader->readUInt32(); $stream_reader->close(); if (strlen($msg) != $length + 6) { return false; } return true; }
/** * Decode the PDU * * @param CDicomStreamReader $stream_reader The stream reader * * @return null */ function decodePDU(CDicomStreamReader $stream_reader) { $stream_reader->skip(4); }
/** * Read the type of an item. If a item type has been read but not decoded, it returns this type. * * @param CDicomStreamReader $stream_reader The stream reader * * @return string The name of the item class */ static function readItemType(CDicomStreamReader $stream_reader) { $item_type = null; if (!self::$next_item) { $tmp = $stream_reader->readUInt8(); $stream_reader->skip(1); if (!$tmp) { return false; } $item_type = self::getItemClass($tmp); //$stream_reader->readHexByte()]; } else { $item_type = self::$next_item; self::$next_item = null; } return $item_type; }
/** * Decode the PDU * * @param CDicomStreamReader $stream_reader The stream reader * * @return void */ function decodePDU(CDicomStreamReader $stream_reader) { $this->protocol_version = $stream_reader->readUInt16(); $stream_reader->skip(2); $this->called_AE_title = $stream_reader->readString(16); // On test si called_AE_title = AE title du serveur $this->calling_AE_title = $stream_reader->readString(16); // On passe 32 octets, réservés par Dicom $stream_reader->skip(32); $this->application_context = CDicomPDUItemFactory::decodeItem($stream_reader); $this->presentation_contexts = CDicomPDUItemFactory::decodeConsecutiveItemsByType($stream_reader, 0x20); $this->user_info = CDicomPDUItemFactory::decodeItem($stream_reader); }
/** * Decode the PDU * * @param CDicomStreamReader $stream_reader The stream reader * * @return void */ function decodePDU(CDicomStreamReader $stream_reader) { $this->protocol_version = $stream_reader->readUInt16(); // On vérifie que la version du protocole est bien 0001 if ($this->protocol_version != 0x1) { // Erreur echo "Protocol version differente de 1"; } $stream_reader->skip(2); $this->called_AE_title = $stream_reader->readString(16); // On test si called_AE_title = AE title du serveur $this->calling_AE_title = $stream_reader->readString(16); // On passe 32 octets, réservés par Dicom $stream_reader->skip(32); $this->application_context = CDicomPDUItemFactory::decodeItem($stream_reader); $this->presentation_contexts = CDicomPDUItemFactory::decodeConsecutiveItemsByType($stream_reader, 0x21); $this->user_info = CDicomPDUItemFactory::decodeItem($stream_reader); }