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

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


Боковая панель

Навигация

unix
notes
firmware
windows
Говнокод

Внешние ссылки

Внешняя ссылка

orthanc

Это старая версия документа!


Раньше ничем таким не занимался, знания о DICOM заканчиваются на том, что это формат медицинских изображений…
На работе есть несколько медицинских устройств, которые обмениваются снимками с компа оператора на комп врача.
На каждом оборудовании есть своя программа и на станциях врачей своя.

Решил попробовать сделать единое хранилище.
Конечно, можно купить и платные продукты, но это не наш метод.
Поиск выдал Orthanc, система у меня Debian 10, так что решил поставить из репозитория:

ini
apt-get install  Orthanc

Установил, поправил конфиг для того что бы зайти в WEB, загрузил несколько картинок…

В последних версиях пользователи хранятся тут :

ini
credentials.json

{
  /**
   * Sensitive configuration options. This file must *not* be
   * publicly-readable. It must only be readable by the users that run
   * the "orthanc" service.
   **/

  // The list of the registered users. Because Orthanc uses HTTP
  // Basic Authentication, the passwords are stored as plain text.
  "RegisteredUsers" : {
    "alice" : "alicePassword"
    "admin" : "adminPassword",
  }
}

Включение http сервера и авторизации тут:

ini
Orthanc.json
 "HttpServerEnabled" : true,


 "AuthenticationEnabled" : true,

Что-то мне не понравился стандартный web viewer…
Решил прикрутить viewer от Osimis.

скачиваем:

ini
wget http://orthanc.osimis.io/lsb/plugin-osimis-webviewer/releases/1.2.0/libOsimisWebViewer.so

нужно посмотреть → http://orthanc.osimis.io/lsb/plugin-osimis-webviewer/releases/1.3.1/libOsimisWebViewer.so

по умолчанию подгружаются все плагины находящиеся в папке /usr/share/orthanc/plugins
поэтому директиву Plugins править не нужно.
скаченную библиотеку надо поместить в папку: /usr/share/orthanc/plugins
и перезапустить orthanc.

ini
// Whether remote hosts can connect to the HTTP server
  "RemoteAccessAllowed" : false, -  исправить на true что бы зайти в  WEB
  
  "Plugins" : [
    "/home/user/ libOsimisWebViewer.so r.so",
] 
  

TITLE AE -сервера, собственно куда отправляются снимки И кодировка в которую они будут преобразованы «DefaultEncoding» : «Windows1251»,

ini
  // The DICOM Application Entity Title
  "DicomAet" : "ORTHANC",

  // Check whether the called AET corresponds to the AET of Orthanc
  // during an incoming DICOM SCU request
  "DicomCheckCalledAet" : false,

  // The DICOM port
  "DicomPort" : 4242,

  // The default encoding that is assumed for DICOM files without
  // "SpecificCharacterSet" DICOM tag, and that is used when answering
  // C-Find requests (including worklists). The allowed values are
  // "Ascii", "Utf8", "Latin1", "Latin2", "Latin3", "Latin4",
  // "Latin5", "Cyrillic", "Windows1251", "Arabic", "Greek", "Hebrew",
  // "Thai", "Japanese", "Chinese", "JapaneseKanji", "Korean", and
  // "SimplifiedChinese".
  //"DefaultEncoding" : "Latin1",
  "DefaultEncoding" : "Windows1251",
ini
  
WEB-интерфейс тут http://ваш ip:8042/app/explorer.html

Подключение к СУБД:

ini
apt-get install default-mysql-server default-mysql-clietn defaultlt-libmysqlclient-dev orthanc-mysql

Увеличиваем размер блока данных:

ini
mcedit my.cnf

max_allowed_packet = 128M

создаем пользователя и бд, подключаемся:

ini
mcedit /etc/orthanc/mysql.json

cat /etc/orthanc/mysql.json 
{
  /**
   * Configuration to use MySQL or MariaDB instead of the default
   * SQLite back-end of Orthanc. You will have to install the
   * "orthanc-mysql" package to take advantage of this feature.
   **/
  "MySQL" : {
    // Enable the use of MySQL to store the Orthanc index?
    "EnableIndex" : true,
    
    // Enable the use of MySQL to store the DICOM files?
    "EnableStorage" : true,
    
    // Parameters of the MySLQ database
    "Host" : "localhost",
    "Port" : 3306,
    "Database" : "orthanc",
    "Username" : "orthanc",
    "UnixSocket" : "/var/run/mysqld/mysqld.sock",
    "Password" : "dDE4dkULEYrbBZxc",
    
    // Optional: Disable the locking of the MySQL database
    "Lock" : true
  }
}

Контроль доступа и отправка на другие модальности:

ini
Orthanc.json

  "LuaScripts" : [
    "/etc/orthanc/lua/access.lua",
    "/etc/orthanc/lua/send.lua"
  ],

"sample" : [ "AE_TITLE", "192.168.1.235", 4006 ]

Lua:

Разрешения выполнять запросы к Orthanc, с помощью этого скрипта можно разграничить права доступа к web интерфейсу Orthanc

ini
cat access.lua
function IncomingHttpRequestFilter(method, uri, ip, username, httpHeaders)
   -- Only allow GET requests for non-admin users

  if method == 'GET' or method == 'POST' then
      return true
   elseif username == 'admin' then
      return true
   else
      return false
   end
end

Можно по ip

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

С помощью этого скрипта можно отправлять снимки которые пришли в Orthanc на другие DICOM сервера или на рабочие станции врачей.

ini
cat send.lua
function OnStoredInstance(instanceId, tags, metadata)
    SendToModality(instanceId, 'sample')
end

С помощью этого скрипта можно разбирать изображение которые приходят на Orthanc и маршрутизировать их на другие сервера.

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

перезапускаем:

ini
services orthanc restart
orthanc.1643682306.txt.gz · Последнее изменение: 2022/02/01 02:25 — sector

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