DICOM - Setup a QRSCP Server with DCMTK

  • 编辑 DCMTK QR 的默认配置文件 vim /usr/etc/dcmtk/dcmqrscp.cfg
#-----------------------------------------------------------------------
#
# Example configuration file for the dcmqrscp and dcmqrti applications.
#
#-----------------------------------------------------------------------
 
#
# Global Configuration Parameters
#
NetworkTCPPort  = 106
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.
#
 
RADIANT         = (RADIANT, dcmclient, 11112)
DVTK_QR_SCU     = (DVTK_QR_SCU, dcmclient, 8103)
DVTK_STR_SCP    = (DVTK_STR_SCP, dcmclient, 8104)
DCMTEST         = RADIANT, DVTK_QR_SCU, DVTK_STR_SCP
 
#
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.
#
"DCM Tester" = DCMTEST
#
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, 2048mb)   ANY
DCMTK_QR_SCP    /home/dicom/db/DCMTEST      RW (500, 5120mb)   DCMTEST
#
AETable END
  • 编辑 /etc/hosts,增加 DICOM 客户端

可以看到在上面的配置文件中将 AETitle 为 DVTK_QR_SCU 的主机指向了 dcmclient,由于在 DCMTK QR 的配置文件不能直接指定IP地址,所以我们需要在hosts文件中指定主机名称。

10.1.2.3 dcmclient
  • 创建数据库目录
mkdir -p ~/db/COMMON ~/db/DCMTEST
  • 创建DICOM索引
dcmqridx -v ~/db/DCMTEST ~/dcmfiles/*.dcm
  • 或者通过脚本建立索引
#!/bin/bash

if [ "$#" != 2 ]; then
    echo $#

    echo "Usage: $(basename $0) DICOM_DIR INDEX_DIR"
    exit 1
fi
 
DICOM_DIR=$1
INDEX_DIR=$2
 
if [ ! -d $DICOM_DIR ]; then
    echo "DICOM directory does not exist `$DICOM_DIR`"
    exit 2
fi
 
if [ ! -f $INDEX_DIR/index.dat ]; then
    echo "No index file found in `$INDEX_DIR`."
    exit 3
fi;
 
find $(pwd $DICOM_DIR) -type f | xargs -I {} echo dcmqridx -v $INDEX_DIR {}