DICOM Network Communication
DICOM是一個TCP的protocol,也就是說當TCP連線建立後,資料可持續的傳輸。即使一次性的傳遞多個dcm files也是可以的。
DICOM傳輸起始於建立一個TCP連線,接著用association確認是否可以傳輸資料。取得確認後就可以開始傳輸資料,最後結束association以及斷掉開TCP連線。大致上像下圖所示。
它跟Restful HTTP的不同點是,在一次association期間可以多次傳輸資料,而且每一筆傳輸都會有response。所以,有可能一次傳輸10個dcm files但是8筆成功2筆失敗。
DICOM network protocol裡並沒有連線驗證帳號密碼之類的東西,所以在association階段必須提供足以識別的資訊供Server side辨識。這其中有幾個非常重要的參數。
- IP & Port: TCP一定要IP & port
- Called AE Title: Server識別碼 (我要找誰)
- Calling AE Title: Client識別碼 (我是誰)
- Command: C-Store, C-Find, C-Move, C-Get …
透過Called AE Title,server side可以知道你有沒有找錯人。Calling AE Title則表明了你是誰,server side可以檢查此人是否可以執行此command。如果檢查不通過Server就會回一個A-ASSOCIATE-RJ。
通過assoiation之後,client就可以把資料一筆一筆上傳(假設是C-Store)。每一筆的資料上傳都會得到一筆資料回覆。在這之間client也可以用A-ABORT中斷傳輸。
如果一切正常,資料傳輸完畢後,client發出A-RELEASE-RQ,代表這次的association要結束了。然後斷開TCP連線。
Get Prins Wu’s stories in your inbox
Join Medium for free to get updates from this writer.
如果你想測試一下DICOM的話,網路上有免費的DICOM Server可供你做簡單的測試。相關網址如下。
假設你裝好dcmtk了,你可以執行以下的C-Find command做簡單的測試。
findscu www.dicomserver.co.uk 11112 -v -d -P -aet CALLING_AE -aec CALLED_AE -k 0008,0052=PATIENT -k 0010,0020="PAT004" -k 0010,0010=- DICOM Server: www.dicomserver.co.uk
- Port: 11112
- -v: verbose mode, print processing details
- -d: debug mode, print debug information
- -P: use patient root information model
- -aet: aetitle: string set my calling AE title (default: FINDSCU)
- -aec: aetitle: string set called AE title of peer (default: ANY-SCP)
- -k 0008,0052=PATIENT: Patient level query
- -k 0010,0020=”PAT004": query by the patient id = “PAT004”
- -k 0010,0010=: query back patient name column
執行該command之後會得到如下的結果。
如果有多筆結果的話,就會有多個C-FIND-RSP。



