Exemplo n.º 1
0
    print "Association response received"


# create application entity
MyAE = AE('localhost', 9999, [RTPlanStorageSOPClass, VerificationSOPClass], [])
MyAE.OnAssociateResponse = OnAssociateResponse

# remote application entity
RemoteAE = {'Address': 'localhost', 'Port': 2000, 'AET': 'OFFIS_AE'}

# create some dataset
d = dicom.read_file(os.path.join(testfiles_dir(), "rtplan.dcm"))

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

# perform a DICOM ECHO
# time.sleep(2)
print "DICOM Echo ... ",
st = assoc.VerificationSOPClass.SCU(1)
print 'done with status "%s"' % st

# send dataset using RTPlanStorageSOPClass
# time.sleep(2)
print "DICOM StoreSCP ... ",
st = assoc.RTPlanStorageSOPClass.SCU(d, 1)
print 'done with status "%s"' % st

print "Release association"
assoc.Release(0)