class_dicom.php (DICOM PHP Class)

class_dicom.php is a PHP class that lets you work with DICOM files within PHP programs. class_dicom.php enables you to retrieve tags, write tags, convert to JPEG, make thumbnails, convert JPEG to DICOM, compress DICOM, uncompress DICOM, receive DICOM files over the network, and send DICOM files over the network. It even comes with several example programs so you can get started writing your own code right away!

class_dicom.php uses the excellent Offis DICOM Toolkit for it's nitty gritty DICOM work. Your system will need a reasonably recent version of the DICOM Toolkit in order to use class_dicom.php.

Downloading

You can download class_dicom.php directly from this site or from GitHub.

Specifics

class_dicom.php is made up three classes that handle tags, conversions, and network.

class dicom_tag

class dicom_convert

class dicom_net

Examples of Examples

These examples and many more are included in the download packages above.
#
# Prints out the DICOM tags in a file specified on the command line
#

require_once('../class_dicom.php');

$file = (isset($argv[1]) ? $argv[1] : '');

if(!$file) {
  print "USAGE: ./get_tags.php \n";
  exit;
}

if(!file_exists($file)) {
  print "$file: does not exist\n";
  exit;
}

$d = new dicom_tag;
$d->file = $file;
$d->load_tags();

print_r($d->tags); // PRINT ALL OF THE TAGS

$name = $d->get_tag('0010', '0010'); // GET A SPECIFIC TAG
print "Name: $name\n";

#
# Creates a jpeg and jpeg thumbnail of a DICOM file
#

require_once('../class_dicom.php');

$file = (isset($argv[1]) ? $argv[1] : '');

if(!$file) {
  print "USAGE: ./dcm_to_jpg.php \n";
  exit;
}

if(!file_exists($file)) {
  print "$file: does not exist\n";
  exit;
}

$d = new dicom_convert;
$d->file = $file;
$d->dcm_to_tn(); // CONVERT TO JPEG AND A JPEG THUMBNAIL
system("ls -lsh $file*"); // List the files we just created

Contact Me

Arkie Imports | Dean Vaughan | K. Dean Vaughan | K. Dean Vaughan | Kenneth Vaughan | Google Profile | Facebook | LinkedIn | Git Hub | Rachael Vaughan | thevedic.net





Dean Vaughan at flavors.me | Dean Vaughan at about.me