Is there a way to send DICOM data to specific directories on remote PACS server?

时间:2018-06-04 16:53:48

标签: python python-2.7 server dicom pydicom

I am getting a hang of communication between SCU and SCP for DICOM servers and images. I am using a ClearCanas PACS server and have access to the web GUI. Using the following code, I am able to send DICOM dt from SCU(my computer) to SCP(remote server)

import sys
import argparse
from netdicom import AE
from netdicom.SOPclass import StorageSOPClass, VerificationSOPClass
from dicom.UID import ExplicitVRLittleEndian, ImplicitVRLittleEndian, \
    ExplicitVRBigEndian
from dicom import read_file


# parse commandline
parser = argparse.ArgumentParser(description='storage SCU example')
parser.add_argument('remotehost')
parser.add_argument('remoteport', type=int)
parser.add_argument('file', nargs='+')
parser.add_argument('-aet', help='calling AE title', default='PYNETDICOM')
parser.add_argument('-aec', help='called AE title', default='REMOTESCU')
parser.add_argument('-implicit', action='store_true',
                    help='negociate implicit transfer syntax only',
                    default=False)
parser.add_argument('-explicit', action='store_true',
                    help='negociate explicit transfer syntax only',
                    default=False)

args = parser.parse_args()

if args.implicit:
    ts = [ImplicitVRLittleEndian]
elif args.explicit:
    ts = [ExplicitVRLittleEndian]
else:
    ts = [
        ExplicitVRLittleEndian,
        ImplicitVRLittleEndian,
        ExplicitVRBigEndian
    ]

# call back


def OnAssociateResponse(association):
    print "Association response received"

# create application entity
MyAE = AE(args.aet, 0, [StorageSOPClass,  VerificationSOPClass], [], ts)
MyAE.OnAssociateResponse = OnAssociateResponse

# remote application entity
RemoteAE = dict(Address=args.remotehost, Port=args.remoteport, AET=args.aec)

# create association with remote AE
print "Request association"
assoc = MyAE.RequestAssociation(RemoteAE)

if not assoc:
    print "Could not establish association"
    sys.exit(1)
# perform a DICOM ECHO, just to make sure remote AE is listening
print "DICOM Echo ... ",
st = assoc.VerificationSOPClass.SCU(1)
print 'done with status "%s"' % st

# create some dataset
for ii in args.file:
    print
    print ii
    d = read_file(ii)
    print "DICOM StoreSCU ... ",
    try:
        st = assoc.SCU(d, 1)
        print 'done with status "%s"' % st
    except:
        raise
        print "problem", d.SOPClassUID
print "Release association"
assoc.Release(0)

# done
MyAE.Quit

My question is, is there a way to send the objects to different directories on the server / make directories remotely on the server and send the data to different directories?

2 个答案:

答案 0 :(得分:1)

简短回答 -

更长的答案 - DICOM标准不以任何方式或形式关注文件如何存储在PACS服务器上,而是留给实现。 PACS服务器可以使用机器人雕刻工具将它们雕刻在石碑上并用OCR读取,如果它仍然可以按照标准接收和发送它们。因此,无法通过DICOM界面影响这些细节。

从标准的角度来看 - 一切都已经按照患者 - 学习 - 系列 - 实例的规模进行了整齐划分,其中每个级别都有唯一的ID-s。这些ID存储在相关DICOM标签中的每个DICOM文件中,并且大多数PACS服务器使用数据库跟踪这些ID,以便于快速查找。磁盘上DICOM文件的实际位置也存储在数据库中,但这是内部实现细节,不会通过DICOM接口公开。

坦率地说 - 我还不知道这个要求的用例是什么?组织已存在,您可以使用DICOM界面通过这些属性进行查询。

答案 1 :(得分:0)

一般没有。您无法告诉SCP在其文件系统中存储来自SCU的数据。