def _setup_c_get_assoc(self): ae = AE(ae_title=self.client_ae_title, port=self.client_port) for context in QueryRetrievePresentationContexts: ae.add_requested_context(context.abstract_syntax) for context in StoragePresentationContexts: ae.add_requested_context(context.abstract_syntax) ae.on_c_store = self.on_c_store assoc = ae.associate(self.pacs_ip, self.pacs_port, ae_title=self.pacs_ae_title) return assoc
meta = Dataset() meta.MediaStorageSOPClassUID = dataset.SOPClassUID meta.MediaStorageSOPInstanceUID = dataset.SOPInstanceUID meta.ImplementationClassUID = pynetdicom_uid_prefix ds = FileDataset(filename, {}, file_meta=meta, preamble=b"\0" * 128) ds.update(dataset) ds.is_little_endian = True ds.is_implicit_VR = True ds.save_as(filename) return 0x0000 # Success ae.on_c_store = on_c_store # Send query if assoc.is_established: response = assoc.send_c_get(d, query_model=query_model) time.sleep(1) if response is not None: for value in response: pass assoc.release() # done ae.quit()
def test_on_c_store(self): """Test default callback raises exception""" ae = AE(scu_sop_class=[VerificationSOPClass]) with self.assertRaises(NotImplementedError): ae.on_c_store(None)