radfusion/app/Services/Pacs/PacsUrlGen.php
2025-01-20 21:16:03 +06:00

67 lines
1.9 KiB
PHP

<?php
namespace App\Services\Pacs;
use App\Models\DicomServer;
use App\Models\Study;
use Illuminate\Support\Uri;
final class PacsUrlGen
{
public static function stoneViewer(DicomServer $host, Study $study): string
{
$url = $host->stoneViewerUrl()->withQuery(['study' => $study->study_instance_uid]);
return (string) $url;
}
public static function ohifViewer(DicomServer $host, Study $study): string
{
$url = $host->ohifViewerUrl()
->withQuery(['StudyInstanceUIDs' => $study->study_instance_uid]);
return (string) $url;
}
public static function ohifViewerMpr(DicomServer $host, Study $study): string
{
$url = $host->ohifViewerUrl()
->withQuery([
'hangingprotocolId' => 'mprAnd3DVolumeViewport',
'StudyInstanceUIDs' => $study->study_instance_uid,
]);
return (string) $url;
}
public static function weasisUrl(DicomServer $host, Study $study, bool $close = false): string
{
$parts = [];
if ($close) {
$parts[] = '$dicom:close --all';
}
$parts[] = sprintf('$dicom:rs --url "%s"', $host->wadoUrl());
$parts[] = sprintf('-r "studyUID=%s"', $study->study_instance_uid);
// $parts[] = '--query-ext "&includedefaults=false"';
return sprintf('weasis://%s', urlencode(implode(' ', $parts)));
}
public static function ohifSegmentation(DicomServer $host, Study $study): string
{
$url = $host->ohifViewerUrl()
->withPath('/ohif/segmentation')
->withQuery(['StudyInstanceUIDs' => $study->study_instance_uid]);
return (string) $url;
}
public static function archive(DicomServer $host, Study $study): string
{
$url = Uri::of($host->rest_api_endpoint)
->withPath('/studies/' . $study->study_instance_uid . '/archive');
return (string) $url;
}
}