|
1 | 1 | <?php
|
| 2 | + |
2 | 3 | /**
|
3 | 4 | Copyright (C) 2018-2020 KANOUN Salim
|
4 | 5 | This program is free software; you can redistribute it and/or modify
|
|
18 | 19 | use App\GaelO\Constants\Constants;
|
19 | 20 | use App\GaelO\Services\OrthancService;
|
20 | 21 |
|
21 |
| -Class OrthancSeries { |
| 22 | +class OrthancSeries |
| 23 | +{ |
22 | 24 |
|
23 |
| - private OrthancService $orthancService; |
| 25 | + private OrthancService $orthancService; |
24 | 26 |
|
25 |
| - public string $seriesOrthancID; |
| 27 | + public string $seriesOrthancID; |
26 | 28 |
|
27 | 29 | public string $parentStudyOrthancID;
|
28 | 30 | public ?string $manufacturer;
|
|
40 | 42 | public int $diskSizeMb;
|
41 | 43 | public int $uncompressedSizeMb;
|
42 | 44 | public $patientWeight;
|
43 |
| - public $injectedDose; |
44 |
| - public $injectedTime; |
| 45 | + public $injectedDose; |
| 46 | + public $injectedTime; |
45 | 47 | public $injectedDateTime;
|
46 | 48 | public $radiopharmaceutical;
|
47 | 49 | public $halfLife;
|
48 | 50 | public string $sopClassUid;
|
49 | 51 |
|
50 |
| - public function __construct(OrthancService $orthancService) { |
51 |
| - $this->orthancService=$orthancService; |
52 |
| - } |
| 52 | + public function __construct(OrthancService $orthancService) |
| 53 | + { |
| 54 | + $this->orthancService = $orthancService; |
| 55 | + } |
53 | 56 |
|
54 |
| - public function setSeriesOrthancID(string $seriesOrthancID){ |
55 |
| - $this->seriesOrthancID=$seriesOrthancID; |
56 |
| - } |
| 57 | + public function setSeriesOrthancID(string $seriesOrthancID) |
| 58 | + { |
| 59 | + $this->seriesOrthancID = $seriesOrthancID; |
| 60 | + } |
57 | 61 |
|
58 | 62 | /**
|
59 | 63 | *Get Series related data and store them in this object
|
60 | 64 | */
|
61 |
| - public function retrieveSeriesData() { |
62 |
| - $seriesDetails=$this->orthancService->getOrthancRessourcesDetails(Constants::ORTHANC_SERIES_LEVEL, $this->seriesOrthancID); |
| 65 | + public function retrieveSeriesData() |
| 66 | + { |
| 67 | + $seriesDetails = $this->orthancService->getOrthancRessourcesDetails(Constants::ORTHANC_SERIES_LEVEL, $this->seriesOrthancID); |
63 | 68 |
|
64 | 69 | //add needed informations in the current object
|
65 |
| - $this->manufacturer=$seriesDetails['MainDicomTags']['Manufacturer'] ?? null; |
66 |
| - $this->modality=$seriesDetails['MainDicomTags']['Modality'] ?? null; |
67 |
| - $this->seriesDate=$seriesDetails['MainDicomTags']['SeriesDate'] ?? null; |
68 |
| - $this->seriesTime=$seriesDetails['MainDicomTags']['SeriesTime'] ?? null; |
69 |
| - $this->seriesDescription=$seriesDetails['MainDicomTags']['SeriesDescription'] ?? null; |
70 |
| - $this->seriesInstanceUID=$seriesDetails['MainDicomTags']['SeriesInstanceUID']; |
71 |
| - $this->seriesNumber=$seriesDetails['MainDicomTags']['SeriesNumber'] ?? null; |
72 |
| - $this->seriesIsStable=$seriesDetails['IsStable']; |
73 |
| - $this->parentStudyOrthancID=$seriesDetails['ParentStudy']; |
74 |
| - $this->seriesInstances=$seriesDetails['Instances']; |
75 |
| - $this->numberOfInstanceInOrthanc=sizeof($seriesDetails['Instances']); |
76 |
| - $this->lastUpdate=$seriesDetails['LastUpdate']; |
| 70 | + $this->manufacturer = $seriesDetails['MainDicomTags']['Manufacturer'] ?? null; |
| 71 | + $this->modality = $seriesDetails['MainDicomTags']['Modality'] ?? null; |
| 72 | + $this->seriesDate = $seriesDetails['MainDicomTags']['SeriesDate'] ?? null; |
| 73 | + $this->seriesTime = $seriesDetails['MainDicomTags']['SeriesTime'] ?? null; |
| 74 | + $this->seriesDescription = $seriesDetails['MainDicomTags']['SeriesDescription'] ?? null; |
| 75 | + $this->seriesInstanceUID = $seriesDetails['MainDicomTags']['SeriesInstanceUID']; |
| 76 | + $this->seriesNumber = $seriesDetails['MainDicomTags']['SeriesNumber'] ?? null; |
| 77 | + $this->seriesIsStable = $seriesDetails['IsStable']; |
| 78 | + $this->parentStudyOrthancID = $seriesDetails['ParentStudy']; |
| 79 | + $this->seriesInstances = $seriesDetails['Instances']; |
| 80 | + $this->numberOfInstanceInOrthanc = sizeof($seriesDetails['Instances']); |
| 81 | + $this->lastUpdate = $seriesDetails['LastUpdate']; |
77 | 82 |
|
78 | 83 | //add instance data using the first Instance Orthanc ID
|
79 | 84 | $this->retrieveInstancesData($seriesDetails['Instances'][0]);
|
80 | 85 |
|
81 | 86 | //add statistics data
|
82 | 87 | $this->retrieveSeriesStatistics();
|
83 |
| - |
84 | 88 | }
|
85 | 89 |
|
86 | 90 | /**
|
87 | 91 | * Get statistics of the series (size in MB)
|
88 | 92 | */
|
89 |
| - private function retrieveSeriesStatistics() { |
90 |
| - $statistics=$this->orthancService->getOrthancRessourcesStatistics(Constants::ORTHANC_SERIES_LEVEL, $this->seriesOrthancID); |
91 |
| - $this->diskSizeMb=$statistics['DiskSizeMB']; |
92 |
| - $this->uncompressedSizeMb=$statistics['UncompressedSizeMB']; |
| 93 | + private function retrieveSeriesStatistics() |
| 94 | + { |
| 95 | + $statistics = $this->orthancService->getOrthancRessourcesStatistics(Constants::ORTHANC_SERIES_LEVEL, $this->seriesOrthancID); |
| 96 | + $this->diskSizeMb = $statistics['DiskSizeMB']; |
| 97 | + $this->uncompressedSizeMb = $statistics['UncompressedSizeMB']; |
93 | 98 | }
|
94 | 99 |
|
95 | 100 | /**
|
96 | 101 | * Store some data only available in the Instance level
|
97 | 102 | * @param $instanceID
|
98 | 103 | */
|
99 |
| - private function retrieveInstancesData($instanceOrthancID) { |
| 104 | + private function retrieveInstancesData($instanceOrthancID) |
| 105 | + { |
100 | 106 | $instanceTags = $this->orthancService->getInstanceTags($instanceOrthancID);
|
101 |
| - $this->patientWeight=is_numeric($instanceTags->getPatientWeight()) ? $instanceTags->getPatientWeight() : null; |
| 107 | + $this->patientWeight = is_numeric($instanceTags->getPatientWeight()) ? $instanceTags->getPatientWeight() : null; |
102 | 108 | $this->modelName = $instanceTags->getModelName();
|
103 | 109 | $this->injectedDose = is_numeric($instanceTags->getInjectedDose()) ? $instanceTags->getInjectedDose() : null;
|
104 |
| - $this->injectedTime = $instanceTags->getInjectedTime(); |
105 |
| - $this->injectedDateTime = $instanceTags->getInjectedDateTime(); |
| 110 | + $this->injectedTime = $instanceTags->getInjectedTime(); |
| 111 | + $this->injectedDateTime = $instanceTags->getInjectedDateTime(); |
106 | 112 | $this->radiopharmaceutical = $instanceTags->getRadiopharmaceutical();
|
107 |
| - $this->halfLife=is_numeric($instanceTags->getHalfLife())? $instanceTags->getHalfLife() : null; |
108 |
| - $this->sopClassUid= $instanceTags->getSOPClassUID(); |
| 113 | + $this->halfLife = is_numeric($instanceTags->getHalfLife()) ? $instanceTags->getHalfLife() : null; |
| 114 | + $this->sopClassUid = $instanceTags->getSOPClassUID(); |
109 | 115 | }
|
110 | 116 |
|
111 | 117 | /**
|
112 | 118 | * Return if this serie in a secondary capture type
|
113 | 119 | * @return boolean
|
114 | 120 | */
|
115 |
| - public function isSecondaryCapture() { |
116 |
| - $scUids[]="1.2.840.10008.5.1.4.1.1.7"; |
117 |
| - $scUids[]="1.2.840.10008.5.1.4.1.1.7.1"; |
118 |
| - $scUids[]="1.2.840.10008.5.1.4.1.1.7.2"; |
119 |
| - $scUids[]="1.2.840.10008.5.1.4.1.1.7.3"; |
120 |
| - $scUids[]="1.2.840.10008.5.1.4.1.1.7.4"; |
121 |
| - $scUids[]="1.2.840.10008.5.1.4.1.1.88.11"; |
122 |
| - $scUids[]="1.2.840.10008.5.1.4.1.1.88.22"; |
123 |
| - $scUids[]="1.2.840.10008.5.1.4.1.1.88.33"; |
124 |
| - $scUids[]="1.2.840.10008.5.1.4.1.1.88.40"; |
125 |
| - $scUids[]="1.2.840.10008.5.1.4.1.1.88.50"; |
126 |
| - $scUids[]="1.2.840.10008.5.1.4.1.1.88.59"; |
127 |
| - $scUids[]="1.2.840.10008.5.1.4.1.1.88.65"; |
128 |
| - $scUids[]="1.2.840.10008.5.1.4.1.1.88.67"; |
| 121 | + public function isSecondaryCapture() |
| 122 | + { |
| 123 | + $scUids = [ |
| 124 | + "1.2.840.10008.5.1.4.1.1.7", |
| 125 | + "1.2.840.10008.5.1.4.1.1.7.1", |
| 126 | + "1.2.840.10008.5.1.4.1.1.7.2", |
| 127 | + "1.2.840.10008.5.1.4.1.1.7.3", |
| 128 | + "1.2.840.10008.5.1.4.1.1.7.4", |
| 129 | + "1.2.840.10008.5.1.4.1.1.88.11", |
| 130 | + "1.2.840.10008.5.1.4.1.1.88.22", |
| 131 | + "1.2.840.10008.5.1.4.1.1.88.33", |
| 132 | + "1.2.840.10008.5.1.4.1.1.88.40", |
| 133 | + "1.2.840.10008.5.1.4.1.1.88.50", |
| 134 | + "1.2.840.10008.5.1.4.1.1.88.59", |
| 135 | + "1.2.840.10008.5.1.4.1.1.88.65", |
| 136 | + "1.2.840.10008.5.1.4.1.1.88.67" |
| 137 | + ]; |
129 | 138 |
|
130 | 139 | if (in_array($this->sopClassUid, $scUids)) {
|
131 | 140 | return true;
|
132 | 141 | } else {
|
133 | 142 | return false;
|
134 | 143 | }
|
135 |
| - |
136 | 144 | }
|
137 |
| - |
138 | 145 | }
|
0 commit comments