From 33c139cc30ca453accc44fbb9dbf4e435e9679d4 Mon Sep 17 00:00:00 2001 From: mozzie Date: Wed, 26 Apr 2023 10:58:17 +0800 Subject: [PATCH] first commit --- .env | 21 ++ .gitignore | 2 + README.md | 477 ++++++++++++++++++++++++++++++++++++++++++++ config/orthanc.json | 97 +++++++++ docker-compose.yml | 48 +++++ 5 files changed, 645 insertions(+) create mode 100644 .env create mode 100644 .gitignore create mode 100644 README.md create mode 100644 config/orthanc.json create mode 100644 docker-compose.yml diff --git a/.env b/.env new file mode 100644 index 0000000..8bf8d2c --- /dev/null +++ b/.env @@ -0,0 +1,21 @@ +# +# Orthanc 相关 +# + +# 挂载 orthanc.json 配置文件 +ORTHANC_CONFIG=./config/orthanc.json +# 挂载 到本地的 dicom 文件存储,需要关闭数据库插件存储,在 orthanc.json 配置 PostgreSQL->EnableStorage 设为 false +ORTHANC_DB_MNT=./orthanc_db + +# +# PostgreSQL 配置 +# + +# 数据库文件 挂在到本地位置 +POSTGRES_DATA_MNT=./pg_data/data +# 数据库文件 在容器里的路径 +PGDATA=/var/lib/postgresql/data +POSTGRES_DB=orthanc +POSTGRES_PORT=5432 +POSTGRES_USER=orthanc +POSTGRES_PASSWORD=orthanc diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7d123f4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +orthanc_db/* +pg_data/* \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..691ef68 --- /dev/null +++ b/README.md @@ -0,0 +1,477 @@ +# orthanc.json 配置说明 + +## Name + +显示在 Orthanc web 服务的 header 文字 + +## StorageDirectory + +> EnableStorage 为 true 的话,默认是用数据库插件的路径存储。 + +用来指定 Orthanc 存储 DICOM 文件的目录的,它不仅针对 sqlite,也针对其他数据库插件,例如 PostgreSQL 或 MySQL。但是如果使用了数据库插件,你也可以配置它们把 DICOM 文件存储在数据库中,而不是在 StorageDirectory 指定的目录中 + +## IndexDirectory + +用来指定 Orthanc 存储 SQLite 索引的目录,如果没设置,默认使用 `StorageDirectory` 的值,可以优化性能 + +## TemporaryDirectory + +临时文件夹,可以被安全的删除, + +- UNIX-like: "/tmp/Orthanc/ +- windows: "C:/Temp" + +## StorageCompression + +用来指定 Orthanc 是否对 DICOM 文件进行压缩的。如果这个属性设置为 true,Orthanc 会在存储 DICOM 文件之前,使用 gzip 算法对它们进行压缩,以节省磁盘空间。如果这个属性设置为 false,Orthanc 不会对 DICOM 文件进行压缩,而是保持它们的原始传输语法 + +## MaximumStorageSize + +存储大小限制,`0`代表不限制 + +## MaximumPatientCount + +在给定时间可以存储的最大患者数量,`0`代表不限制 + +## LuaScripts [] + +可以嵌入到 Orthanc 中的脚本语言,它可以用来定制 Orthanc 的行为和逻辑,以适应特定的医疗工作流程。你可以使用 lua 脚本来实现以下功能: + +- 响应 Orthanc 的各种事件,例如接收到 DICOM 实例、提交了一个任务、完成了一个任务等。 +- 过滤或修改传入的 DICOM 实例或 REST 请求,例如删除敏感信息、添加元数据、转换传输语法等。 +- 调用 Orthanc 的 REST API 或其他外部服务,例如发送邮件、通知、日志等。 +- 实现自定义的插件或扩展,例如增加新的 REST 端点、提供新的功能或界面等。 + +## Plugins [] + +插件的目录 + +```json +"Plugins": ["/usr/share/orthanc/plugins"] +``` + +## ConcurrentJobs + +> Orthanc <= 1.3.2 ,请设为 1 + +用来指定 Orthanc 可以同时运行的任务(jobs)的最大数量的。任务是一种可以在 Orthanc 中执行的长时间操作,例如转码、导出、修改、删除等。你可以通过 REST API 来创建、查询、取消或删除任务。ConcurrentJobs 属性可以控制 Orthanc 的并发性能和资源消耗,你可以根据你的硬件配置和工作负载来调整这个属性 + +- 设置为 `0`,使用全部的 CPU 核心 + +## HttpServerEnabled + +如果此参数设置为“false”,禁用 REST API。默认 Orthanc 充当纯粹的 DICOM 服务器。 + +## HttpPort + +REST API 服务 web 界面端口 + +## HttpDescribeErrors + +当以下选项为`true`时,如果遇到错误在调用 REST API 时,一条描述错误的 JSON 消息放在 HTTP 响应中 + +## HttpCompressionEnabled + +启用 HTTP 压缩以提高网络带宽利用率 + +支持`gzip`和`deflate` 编码。 + +## DicomServerEnabled + +启用 DICOM 服务器。如果此参数设置为“false”,Orthanc 充当纯粹的 REST 服务器。不能接收文件或通过 DICOM 协议进行查询/检索。 + +## DicomAet + +> Aet:(Application Entity Title) + +用来标识 DICOM 网络节点的字符串,它在 DICOM 通信中起到了类似于 IP 地址或域名的作用。 + +## DicomCheckCalledAet + +用来指定 Orthanc 是否检查传入的 DICOM 连接的应用实体标题(Application Entity Title)的。 + +如果这个属性设置为: + +- true:接受与 `DicomAet` 属性相同的连接 +- false:接受全部连接 + +## DicomPort + +DICOM 服务器的端口 + +## DefaultEncoding + +> 推荐设置 Utf8 || Chinese + +假设的 DICOM 文件的默认编码没有 `SpecificCharacterSet`DICOM 标签,指定 Orthanc 的默认字符编码 + +- Ascii +- Utf8 +- Latin1 +- Latin2 +- Latin3 +- Latin4 +- Latin5 +- Cyrillic: 西里尔字母 +- Windows1251 +- Arabic: 阿拉伯语 +- Greek: 希腊语 +- Hebrew: 希伯来语 +- Thai +- Japanese +- Chinese +- JapaneseKanji +- Korean +- SimplifiedChinese: 简体中文 + +## DeflatedTransferSyntaxAccepted + +> Deflated 压缩是一种基于 Zlib 的无损压缩算法,可以减少 DICOM 文件的大小 + +用来控制是否接受 `Deflated` 压缩的 DICOM 文件 + +## JpegTransferSyntaxAccepted + +用来控制是否接受 JPEG 压缩的 DICOM 文件 + +## JpegLosslessTransferSyntaxAccepted + +用来控制是否接受 JPEG 无损压缩的 DICOM 文件 + +## JpipTransferSyntaxAccepted + +> JPIP 是一种基于网络的交互式图像传输协议,可以实现图像的渐进式加载和区域访问 + +控制是否接受 JPIP 压缩的 DICOM 文件 + +## Mpeg2TransferSyntaxAccepted + +> MPEG-2 是一种用于视频和音频的压缩标准,可以实现高质量的多媒体传输 + +用来控制是否接受 `MPEG-2` 压缩的 DICOM 文件 + +## RleTransferSyntaxAccepted + +> RLE 是一种无损压缩算法,可以减少 DICOM 文件的大小 + +是否接受 RLE 压缩的 DICOM 文件 + +## UnknownSopClassAccepted + +> SOP 类是一种定义了 DICOM 服务类型和信息对象类型的标识符 + +用来控制是否接受未知的存储 SOP 类的 DICOM 文件 + +## DicomScpTimeout + +作为 C-Store SCP 传输超时设计 + +## RemoteAccessAllowed + +用来控制是否允许远程主机连接到 HTTP 服务器 + +## SslEnabled + +是否启用 SSL 加密 + +## SslCertificate + +指定 SSL 证书的路径 + +## AuthenticationEnabled + +> 设为 false 无需密码登录 + +是否启用`用户名密码`登录。从 Orthanc 1.5.8 开始,默认启用,需要开启`RemoteAccessAllowed` + +## RegisteredUsers + +访问 `8042 web`需要输入的账号密码,如果为 `{}`,直接访问 + +```json +"RegisteredUsers": { + // 用户1 + "demo": "demo", + // 用户2 + "hm": "27516120" +}, +``` + +## DicomModalities + +用来配置已知的 DICOM 设备的列表的,每个设备需要指定: + +1. 一个符号名称,AET(应用实体标题) +2. IP 地址 +3. 端口号 + +这样就可以通过`DICOM commands (C-ECHO,C-STORE, C-FIND, C-MOVE...)`与这些设备进行 DICOM 通信。 + +```json +"demo": [ + "HM-ORTHANC", + "192.168.1.126", + 4242 +], +"ohif" : [ "OHIFDCM", "viewer", 3000 ] +``` + +## DicomModalitiesInDatabase + +是否将 DICOM 模式存储在 Orthanc 数据库中,而不是在此配置文件中(Orthanc 1.5.0 中的新增) + +## DicomAlwaysAllowEcho + +Orthanc SCP 是否允许传入的 `C-Echo` 请求,只有`Orthanc 1.3.0`默认为 false + +## DicomAlwaysAllowStore + +Orthanc SCP 是否允许传入的 `C-Store` 请求 + +## DicomCheckModalityHost + +Orthanc 是否检查远程的 IP/主机名地址,启动 DICOM 连接的模式 + +## DicomScuTimeout + +远程 DICOM SCP(服务器)没有回答的,超时就关闭,单位 `seconds` + +# OrthancPeers + +用来配置已知的 Orthanc 服务器的列表的,每个服务器需要指定一个符号名称,以及其基本 URL,可能还需要用户名和密码(如果该服务器启用了密码保护的话)。可以通过 HTTP/HTTPS 协议与这些服务器进行资源的发送和接收。 + +```json + "OrthancPeers": { + "peer" : [ "http://127.0.0.1:8043/", "alice", "alicePassword" ] + "peer2" : [ "http://127.0.0.1:8044/" ] + "peer3" : { + "Url" : "http://127.0.0.1:8043/", + "Username" : "alice", + "Password" : "alicePassword", + "HttpHeaders" : { "Token" : "Hello world" }, + "CertificateFile" : "client.crt", + "CertificateKeyFile" : "client.key", + "CertificateKeyPassword" : "certpass", + "Pkcs11" : false + } + }, +``` + +## OrthancPeersInDatabase + +是否将`peers`存在数据库中 + +## HttpProxy + +网络访问受限的情况下,可以使用 配置 http 代理 + +## HttpVerbose + +是否在日志中显示 Orthanc 发出的 HTTP 请求的详细信息的 + +## HttpTimeout + +http 服务请求超时时间,单位 `seconds` + +## HttpsVerifyPeers + +`peers`在 http 通信过程中 是否校验`ssl证书` + +## HttpsCACertificates + +`peers` 通信证书的路径,证书必须采用 PEM 格式,基于 Debian 的系统,此选项可以设置为`/etc/ssl/certs/ca-certificates.crt` + +## UserMetadata + +用来定义用户自定义元数据的字典,将一个介于 1024 和 65535 之间的数字映射到一个唯一的字符串。这个选项可以用于为 DICOM 资源添加一些额外的信息,例如患者的电话号码或者检查的费用 + +## UserContentType + +`MIME`限制 + +## StableAge + +定义一个 DICOM 资源被认为是稳定的所需的最小生命周期(以`秒`为单位) + +## StrictAetComparison + +避免在资源还在接收过程中就被处理或者导出。`Aet`名称严格要求`大小写`相同 + +## StoreMD5ForAttachments + +> 默认为 true + +是否为每个附件计算并存储 MD5 校验,检测附件是否被篡改或者损坏,但是会增加一些存储空间和计算时间的开销 + +## LimitFindResults + +> 默认为 0,不限制 + +响应 `C-Find` 请求时返回的最大结果数 + +## LimitFindInstances + +> 默认为 0,不限制 + +响应 `C-Find` 请求时返回的最大实例数 + +## LimitJobs + +> 可以用于控制 Orthanc 的并发性能,但是也会增加内存和 CPU 的消耗 + +给定时间同时运行的最大处理任务数的,如果设置为 0,则表示使用所有可用的 CPU 逻辑核心。 + +## LogExportedResources + +LogExportedResources 参数是用来控制是否在日志中记录导出到其他 DICOM 设备或者 Orthanc 节点的资源的 + +## KeepAlive + +用来控制是否启用 HTTP 长连接的,这个选项可以用于提高 HTTP 通信的效率,但是也会占用更多的网络资源 + +## TcpNoDelay + +是否禁用 TCP 延迟算法,如果设置为 true,则表示禁用 + +## HttpThreadsCount + +> 这个选项可以用于控制 Orthanc 的并发性能,但是也会增加内存和 CPU 的消耗 + +用来控制处理 HTTP 请求的线程数的,如果设置为 0,则表示使用所有可用的 CPU 逻辑核心。 + +## StoreDicom + +如果此选项设置为`false`,Orthanc 将仅在索引中运行模式。DICOM 文件不会存储在驱动器上。 + +> 此选项可能会阻止升级到较新版本的 Orthanc + +## DicomAssociationCloseDelay + +> 避免过早地关闭 DICOM 关联,导致一些设备无法发送后续的 DICOM 文件 + +在没有收到进一步的 `DIMSE` 命令后,Orthanc 作为 C-Store SCP 关闭 DICOM 关联的延迟时间(以秒为单位) + +## QueryRetrieveSize + +查询/检索 DICOM 请求的最大数量 + +## CaseSensitivePN + +> 默认情况下,搜索是不区分大小写 + +处理 C-Find SCP 请求时,将此标志设置为`true`,将为 PN 值表示启用区分大小写的匹配(如患者姓名)。 + +## Pkcs11 + +硬件安全模块(HSM)进行 HTTPS 客户端身份验证时的智能卡 + +```json +"Pkcs11": { + "Module" : "/usr/local/lib/libbeidpkcs11.so", + "Module" : "C:/Windows/System32/beidpkcs11.dll", + "Pin" : "1234", + "Verbose" : true +} +``` + +## LoadPrivateDictionary + +> 以用于避免与用户自定义的私有 DICOM 标签冲突,但是也会导致一些私有 DICOM 标签无法识别 + +是否加载 Orthanc 自带的私有 DICOM 标签字典的 + +## Locale + +> 可以用于支持不同语言和字符集的人名,但是也会影响排序和检索的结果 + +指定 Orthanc 使用的区域设置的,目前只用于比较人名(PN)类型的 DICOM 标签。 + +## Dictionary + +> 可以用于扩展 Orthanc 支持的 DICOM 标签,但是也要注意避免与现有的 DICOM 标准或者私有字典冲突 + +定义用户自定义的 DICOM 标签字典的,每个条目必须将一个十六进制的标签编号映射到一个字符串,表示该标签的 VR(值表示)和名称。 + +```json +"Dictionary": { + "0008,0005": ["SpecificCharacterSet", "GB18030", 1, 1] + "0014,1020" : [ "DA", "ValidationExpiryDate", 1, 1 ] + "00e1,10c2" : [ "UI", "PET-CT Multi Modality Name", 1, 1, "ELSCINT1" ] + "7053,1003" : [ "ST", "Original Image Filename", 1, 1, "Philips PET Private Group" ] + "2001,5f" : [ "SQ", "StackSequence", 1, 1, "Philips Imaging DD 001" ] +} +``` + +## SynchronousCMove + +是否同步运行 DICOM C-Move 操作 + +## JobsHistorySize + +保存在内存中的已完成作业的最大数量 + +## SaveJobs + +> 默认 true + +是否将作业保存到 Orthanc 数据库中。挂起/正在运行/完成的作业是如果 Orthanc 停止,则自动从数据库重新加载然后`重新启动` + +## OverwriteInstances + +> 默认 false,不覆盖 + +指定 Orthanc 在接收 DICOM 实例,是否覆盖 + +## MediaArchiveSize + +ZIP/媒体档案的最大数量 + +## StorageAccessOnFind + +> 默认 Always,允许 Orthanc 在需要时立即读取存储区域 + +C-FIND 期间,指定 Orthanc 如何访问存储的性能设置 + +## MetricsEnabled + +是否启用 `Prometheus` 兼容的指标接口的,如果设置为 true,则表示启用。用于监控 Orthanc 的运行状态和性能,但是也会增加一些内存和 CPU 的消耗 + +## ExecuteLuaEnabled + +> 默认情况下禁用 + +是否启用了对 URI`/tools/execute-script`的调用。Orthanc 1.5.8,出于安全考虑 + +## HttpRequestTimeout + +以秒为单位设置 HTTP 请求的超时,这个参数对应于 `Mongoose/Civetweb` 的 `request_timeout_ms` 也有影响 + +## DicomWeb + +```json +"DicomWeb":{ + "Enable": true, // 是否开启 Enable + "Root": "/dicom-web/", // DICOMweb API的根URI(适用于QIDO-RS、STOW-RS和WADO-RS) + "EnableWado": true, // 是否启用WADO-URI(以前称为WADO)支持 + "WadoRoot": "/wado", // WADO-URI的根URI(又名WADO)API + "Ssl": false, // ssl 开启 + "QidoCaseSensitive": true, // 对于QIDO-RS服务器,搜索是否区分大小写(自版本0.5起) + "Host": "localhost", // WADO-RS请求的 host + "StudiesMetadata": "Full", // 如何检索 研病例级元数据 + "SeriesMetadata": "Full" // 如何检 索序列级元数据 +} +``` + +## PostgreSQL + +```json +"PostgreSQL": { + "EnableIndex": true, + "EnableStorage": true, // 启用或禁用PostgreSQL存储插件。如果设置为true,Orthanc将把它接收到的DICOM文件存储为PostgreSQL数据库中的大对象。如果设置为false,Orthanc将继续使用默认的文件系统存储区域。对应的是 StorageDirectory属性的路径,也就是DICOM文件存储在/var/lib/orthanc/db/ 里 + "Host": "postgres", // PostgreSQL容器的host,对应 docker 的 container_name + "Port": 5432, // PostgreSQL容器服务的端口 + "Database": "orthanc", // PostgreSQL容器数据库名称 + "Username": "orthanc", // PostgreSQL容器数据库用户名 + "Password": "orthanc" // PostgreSQL容器数据库密码 +} +``` diff --git a/config/orthanc.json b/config/orthanc.json new file mode 100644 index 0000000..162e448 --- /dev/null +++ b/config/orthanc.json @@ -0,0 +1,97 @@ +{ + "Name": "DICOM PACS", + "StorageDirectory": "/var/lib/orthanc/db", + // "IndexDirectory": "", + "StorageCompression": true, + "MaximumStorageSize": 0, + "MaximumPatientCount": 0, + "LuaScripts": [], + "Plugins": [ + "/usr/share/orthanc/plugins" + ], + "ConcurrentJobs": 0, + "HttpServerEnabled": true, + "HttpPort": 8042, + "HttpDescribeErrors": true, + "HttpCompressionEnabled": true, + "DicomServerEnabled": true, + "DicomAet": "DICOM-ORTHANC", + "DicomCheckCalledAet": false, + "DicomPort": 4242, + "DefaultEncoding": "Utf8", + "DeflatedTransferSyntaxAccepted": true, + "JpegTransferSyntaxAccepted": true, + "Jpeg2000TransferSyntaxAccepted": true, + "JpegLosslessTransferSyntaxAccepted": true, + "JpipTransferSyntaxAccepted": true, + "Mpeg2TransferSyntaxAccepted": true, + "RleTransferSyntaxAccepted": true, + "UnknownSopClassAccepted": false, + "DicomScpTimeout": 30, + "RemoteAccessAllowed": true, + "SslEnabled": false, + "SslCertificate": "certificate.pem", + "AuthenticationEnabled": false, + "RegisteredUsers": {}, + "DicomModalities": {}, + "DicomModalitiesInDatabase": false, + "DicomAlwaysAllowEcho": true, + "DicomAlwaysAllowStore": true, + "DicomCheckModalityHost": false, + "DicomScuTimeout": 10, + "OrthancPeers": {}, + "OrthancPeersInDatabase": false, + "HttpProxy": "", + "HttpVerbose": false, + "HttpTimeout": 60, + "HttpsVerifyPeers": true, + "HttpsCACertificates": "", + "UserMetadata": {}, + "UserContentType": {}, + "StableAge": 60, + "StrictAetComparison": false, + "StoreMD5ForAttachments": true, + "LimitFindResults": 0, + "LimitFindInstances": 0, + "LimitJobs": 20, + "LogExportedResources": false, + "KeepAlive": true, + "TcpNoDelay": true, + "HttpThreadsCount": 50, + "StoreDicom": true, + "DicomAssociationCloseDelay": 5, + "QueryRetrieveSize": 100, + "CaseSensitivePN": false, + "LoadPrivateDictionary": true, + "Locale": "en_US.UTF-8", + "Dictionary": {}, + "SynchronousCMove": true, + "JobsHistorySize": 10, + "SaveJobs": true, + "OverwriteInstances": false, + "MediaArchiveSize": 1, + "StorageAccessOnFind": "Always", + "MetricsEnabled": true, + "ExecuteLuaEnabled": false, + "HttpRequestTimeout": 30, + "DicomWeb": { + "Enable": true, + "Root": "/dicom-web/", + "EnableWado": true, + "WadoRoot": "/wado", + "Ssl": false, + "QidoCaseSensitive": true, + "Host": "localhost", + "StudiesMetadata": "Full", + "SeriesMetadata": "Full" + }, + "PostgreSQL": { + "EnableIndex": true, + "EnableStorage": false, + "Host": "postgres", + "Port": 5432, + "Database": "orthanc", + "Username": "orthanc", + "Password": "orthanc" + } +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9b5fd6f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,48 @@ +version: '3.6' + +services: + orthanc: + image: osimis/orthanc:20.11.2 + container_name: orthanc + depends_on: + - postgres + restart: always + ports: + - '8042:8042' + - '4242:4242' + volumes: + # 挂载orthanc.json配置 + - ${ORTHANC_CONFIG}:/etc/orthanc/orthanc.json:ro + # 不使用 postgre 存储 dicom,挂载出来到 ${ORTHANC_DB_MNT},更健康 + - ${ORTHANC_DB_MNT}:/var/lib/orthanc/db + environment: + - DICOM_WEB_PLUGIN_ENABLED=true + - POSTGRESQL_PLUGIN_ENABLED=true + - TZ=Asia/Shanghai + command: /etc/orthanc/orthanc.json + logging: + driver: "json-file" + options: + max-size: "800m" + + postgres: + image: postgres:13.1 + container_name: postgres + restart: always + ports: + - '5432:5432' + volumes: + # postgrel->data 挂载出来 + - ${POSTGRES_DATA_MNT}:${PGDATA} + environment: + - PGDATA=${PGDATA} + - POSTGRES_DB=${POSTGRES_DB} + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + - TZ=Asia/Shanghai + logging: + driver: "json-file" + options: + max-size: "800m" + + \ No newline at end of file