/** * Decode the PDU * * @param CDicomStreamReader $stream_reader The stream reader * * @return null */ function decodePDU(CDicomStreamReader $stream_reader) { $this->pdvs = array(); $stream_reader->setStreamLength($this->getTotalLength()); while ($stream_reader->getPos() < $stream_reader->getStreamLength()) { $pdv_length = $stream_reader->readUInt32(); // + 4; //$stream_reader->seek(-4); $pdv_content = $stream_reader->read($pdv_length); $pdv_handle = fopen('php://temp', 'w+'); fwrite($pdv_handle, $pdv_content, $pdv_length); $pdv_stream = new CDicomStreamReader($pdv_handle); $pdv_stream->rewind(); $pdv = new CDicomPDV(array("presentation_contexts" => $this->presentation_contexts, "length" => $pdv_length)); $pdv->decode($pdv_stream); $this->pdvs[] = $pdv; } }