|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
Copyright (C) 2018-2020 KANOUN Salim |
|
4
|
|
|
This program is free software; you can redistribute it and/or modify |
|
5
|
|
|
it under the terms of the Affero GNU General Public v.3 License as published by |
|
6
|
|
|
the Free Software Foundation; |
|
7
|
|
|
This program is distributed in the hope that it will be useful, |
|
8
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
10
|
|
|
Affero GNU General Public Public for more details. |
|
11
|
|
|
You should have received a copy of the Affero GNU General Public Public along |
|
12
|
|
|
with this program; if not, write to the Free Software Foundation, Inc., |
|
13
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
14
|
|
|
*/ |
|
15
|
|
|
|
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Collect patient's data from Orthanc Server |
|
19
|
|
|
* This class is not used anymore ... |
|
20
|
|
|
*/ |
|
21
|
|
|
|
|
22
|
|
|
class Orthanc_Patient { |
|
23
|
|
|
public $patientName; |
|
24
|
|
|
public $patientID; |
|
25
|
|
|
public $patientSex; |
|
26
|
|
|
public $patientBirthDate; |
|
27
|
|
|
public $patientOrthancID; |
|
28
|
|
|
public $studiesOrthancID; |
|
29
|
|
|
public $studiesDetails; |
|
30
|
|
|
private $url; |
|
31
|
|
|
private $context; |
|
32
|
|
|
|
|
33
|
|
|
|
|
34
|
|
|
public function __construct($patientOrthancID, $url, $context) { |
|
35
|
|
|
//Set orthanc address |
|
36
|
|
|
$this->url=$url; |
|
37
|
|
|
$this->context=$context; |
|
38
|
|
|
//Set current patient Orthanc ID |
|
39
|
|
|
$this->patientOrthancID=$patientOrthancID; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Get and store the main tags of the patient level |
|
44
|
|
|
*/ |
|
45
|
|
|
public function retrievePatientData() { |
|
46
|
|
|
$context=stream_context_create($this->context); |
|
47
|
|
|
$json=file_get_contents($this->url.'/patients/'.$this->patientOrthancID, false, $context); |
|
48
|
|
|
$patientJson=json_decode($json, true); |
|
49
|
|
|
//Add needed informations in this object |
|
50
|
|
|
$this->patientName=$patientJson['MainDicomTags']['PatientName']; |
|
51
|
|
|
$this->patientID=$patientJson['MainDicomTags']['PatientID']; |
|
52
|
|
|
$this->patientSex=$patientJson['MainDicomTags']['PatientSex']; |
|
53
|
|
|
$this->patientBirthDate=$patientJson['MainDicomTags']['PatientBirthDate']; |
|
54
|
|
|
$this->studiesOrthancID=$patientJson['Studies']; |
|
55
|
|
|
$this->getStudiesData(); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Retrieve data from study level |
|
60
|
|
|
*/ |
|
61
|
|
|
public function getStudiesData() { |
|
62
|
|
|
foreach ($this->studiesOrthancID as $studyID) { |
|
63
|
|
|
//Create a study object of each study |
|
64
|
|
|
$study=new Orthanc_Study($studyID, $this->url, $this->context); |
|
65
|
|
|
//fetch the data of the study level |
|
66
|
|
|
$study->retrieveStudyData(); |
|
67
|
|
|
//Add the study in the current object |
|
68
|
|
|
$this->studiesDetails[]=$study; |
|
69
|
|
|
|
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
} |
|
74
|
|
|
|