|
@@ -13,26 +13,24 @@ namespace app\common\library;
|
|
|
require dirname(__FILE__).'/nanodicom/Nanodicom.php';
|
|
|
use Nanodicom;
|
|
|
use app\common\library\DicomPaserTag;
|
|
|
-use think\Exception;
|
|
|
-
|
|
|
class DicomPaser {
|
|
|
public static function paser($filePath = '') {
|
|
|
|
|
|
if(empty($filePath)) {
|
|
|
- return json_encode(['status'=>'fail','code'=>'2000','msg'=>"The filePath $filePath is empty or null"]);
|
|
|
+ throw new Error("The filePath $filePath is empty or null");
|
|
|
}
|
|
|
|
|
|
if(!file_exists($filePath)) {
|
|
|
- return json_encode(['status'=>'fail','code'=>'2000','msg'=>"The filePath $filePath not exist"]);
|
|
|
+ throw new Error("The filePath $filePath not exist");
|
|
|
}
|
|
|
|
|
|
if(!is_file($filePath)) {
|
|
|
- return json_encode(['status'=>'fail','code'=>'2000','msg'=>"The filePath $filePath not file"]);
|
|
|
+ throw new Error("The filePath $filePath not file");
|
|
|
}
|
|
|
|
|
|
$dicom = Nanodicom::factory($filePath);
|
|
|
if(! $dicom->is_dicom()) {
|
|
|
- return json_encode(['status'=>'fail','code'=>'2000','msg'=>"The filePath $filePath not dcm file"]);
|
|
|
+ throw new Error("The filePath $filePath not dcm file");
|
|
|
}
|
|
|
|
|
|
$a = $dicom->get(0x0010, 0x0010, 'N/A');
|