Skip to content

Instantly share code, notes, and snippets.

@nanodocumet
Last active December 25, 2015 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nanodocumet/7034466 to your computer and use it in GitHub Desktop.
Save nanodocumet/7034466 to your computer and use it in GitHub Desktop.
Sample code to read values from sequences. Should be incorporated into core to handle it natively.
<?php
require 'Nanodicom/nanodicom.php';
$filename = 'test.DCM';
$dicom = Nanodicom::factory($filename);
$dicom->parse(array(array(0x0010, 0x0010), array(0x0054, 0x0016)));
// Get the sequence
$seq = $dicom->value(0x0054, 0x0016);
// Get the items (sequences are grouped in items)
$items = $dicom->dataset_value($seq, 0xFFFE, 0xE000);
// Get the value wanted
$val = $dicom->dataset_value($items, 0x0018, 0x0031);
var_dump($val);
unset($dicom);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment