Инструменты пользователя

Инструменты сайта


orthanc

Различия

Показаны различия между двумя версиями страницы.

Ссылка на это сравнение

Предыдущая версия справа и слева Предыдущая версия
Следующая версия
Предыдущая версия
orthanc [2021/12/29 02:22]
sector
orthanc [2022/05/27 02:34] (текущий)
sector
Строка 170: Строка 170:
 </code> </code>
 Lua: Lua:
 +
 +Разрешения выполнять запросы  к Orthanc, с помощью этого скрипта можно разграничить права доступа к web интерфейсу Orthanc
 +
 <code | ini> <code | ini>
 +
 cat access.lua cat access.lua
 function IncomingHttpRequestFilter(method, uri, ip, username, httpHeaders) function IncomingHttpRequestFilter(method, uri, ip, username, httpHeaders)
    -- Only allow GET requests for non-admin users    -- Only allow GET requests for non-admin users
  
-  --if method == 'GET' then +  if method == 'GET' or method == 'POST' then 
-    --  return true +      return true
-  if method == 'POST' or method == 'GET' then +
-     return true+
    elseif username == 'admin' then    elseif username == 'admin' then
       return true       return true
Строка 186: Строка 188:
 end end
  
 +</code>
  
 +
 +Можно по ip
 +
 +<code | ini>
 +
 +function IncomingHttpRequestFilter(method, uri, ip, username, httpHeaders)
 +  if method == 'GET' and (username == 'user' or username == 'admin') then
 +    -- Read-only access (only GET method is allowed)
 +    return true
 +  elseif username == 'admin' and ip == '127.0.0.1' then
 +    -- Read-write access for administrator (any HTTP method is allowed on localhost)
 +    return true
 +  else
 +    -- Access is disallowed by default
 +    return false
 +  end
 +end
 +
 +</code>
 +
 +
 +С помощью этого скрипта можно отправлять снимки которые пришли в Orthanc на другие DICOM сервера или на рабочие станции врачей.
 +
 +<code | ini>
 cat send.lua cat send.lua
 function OnStoredInstance(instanceId, tags, metadata) function OnStoredInstance(instanceId, tags, metadata)
     SendToModality(instanceId, 'sample')     SendToModality(instanceId, 'sample')
 end end
 +
 </code> </code>
 +
 +С помощью этого скрипта можно разбирать изображение которые приходят на Orthanc и маршрутизировать их на другие сервера. 
 +
 +<code | ini>
 +cat /etc/orthanc/lua/send.lua
 +function OnStoredInstance(instanceId, tags, metadata)
 +    local Modality = tags['Modality']
 +        if string.find(Modality, 'CR') ~= nil then
 +            SendToModality(instanceId, 'sample')
 +        elseif string.find(Modality, 'MR') ~= nil then
 +            SendToModality(instanceId, 'sample')
 +        end
 +end
 +</code>
 +
 +
 перезапускаем: перезапускаем:
  
Строка 198: Строка 242:
 </code> </code>
  
-  +Удаление старых записей 
 +<code | ini> 
 + $ curl --user admin:password http://localhost:8042/tools/find -d '{"Level":"Study","Query":{"StudyDate":"20120101-20121231"}}' 
 +
 +   "6e2c0ec2-5d99c8ca-c1c21cee-79a09605-68391d12", 
 +   "ef2ce55f-9342856a-aee23907-2667e859-9f3b734d" 
 +
 +$ curl -X DELETE http://localhost:8042/studies/6e2c0ec2-5d99c8ca-c1c21cee-79a09605-68391d12 
 +$ curl -X DELETE http://localhost:8042/studies/ef2ce55f-9342856a-aee23907-2667e859-9f3b734d 
 +</code>
  
orthanc.1640744547.txt.gz · Последнее изменение: 2021/12/29 02:22 — sector

Яндекс.Метрика