Worklist為PACS系統其中的一個組件,可以跟HIS的檢查系統連線取得目前所有開立的檢查項目清單,並提供標準的DICOM協定讓醫療設備或第三方影像軟體可以存取這些資訊
在C#中可以使用fo-dicom這個library https://github.com/fo-dicom/fo-dicom
存取Worklist的動作稱為C-Find,在fo-dicom專案上有提供sample
茶包零號
使用fo-dicom 3.0的版本搭配VS2015,fo-dicom 2.x實作的DICOM協定可能會不相容於現在的PACS系統
茶包一號
原始範例使用的是 CreateStudyQuery 這個取得的資料欄位的比較少改用CreateWorklistQuery比較適合
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DicomCFindRequest cfind = DicomCFindRequest.CreateWorklistQuery(scheduledDateTime: new DicomDateRange(DateTime.Now.AddHours(-48),DateTime.Now)); | |
cfind.OnResponseReceived = (DicomCFindRequest req, DicomCFindResponse resp)=>{ | |
if (resp.Dataset == null) { return; } | |
string req_type = resp.Dataset.Get<DicomSequence>(DicomTag.ScheduledProcedureStepSequence).Items[0].Get<string>(DicomTag.Modality); | |
string req_accession = resp.Dataset.Get<string>(DicomTag.AccessionNumber,"---"); | |
string pat_id = resp.Dataset.Get<string>(DicomTag.PatientID,"---"); | |
byte[] big5_name = resp.Dataset.Get<Byte[]>(DicomTag.PatientName, new byte[] { 0x2d, 0x2d, 0x2d }); | |
byte[] name = Encoding.Convert(Encoding.GetEncoding("BIG5"), Encoding.UTF8, big5_name); | |
string pat_name = Encoding.UTF8.GetString(name); | |
DateTime pat_Birth = resp.Dataset.GetDateTime(DicomTag.PatientBirthDate, DicomTag.PatientBirthTime); | |
string pat_sex = resp.Dataset.Get<string>(DicomTag.PatientSex); | |
DateTime req_DT = resp.Dataset.Get<DicomSequence>(DicomTag.ScheduledProcedureStepSequence).Items[0].GetDateTime(DicomTag.ScheduledProcedureStepStartDate, DicomTag.ScheduledProcedureStepStartTime); | |
}; | |
DicomClient client = new DicomClient(); | |
client.AddRequest(cfind); | |
client.Send("SCP-Host", "SCP-Port",false, "SCU-AE", "SCP-AE"); |
茶包二號
C-Find要求就像SQL的Select查詢一下會有要求的欄位名稱,在DICOM中就是TagID
如果需要的TagID不在預設清單中需要修改fo-dicom的程式碼
例如需要取得開立檢查的醫生資訊(RequestingPhysician)
需要修改 \DICOM\Network\DicomCFindRequest.cs 這個檔案的 CreateWorklistQuery 函數內容
茶包三號
如果執行於x86x64的windows系統中使用Desktop的dll即可
使用Portable會需要額外相依的dll (主要是圖型Library)
沒有留言:
張貼留言