Python 是否有办法将DICOM数据发送到远程PACS服务器上的特定目录?
我正在掌握SCU和SCP之间DICOM服务器和图像的通信技巧。我使用的是ClearCanas PACS服务器,可以访问web GUI。使用以下代码,我能够将DICOM dt从SCU(我的计算机)发送到SCP(远程服务器)Python 是否有办法将DICOM数据发送到远程PACS服务器上的特定目录?,python,python-2.7,server,dicom,pydicom,Python,Python 2.7,Server,Dicom,Pydicom,我正在掌握SCU和SCP之间DICOM服务器和图像的通信技巧。我使用的是ClearCanas PACS服务器,可以访问web GUI。使用以下代码,我能够将DICOM dt从SCU(我的计算机)发送到SCP(远程服务器) 我的问题是,是否有办法将对象发送到服务器上的不同目录/在服务器上远程创建目录并将数据发送到不同的目录?通常没有。您无法告诉SCP在其文件系统上从SCU存储数据的位置。简短回答-否 一个较长的答案-DICOM标准不关心任何方式或形式,文件如何存储在PACS服务器上,这取决于实现。
我的问题是,是否有办法将对象发送到服务器上的不同目录/在服务器上远程创建目录并将数据发送到不同的目录?通常没有。您无法告诉SCP在其文件系统上从SCU存储数据的位置。简短回答-否 一个较长的答案-DICOM标准不关心任何方式或形式,文件如何存储在PACS服务器上,这取决于实现。PACS服务器可以使用机器人雕刻工具将它们雕刻在石碑上,并通过OCR读取数据,前提是它仍然能够按照标准接收和发送数据。因此,无法通过DICOM接口影响这些细节 从标准的角度来看,一切都已经按照患者-研究-系列-实例的规模整齐地组织起来,每个级别都有其唯一的ID-s。这些ID-s存储在相关DICOM标签中的每个DICOM文件中,大多数PACS服务器使用数据库跟踪这些ID-s,以便于快速查找。DICOM文件在磁盘上的实际位置也存储在数据库中,但这是内部实现细节,不会通过DICOM接口公开
坦白地说,我不知道这个需求的用例是什么?组织已经存在,您可以使用DICOM界面通过这些属性进行查询。很高兴知道。谢谢。我添加了一些关于在DICOM中使用UID-s的详细信息,我昨天忘记了。
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