コード例 #1
0
ファイル: class_dicom.php プロジェクト: songhongji/gaiaehr
 function __construct($file = '')
 {
     $this->file = $file;
     if (file_exists($this->file)) {
         if (is_dcm($this->file)) {
             $this->load_tags();
         }
     }
 }
コード例 #2
0
 function __construct($file = '')
 {
     $this->file = $file;
     if (file_exists($this->file)) {
         if (is_dcm($this->file)) {
             $this->load_tags();
         } else {
             $this->dealError(self::FILEERROR, $file);
         }
     }
 }
コード例 #3
0
ファイル: uploadsuccess.php プロジェクト: ra-ckhar/www
<html>
<head>
<title>Upload Form</title>
</head>
<body>

<h3>导入成功</h3>

<ul>
<?php 
//require_once(BASEPATH.'../class_dicom/class_dicom.php');
$file = $upload_data['orig_name'];
//echo $file."</br>";
chdir($upload_data['file_path']);
//echo getcwd()."</br>";
if (is_dcm($file)) {
    $d = new dicom_tag();
    $d->file = $file;
    $d->load_tags();
    $info['name'] = $d->get_tag('0010', '0010');
    $info['id'] = $d->get_tag('0010', '0020');
    $info['birth'] = $d->get_tag('0010', '0030');
    $info['sex'] = $d->get_tag('0010', '0040');
    $info['age'] = $d->get_tag('0010', '1010');
    $info['height'] = $d->get_tag('0010', '1020');
    $info['weight'] = $d->get_tag('0010', '1030');
    $info['ethnic'] = $d->get_tag('0010', '2160');
    $info['diagnoses'] = $d->get_tag('0008', '1080');
    $info['modality'] = $d->get_tag('0008', '0060');
    $info['appt_date'] = $d->get_tag('0008', '0020');
    $info['sop_id'] = $d->get_tag('0002', '0003');
コード例 #4
0
ファイル: storedicom.php プロジェクト: ra-ckhar/www
function process_file($file) {

  if(!is_dcm($file)) {
    print("Not a DICOM file: $file\n");
    unlink($file);
    return(0);
  }

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

  $name = $d->get_tag('0010', '0010');
  $id = $d->get_tag('0010', '0020');
  $modality = $d->get_tag('0008', '0060');
  $appt_date = $d->get_tag('0008', '0020');
  $sop_id = $d->get_tag('0002', '0003');
  $sex = $d->get_tag('0010', '0040');
  $age = $d->get_tag('0010', '1010');
  $weight = $d->get_tag('0010', '1030');
  $birth = $d->get_tag('0010', '0030');
  $birth = substr($birth,0,4).'-'.substr($birth,4,2).'-'.substr($birth,6,2);
  $appdate = substr($appt_date,0,4).'-'.substr($appt_date,4,2).'-'.substr($appt_date,6,2);
  $series_id = $d->get_tag('0020', '0052');
  $device = $d->get_tag('0008', '0070');
  $descp = $d->get_tag('0008', '1080');
  $operator = $d->get_tag('0018', '1030');
  $model_id = $d->get_tag('0008', '1090');
  $diagnoses = $d->get_tag('0010', '0030');
  $thick = $d->get_tag('0018', '0050');
  $spacing = $d->get_tag('0028', '0030');
  $device = $device.$model_id;
  


  $pa_id = insert_pa($name,$id,$sex,$age,$weight,$birth);
  $se_id = insert_se($pa_id,$series_id,$appdate,$modality,$device,$descp,$operator,$thick,$spacing);
  $year = date('Y', strtotime($appt_date));
  $month = date('m', strtotime($appt_date));
  $day = date('d', strtotime($appt_date));

  $storage = STORAGE . "/".str_pad($pa_id, 5, "0", STR_PAD_LEFT)."_".$name;
  if(!file_exists($storage)) {
    mkdir($storage);
  }
  $storage = $storage . "/".str_pad($se_id, 8, "0", STR_PAD_LEFT)."_".$modality."_".$appdate;
  if(!file_exists($storage)) {
    mkdir($storage);
  }

/*  $name = str_replace('^', '_', $name);
  $arr_replace = array('^', "'", '"', '`', '/', '\\', '?', ':', ';');
  foreach($arr_replace as $replace) {
    $name = str_replace($replace, '', $name);
    $id = str_replace($replace, '', $id);
  }

  $storage = $storage . "/$name" . "_$id";
  if(!file_exists($storage)) {
    mkdir($storage);
  }*/

  $new_file = $modality . "_" . $sop_id . ".dcm";

  if(file_exists("$storage/$new_file")) {
    $new_file = $modality . "_" . $sop_id . "_" . rand(1, 1000) . ".dcm";
  }

//  print "$storage/$new_file\n";

  if(!rename($file, "$storage/$new_file")) {
    print "Failed $file -> $storage/$new_file";
    exit;
  }
  print ".";

//  print "$name - $storage\n";
  //exit;
}
コード例 #5
0
ファイル: datasheet.php プロジェクト: ra-ckhar/www
 function process_file($file)
 {
     if (!is_dcm($file)) {
         print "Not a DICOM file: {$file}\n";
         unlink($file);
         return 0;
     }
     $d = new dicom_tag();
     $d->file = $file;
     $d->load_tags();
     $name = $d->get_tag('0010', '0010');
     $id = $d->get_tag('0010', '0020');
     $modality = $d->get_tag('0008', '0060');
     $appt_date = $d->get_tag('0008', '0020');
     $sop_id = $d->get_tag('0002', '0003');
     $year = date('Y', strtotime($appt_date));
     $month = date('m', strtotime($appt_date));
     $day = date('d', strtotime($appt_date));
     $storage = STORAGE . "/{$year}";
     if (!file_exists($storage)) {
         mkdir($storage);
     }
     $storage = $storage . "/{$month}";
     if (!file_exists($storage)) {
         mkdir($storage);
     }
     $storage = $storage . "/{$day}";
     if (!file_exists($storage)) {
         mkdir($storage);
     }
     $name = str_replace('^', '_', $name);
     $arr_replace = array('^', "'", '"', '`', '/', '\\', '?', ':', ';');
     foreach ($arr_replace as $replace) {
         $name = str_replace($replace, '', $name);
         $id = str_replace($replace, '', $id);
     }
     $storage = $storage . "/{$name}" . "_{$id}";
     if (!file_exists($storage)) {
         mkdir($storage);
     }
     $new_file = $modality . "_" . $sop_id . ".dcm";
     if (file_exists("{$storage}/{$new_file}")) {
         $new_file = $modality . "_" . $sop_id . "_" . rand(1, 1000) . ".dcm";
     }
     //  print "$storage/$new_file\n";
     if (!rename($file, "{$storage}/{$new_file}")) {
         print "Failed {$file} -> {$storage}/{$new_file}";
         exit;
     }
     print ".";
     //  print "$name - $storage\n";
     //exit;
 }