public void OnReceiveAssociateAccept(DicomClient client, ClientAssociationParameters association) { if (_type == TestTypes.AssociationReject) { Assert.Fail("Unexpected negotiated association on reject test."); } else if (_type == TestTypes.SendMR) { DicomMessage msg = new DicomMessage(); _test.SetupMR(msg.DataSet); byte id = association.FindAbstractSyntaxWithTransferSyntax(msg.SopClass, TransferSyntax.ExplicitVrLittleEndian); client.SendCStoreRequest(id, client.NextMessageID(), DicomPriority.Medium, msg); } else { Assert.Fail("Unexpected test type"); } }
/// <summary> /// Generic routine to send the next C-STORE-RQ message in the _fileList. /// </summary> /// <param name="client">DICOM Client class</param> /// <param name="association">Association Parameters</param> public bool SendCStore(DicomClient client, ClientAssociationParameters association) { FileToSend fileToSend = _fileList[_fileListIndex]; DicomFile dicomFile = new DicomFile(fileToSend.filename); try { dicomFile.Load(DicomReadOptions.Default); } catch (DicomException e) { Logger.LogErrorException(e, "Unexpected exception when loading DICOM file {0}",fileToSend.filename); return false; } DicomMessage msg = new DicomMessage(dicomFile); byte pcid = association.FindAbstractSyntaxWithTransferSyntax(fileToSend.sopClass, dicomFile.TransferSyntax); if (pcid == 0) { if (dicomFile.TransferSyntax.Equals(TransferSyntax.ImplicitVrLittleEndian)) pcid = association.FindAbstractSyntaxWithTransferSyntax(fileToSend.sopClass, TransferSyntax.ExplicitVrLittleEndian); if (pcid == 0) { Logger.LogError( "Unable to find matching negotiated presentation context for sop {0} and syntax {1}", dicomFile.SopClass.Name, dicomFile.TransferSyntax.Name); return false; } } client.SendCStoreRequest(pcid, client.NextMessageID(), DicomPriority.Medium, msg); return true; }