def check_send_dicom(self): ts = [ ExplicitVRLittleEndian, ImplicitVRLittleEndian, ExplicitVRBigEndian ] # create application entity with Find and Move SOP classes as SCU and # Storage SOP class as SCP MyAE = AE("DCMTK", 9999, [ PatientRootFindSOPClass, PatientRootMoveSOPClass, VerificationSOPClass ], [StorageSOPClass], ts) MyAE.OnAssociateResponse = OnAssociateResponse MyAE.OnAssociateRequest = OnAssociateRequest MyAE.OnReceiveStore = OnReceiveStore MyAE.start() # remote application entity PrismaAE = dict(Address="134.157.205.1", Port=104, AET="AN_MRC35181") # create association with remote AE self.log.info("Request association on PRISMA") assoc = MyAE.RequestAssociation(PrismaAE) # perform a DICOM ECHO st = assoc.VerificationSOPClass.SCU(1) self.log.info('DICOM Echo done with status "%s"', st) try: self.check_send_dicom_from_remoteAE(assoc) except Exception as e: self.log.warning('CODE ERROR because of %s', e) assoc.Release(0) # AGAIN with VERIO VerioAE = dict(Address="134.157.205.51", Port=104, AET="MRC40527") # create association with remote AE self.log.info("Request association on VERIO") assoc = MyAE.RequestAssociation(VerioAE) # perform a DICOM ECHO st = assoc.VerificationSOPClass.SCU(1) self.log.info('DICOM Echo done with status "%s"', st) #try : self.check_send_dicom_from_remoteAE(assoc) #except Exception as e: # self.log.warning('CODE ERROR because of %s',e) assoc.Release(0) MyAE.Quit()
def check_send_dicom(self): ts = [ ExplicitVRLittleEndian, ImplicitVRLittleEndian, ExplicitVRBigEndian ] # create application entity with Find and Move SOP classes as SCU and # Storage SOP class as SCP MyAE = AE("DCMTK",9999, [PatientRootFindSOPClass, PatientRootMoveSOPClass, VerificationSOPClass], [StorageSOPClass], ts) MyAE.OnAssociateResponse = OnAssociateResponse MyAE.OnAssociateRequest = OnAssociateRequest MyAE.OnReceiveStore = OnReceiveStore MyAE.start() # remote application entity PrismaAE = dict(Address="134.157.205.1", Port=104, AET="AN_MRC35181") # create association with remote AE self.log.info("Request association on PRISMA") assoc = MyAE.RequestAssociation(PrismaAE) # perform a DICOM ECHO st = assoc.VerificationSOPClass.SCU(1) self.log.info('DICOM Echo done with status "%s"', st) try : self.check_send_dicom_from_remoteAE(assoc) except Exception as e: self.log.warning('CODE ERROR because of %s',e) assoc.Release(0) # AGAIN with VERIO VerioAE = dict(Address="134.157.205.51", Port=104, AET="MRC40527") # create association with remote AE self.log.info("Request association on VERIO") assoc = MyAE.RequestAssociation(VerioAE) # perform a DICOM ECHO st = assoc.VerificationSOPClass.SCU(1) self.log.info('DICOM Echo done with status "%s"', st) #try : self.check_send_dicom_from_remoteAE(assoc) #except Exception as e: # self.log.warning('CODE ERROR because of %s',e) assoc.Release(0) MyAE.Quit()
def OnAssociateResponse(association): print "Association response received" print association def OnReceiveStore(SOPclass, DS): assoc = MyAE.RequestAssociation(REMOTEAE) if assoc: assoc.CRImageStorageSOPClass.StoreSCU(DS, 1) assoc.Release(0) return 0 else: return 1 def OnReceiveEcho(self): print "Echo received" if __name__ == '__main__': start_dcmqrscp() MyAE = AE('NETDICOM', 7654, [CRImageStorageSOPClass], [CRImageStorageSOPClass, VerificationSOPClass]) MyAE.OnAssociateRequest = OnAssociateRequest MyAE.OnAssociateResponse = OnAssociateResponse MyAE.OnReceiveStore = OnReceiveStore MyAE.OnReceiveEcho = OnReceiveEcho MyAE.start()