From b2726911e7241bea68b70a1e7638059928b8a99c Mon Sep 17 00:00:00 2001 From: Masroor Ehsan Date: Mon, 27 Jan 2025 17:52:08 +0600 Subject: [PATCH] dicom headers contain header name --- app/Services/Pacs/Sync/StudiesSync.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Services/Pacs/Sync/StudiesSync.php b/app/Services/Pacs/Sync/StudiesSync.php index 8325648..29b98bd 100644 --- a/app/Services/Pacs/Sync/StudiesSync.php +++ b/app/Services/Pacs/Sync/StudiesSync.php @@ -283,20 +283,21 @@ private function getStudyDicomTags(string $study_uuid): array // randomly sample few instances for tags collection $selectedInstances = count($instances) <= $this->maxInstances ? $instances : array_rand(array_flip($instances), $this->maxInstances); - $tags = []; + $tags = collect(); foreach ($selectedInstances as $instance) { foreach ($this->fetchInstancesTags($instance) as $key => $value) { if ($key == 'MainDicomTags' || $key == 'RequestedTags') { foreach ($value as $tag => $val) { - if (! isset($tags[$tag]) || $tags[$tag] !== $val) { - $tags[$tag] = $val; + $dcmTag = RawDicomTags::tryFrom($tag); + if ($dcmTag != null && (! $tags->has($dcmTag->name) || $tags->get($dcmTag->name) !== $val)) { + $tags->put($dcmTag->name, $val); } } } } } - return $tags; + return $tags->toArray(); } private function setValue(array &$array, string $key, mixed $value): void