본문 바로가기
Engineering/DICOM, DIMSE Protocol, HL7

dcmtk : dcmqrscp 로 DICOM Query/Retrieve 테스트 (C-FIND, C-MOVE)

by 알탱2 2022. 2. 7.
반응형

dcmtk 를 활용하여 DICOM Query/Retrieve를 사용해야하는 상황이 있었는데, 이전에는 scu역할(client)만 필요하여 findscu, movescu를 활용한 적이 있있다. 하지만 이번엔 findscu, movescu의 scp역할(server)이 필요하게 되어 검색을 하다보니 dcmqrscp를 활용할 수 있어 보여 테스트를 해보았다.

 

** dcmtk 설치하는 방법은 생략한다. 다른 포스트에서 진행하고 추후 링크로 대체할 예정이다.

 

 

0. DCMQRIDX로 검색될 DICOM의 index 정보를 생성

dcmqrscp에서 AETable 설정 영역에 dicom이 포함된 Storage Path 정보를 입력할 예정이다.

해당 Path에 index.bat 파일에서 index 정보를 파싱하여 file을 찾게 되는데, index.bat 파일에 dicom 정보를 하나하나 등록을 해줘야하는 것으로 보인다.

** dcmqrscp를 실행하면 기본적으로 index.bat 파일이 생기는데, dcmqridx로 dicom을 등록해주기 전엔 의미없는 파일이라 삭제해도 상관없다.

 

(1) a.dcm 파일의 index 등록 Command : 

dcmqridx {index.bat 파일 생성 경로} {등록하려는 dicom filepath}
dcmqridx /home/qrtest/dcm/ /home/qrtest/dcm/a.dcm
  • dcmqrscp에서 AETable 설정 영역에 dicom이 포함된 Storage Path 정보를 입력할 예정이다.
  • 해당 Path에 index.bat 파일에서 index 정보를 파싱하여 file을 찾게 되는데, index.bat 파일에 dicom 정보를 하나하나 등록을 해줘야하는 것으로 보인다.

 

1. DCMQRSCP 실행하기

(1) 설정 파일 위치 : (dcmtk 설치 시, 기본 cfg 경로)

/usr/local/etc/dcmtk/dcmqrscp.cfg

(2) 설정 파일 내용 : 

# 주요 변경 설정 항목들
NetworkTCPPort : dcmqrscp 의 LISTEN Port
HostTable : BEGIN과 END 사이에 설정하며, C-MOVE 요청 시, dicom 전송 목적지 정보를 추가
AETable : BEDIN과 END 사이에 설정하며, findscu/movescu 에서 -aec 옵션인 Called AETitle 정보에 넣어줄 AETitle과 정보 제공할 dicom이 존재하는 Storage Path 맵핑 정보를 추가
#-----------------------------------------------------------------------
#
# Example configuration file for the dcmqrscp and dcmqrti applications.
#
#-----------------------------------------------------------------------
#
# Global Configuration Parameters
#
NetworkTCPPort = 109
MaxPDUSize = 16384
MaxAssociations = 16
#
# Default settings for specific character set behavior:
# SpecificCharacterSet = fallback
#
# Uncomment to override response character set with UTF-8 and enable
# transliteration and discarding of unsupported characters:
# SpecificCharacterSet = "ISO_IR 192", override, discard, transliterate
#
# UserName = <not used>
# GroupName = <not used>
HostTable BEGIN
#
# The HostTable defines symbolic names for collections of network
# DICOM Application Entities. A symbolic name can represent a single
# application entity or it can represent a group of application entities.
# Each DICOM application entity is defined by a triple consisting of
# Application Entity Title, host name and TCP/IP port number.
#
# Entry Format: SymbolicName = ( AETitle, HostName, Portnumber ), ... |
# SymbolicName = SymbolicName, ...
#
# NOTE: in the current implementation you cannot substitute an IP address
# for a hostname.
#
acme1 = (ACME1, acmehost1, 5678)
acme2 = (ACME2, acmehost2, 5678)
acmeCTcompany = acme1, acme2
united1 = (UNITED1, unitedhost1, 104)
united2 = (UNITED2, unitedhost2, 104)
unitedMRcompany = united1, united2
# jinakim : move destination
storescp = (JINAKIM_QR, vm-centos7, 10009)
#
HostTable END
VendorTable BEGIN
#
# The VendorTable is used by the dcmqrdb and dcmqrti applications.
# You can give a vendor name (r.h.s. entry below) to the dcmqrti
# program and it will talk to all hosts and AEs of the vendor.
# The dcmqrdb program can use the vendor table to restrict move destination
# to hosts belonging to a vendor.
# Also, the dcmqrti and dcmqrdb programs use the name defined on the left hand side
# as the vendor name to display above images.
#
# The format:
# VendorName = SymbolicName
# The symbolic name should be defined in the HostTable.
#
"Acme CT Company" = acmeCTcompany
"United MR Company" = unitedMRcompany
#
VendorTable END
AETable BEGIN
#
# Each row of the AETable defines an Application Entities (AE) Title known
# to the dcmqrdb application. Each AE Title represents a separate
# image database located in the specified file system directory (storage area).
# Each AE Title has read/write, quota and peer access restrictions.
#
# Entry Format: AETitle StorageArea Access Quota Peers
# AccessFormat: R | RW | W
# Quota Format: ( maxStudies, maxBytesPerStudy )
# Peers Format: ( Hostname, AETitle, Portnumber ), ... |
# Entry in HostTable |
# ANY
#
#COMMON /home/dicom/db/COMMON R (200, 1024mb) ANY
#ACME_STORE /home/dicom/db/ACME_STORE RW (9, 1024mb) acmeCTcompany
#UNITED_STORE /home/dicom/db/UNITED_STORE RW (9, 1024mb) unitedMRcompany
# jinakim : findscu -aec JINAKIM
JINAKIM /home/qrtest/dcm/ RW (200, 1024mb) ANY
#
AETable END
view raw dcmqrscp.cfg hosted with ❤ by GitHub

(3) 실행 Command : 

** 더 많은 옵션은 dcmqrscp --help를 통해 추가하도록 한다.

dcmqrscp -ll info

 

 

2. FINDSCU로 a.dcm 조회하기

-S : 결과를 study 단위로.
-k "0000,0000=string" : keyword 검색 0000,0000 tag에 string이라는 value가 포함된 조건으로 검색
-aec : Called AETitle 정보로, dcmqrscp.cfg에 AETable에 명시된 값만 허용됨
findscu -S -k "0008,0052=STUDY" -k "0010,0020=20190101000001" -aec JINAKIM 10.120.1.40 109 -ll info

findscu로 2개의 dicom-data-set이 검색된 결과

 

 

3. MOVESCU로 a.dcm을 원격지 STORESCP에 전송 요청하기

3.1 C-MOVE 요청을 통해 검색 결과 dicom을 수신할 storescp 실행

dcmqrscp.cfg에 HostTable 에 명시된 값과 일치 하도록 실행
storescp +xa +uf -xs -od /home/qrtest/recv/ --aetitle JINAKIM_QR 10009 -fe .dcm

 

 

3.2 movescu로 C-MOVE 요청

-S : 결과를 study 단위로..
-k "0000,0000=string" : keyword 검색 0000,0000 tag에 string이라는 value가 포함된 조건으로 검색
-aec : Called AETitle 정보로, dcmqrscp.cfg에 AETable에 명시된 값만 허용됨
-aem : Move destination AETitle 정보로, dcmqrscp.cfg에 HostTable에 명시된 값과 일치 해야 함
movescu -S -k "0008,0052=STUDY" -k 0020,000d=1.2.345.678900.1234567890.1 -aec JINAKIM -aem JINAKIM_QR 10.120.1.40 109 -ll info

 

반응형

댓글