看 DICOM 標准有一段時間了,前面幾篇也介紹了一下 DIMSE-C 消息服務,具體參看Dicom 學習筆記-Dicom 消息服務(DIMSE-C/DIMSE-N),本文就介紹一下 DICOM 標准中的一個重要服務- Worklist 服務。
Worklist 服務簡介
首先來看一下 DICOM 標准中的說明:
A worklist is the structure to present information related to a particular set of tasks. It specifies particular details for each task. The information supports the selection of the task to be performed first, and supports the performance of that task.
意思是 Worklist 是呈現與特定任務組相關信息的結構。它指定每個任務的具體細節。這個信息支持首先要執行的任務的選擇,並支持該任務的執行。
這樣理解起來感覺很困難,那么我們根據實際場景來一步一步的講解這個服務具體是干什么的。我們就以醫院拍片(DR)的場景來講,臨床醫生給患者開具處方單(DR 檢查)后,患者拿着就診卡和這張處方單到達放射科,先要去登記處登記,登記的這個過程是將患者的信息錄入到 RIS 系統,通過就診卡卡號從 HIS 系統中獲取患者信息,然后患者就到候診區等待叫號,檢查設備通過 Worklist 服務從工作流系統獲取待檢查列表,然后通過叫號系統呼叫患者進行檢查。Worklist 服務在這里的作用是避免檢查技師在設備上手動輸入患者的信息,避免了信息輸入錯誤的情況,同時減少了技師的工作量。
Worklist 的流程圖如下:

Worklist 請求
Worklist 其實就是一個 C-Find 請求,不過這個 C-Find 請求指定了 SOP Class UID 為 【1.2.840.10008.5.1.4.31】,這個 SOP Class 就指定了當前的 C-Find 請求是查詢 Worklist,下圖是 Worklist 信息模型的實體關系圖

有關 Worklist 請求的參數構造可詳見 DICOM 標准 PS 3.4 中 Table K.6-1. Attributes for the Modality Worklist Information Model(P219),這里面定義了必填和可選參數:
- Scheduled Procedure Step Model 中,必需的參數有 :
- ScheduledProcedureStepSequence(0040,0100),這個 TAG 里面必填的 TAG 有:
1.1 設備的 AE Title【Scheduled Station AE Title(0040,0001)】;
1.2 計划程序步驟的開始日期和開始時間【Scheduled Procedure Step Start Date(0040,0002)、Scheduled Procedure Step Start Time(0040,0003)】;
1.3 設備【Modality(0008,0060)】(DR、CT etc.);
1.4 執行醫師名稱【Scheduled Performing Physician's Name(0040,0006)】;
- Patient Identification 中,有兩個參數必需:
- 患者姓名【Patient's Name(0010,0010)】;
- 患者 ID【Patient ID(0010,0020)】;
其他的參數均為可選參數。
在實際查詢中,這些必需的參數也可以做模糊匹配查詢,具體匹配的規則有設備方和 Worklist SCP 方互相定義遵循即可;
在實際場景中,有指定查詢某一個患者的,即傳准確的患者姓名和患者 ID,Scheduled Procedure Step Model 做模糊匹配;有通過Scheduled Procedure Step Start Date 和 Scheduled Procedure Step Start Time 結合設備的 AE Title 查詢的;還有通過 Scheduled Procedure Step Start Date 和 Scheduled Procedure Step Start Time 結合 Modality 或執行醫師名稱查詢的,具體可以參看下圖:

Worklist SCU
結合開源 DICOM 庫 fo-dicom 可以非常容易的構造一個 Worklist SCU,fo-dicom 已經在 DicomCFindRequest.cs 中封裝好了創建查詢 Worklist 的條件,只需要如下的代碼即可實現 Worklist SCU。
using Dicom.Network; using System; using System.Collections.Generic;
var worklistItems = new List<DicomDataset>(); var cfind = DicomCFindRequest.CreateWorklistQuery(); // no filter, so query all awailable entries cfind.OnResponseReceived = (DicomCFindRequest rq, DicomCFindResponse rp) => { var dicomDataset = rp.Dataset; if (dicomDataset != null) { Console.WriteLine("Study UID: {0}", dicomDataset.GetSingleValue<string>(DicomTag.StudyInstanceUID)); worklistItems.Add(rp.Dataset); } }; var client = new DicomClient(); client.AddRequest(cfind); client.SendAsync(serverIP, serverPort, false, clientAET, serverAET).GetAwaiter().GetResult(); return worklistItems;
Worklist SCP
Worklist SCP 其實就是一個 C-Find SCP,可以通過派生 DicomService 服務類來實現 Dicom 服務的基本框架,然后實現 IDicomServiceProvider 和 IDicomCFindProvider 接口來實現,但要注意的是在實現 IDicomServiceProvider 接口的 OnReceiveAssociationRequestAsync 方法時需要根據請求發送的 SOP Class UID 過濾,只有值為【1.2.840.10008.5.1.4.31】的請求才同意在建立 Association 連接后接受 C-Find 請求。具體代碼可以參考這里。
Worklist 過程分析
Worklist 請求的交互過程和 C-Find 請求的一樣,都是先通過 A-Associate 請求建立 Association 連接,然后發送 C-Find 請求,最后通過 A-Release 請求釋放 Association 連接。我主要介紹一下它們的區別,一個最主要的區別就是請求中傳輸的 Affected SOP Class UID 不一樣,普通 C-Find 請求中根據查詢的層級 Affected SOP Class UID 分為患者級【Patient Root Query Retrieve Information Model FIND(1.2.840.10008.5.1.4.1.2.1.1)】和檢查級【1.2.840.10008.5.1.4.1.2.2.1(Study Root Query Retrieve Information Model FIND)】,而 Worklist 請求中 C-Find 請求的 Affected SOP Class UID 是【Modality Worklist Information Model FIND(1.2.840.10008.5.1.4.31)】,詳見下圖:

參考
- DICOM 標准 PS 3.4 K Basic Worklist Management Service (Normative)
- DICOM 標准 PS 3.3 C Information Module Definitions (Normative)
- DICOM 標准 PS 3.17 DD Worklists (Informative)
作者:Statmoon
鏈接:https://www.jianshu.com/p/2bc57d1bc0cb
來源:簡書
著作權歸作者所有。商業轉載請聯系作者獲得授權,非商業轉載請注明出處。