コード例 #1
0
ファイル: ImageViewerMoveScu.cs プロジェクト: nhannd/Xian
        public override void OnReceiveResponseMessage(DicomClient client, ClientAssociationParameters association, byte presentationID, ClearCanvas.Dicom.DicomMessage message)
        {
            base.OnReceiveResponseMessage(client, association, presentationID, message);

            if (message.Status.Status == DicomState.Warning)
            {
                DicomStatus status = DicomStatuses.LookupQueryRetrieve(message.Status.Code);
                _errorDescriptionDetails = String.Format("Remote server returned a warning status ({0}: {1}).",
                     RemoteAE, status.Description);
            }
        }
コード例 #2
0
ファイル: CFindSCU.cs プロジェクト: nhannd/Xian
        public void Query(string remoteAE, string remoteHost, int remotePort)
        {

            IPAddress addr = Dns.GetHostAddresses(remoteHost)[0];
            ClientAssociationParameters _assocParams = new ClientAssociationParameters(AETitle, remoteAE, new IPEndPoint(addr, remotePort));

            byte pcid = _assocParams.AddPresentationContext(SopClass.StudyRootQueryRetrieveInformationModelFind);
            _assocParams.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrLittleEndian);
            _assocParams.AddTransferSyntax(pcid, TransferSyntax.ImplicitVrLittleEndian);

            _dicomClient = DicomClient.Connect(_assocParams, this);

        }
コード例 #3
0
        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");
            }
        }
コード例 #4
0
ファイル: VerificationScu.cs プロジェクト: khaha2210/radio
        /// <summary>
        /// Sends verification request to specified Remote Dicom Host.
        /// </summary>
        /// <param name="clientAETitle"></param>
        /// <param name="remoteAE"></param>
        /// <param name="remoteHost"></param>
        /// <param name="remotePort"></param>
        /// <returns></returns>
        public VerificationResult Verify(string clientAETitle, string remoteAE, string remoteHost, int remotePort)
        {
            if (_dicomClient == null)
            {
                // TODO: Dispose...
                _dicomClient = null;
            }

            Logger.LogInfo("Preparing to connect to AE {0} on host {1} on port {2} for verification.", remoteAE, remoteHost, remotePort);
            try
            {
                IPAddress addr = null;
                foreach (IPAddress dnsAddr in Dns.GetHostAddresses(remoteHost))
                    if (dnsAddr.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                    {
                        addr = dnsAddr;
                        break;
                    }
                if (addr == null)
                {
                    Logger.LogError("No Valid IP addresses for host {0}", remoteHost);
                    _verificationResult = VerificationResult.Failed;
                }
                else
                {
                    _assocParams = new ClientAssociationParameters(clientAETitle, remoteAE, new IPEndPoint(addr, remotePort));

                    SetPresentationContexts();

                    _verificationResult = VerificationResult.Failed;
                    _dicomClient = DicomClient.Connect(_assocParams, this);
                    ProgressEvent.WaitOne();
                }
            }
            catch (Exception e)
            {
                Logger.LogErrorException(e, "Unexpected exception trying to connect to Remote AE {0} on host {1} on port {2}", remoteAE, remoteHost, remotePort);
            }
            return _verificationResult;
        }
コード例 #5
0
 public void OnReceiveRequestMessage(DicomClient client, ClientAssociationParameters association, byte presentationID, DicomMessage message)
 {
     Assert.Fail("Incorrectly received OnReceiveRequestMessage callback");
 }
コード例 #6
0
ファイル: StorageScu.cs プロジェクト: khaha2210/radio
        public void OnReceiveResponseMessage(DicomClient client, ClientAssociationParameters association, byte presentationID, DicomMessage message)
        {
            if (message.Status.Status != DicomState.Success)
            {
                Logger.LogError("Failure status received in sending C-STORE: {0}", message.Status.Description);
            }

            bool ok = false;
            while (ok == false)
            {
                _fileListIndex++;
                if (_fileListIndex >= _fileList.Count)
                {
                    Logger.LogInfo("Completed sending C-STORE-RQ messages, releasing association.");
                    client.SendReleaseRequest();
                    return;
                }

                ok = SendCStore(client, association);
            }
        }
コード例 #7
0
ファイル: StorageScu.cs プロジェクト: khaha2210/radio
 public void OnReceiveAssociateReject(DicomClient client, ClientAssociationParameters association, DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
 {
     Logger.LogInfo("Association Rejection when {0} connected to remote AE {1}", association.CallingAE, association.CalledAE);
     _dicomClient = null;
 }
コード例 #8
0
ファイル: CFindSCU.cs プロジェクト: nhannd/Xian
        public void OnReceiveAssociateReject(DicomClient client, ClientAssociationParameters association, DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
        {

        }
コード例 #9
0
ファイル: CFindSCU.cs プロジェクト: nhannd/Xian
 public void OnReceiveResponseMessage(DicomClient client, ClientAssociationParameters association, byte presentationID, DicomMessage message)
 {
     if (message.Status.Status == DicomState.Pending)
     {
         string studyinstanceuid = message.DataSet[DicomTags.StudyInstanceUid].GetString(0, "");
         if (OnResultReceive != null)
             OnResultReceive(message.DataSet);
     }
     else
     {
         _dicomClient.SendReleaseRequest();
     }
 }
コード例 #10
0
ファイル: CFindSCU.cs プロジェクト: nhannd/Xian
 public void OnNetworkError(DicomClient client, ClientAssociationParameters association, Exception e)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #11
0
ファイル: StorageScu.cs プロジェクト: khaha2210/radio
        public void OnReceiveAssociateAccept(DicomClient client, ClientAssociationParameters association)
        {
            Logger.LogInfo("Association Accepted:\r\n{0}", association.ToString());

            _fileListIndex = 0;

            bool ok = SendCStore(client, association);
            while (ok == false)
            {
                _fileListIndex++;
                if (_fileListIndex >= _fileList.Count)
                {
                    Logger.LogInfo("Completed sending C-STORE-RQ messages, releasing association.");
                    client.SendReleaseRequest();
                    return;
                }
                ok = SendCStore(client, association);
            }
        }
コード例 #12
0
 public void OnReceiveResponseMessage(DicomClient client, ClientAssociationParameters association, byte presentationID, DicomMessage message)
 {
     client.SendReleaseRequest();
     Assert.AreEqual(message.Status.Code, DicomStatuses.Success.Code, "Incorrect DICOM status returned");
 }
コード例 #13
0
 public void OnReceiveReleaseResponse(DicomClient client, ClientAssociationParameters association)
 {
     // Signal the main thread we're exiting
     _threadStop.Set();
 }
コード例 #14
0
ファイル: StorageScu.cs プロジェクト: khaha2210/radio
 public void OnDimseTimeout(DicomClient client, ClientAssociationParameters association)
 {
     Logger.LogInfo("Timeout waiting for response message, continuing.");
 }
コード例 #15
0
ファイル: DicomClient.cs プロジェクト: khaha2210/radio
        /// <summary>
        /// Connection to a remote DICOM application via TLS.
        /// </summary>
        /// <param name="assoc"></param>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static DicomClient ConnectTLS(AssociationParameters assoc, IDicomClientHandler handler)
        {
            DicomClient client = new DicomClient(assoc, handler);
            client.ConnectTLS();
            return client;
		}
コード例 #16
0
ファイル: StorageScu.cs プロジェクト: khaha2210/radio
 public void OnNetworkError(DicomClient client, ClientAssociationParameters association, Exception e)
 {
     Logger.LogErrorException(e, "Unexpected network error");
     _dicomClient = null;
 }
コード例 #17
0
ファイル: StorageScu.cs プロジェクト: khaha2210/radio
 public void OnReceiveAbort(DicomClient client, ClientAssociationParameters association, DicomAbortSource source, DicomAbortReason reason)
 {
     Logger.LogError("Unexpected association abort received from {0}", association.CalledAE);
     _dicomClient = null;
 }
コード例 #18
0
ファイル: StorageScu.cs プロジェクト: khaha2210/radio
 public void OnReceiveReleaseResponse(DicomClient client, ClientAssociationParameters association)
 {
     Logger.LogInfo("Association released to {0}", association.CalledAE);
     _dicomClient = null;
 }
コード例 #19
0
ファイル: CFindSCU.cs プロジェクト: nhannd/Xian
 public void OnReceiveReleaseResponse(DicomClient client, ClientAssociationParameters association)
 {
     if (OnQueryCompleted != null)
     {
         OnQueryCompleted();
         _dicomClient.Dispose();
     }
 }
コード例 #20
0
 public void OnReceiveAssociateReject(DicomClient client, ClientAssociationParameters association, DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
 {
     if (_type == TestTypes.AssociationReject)
     {
         Assert.IsTrue(source == DicomRejectSource.ServiceProviderACSE);
         Assert.IsTrue(result == DicomRejectResult.Permanent);
         Assert.IsTrue(reason == DicomRejectReason.NoReasonGiven);
         _threadStop.Set();
     }
     else
         Assert.Fail("Incorrectly received OnReceiveAssociateReject callback");
 }
コード例 #21
0
ファイル: CFindSCU.cs プロジェクト: nhannd/Xian
 public void OnReceiveAbort(DicomClient client, ClientAssociationParameters association, DicomAbortSource source, DicomAbortReason reason)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #22
0
 public void OnReceiveAbort(DicomClient client, ClientAssociationParameters association, DicomAbortSource source, DicomAbortReason reason)
 {
     Assert.Fail("Incorrectly received OnReceiveAbort callback");
 }
コード例 #23
0
ファイル: CFindSCU.cs プロジェクト: nhannd/Xian
 public void OnDimseTimeout(DicomClient server, ClientAssociationParameters association)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #24
0
ファイル: StorageScu.cs プロジェクト: khaha2210/radio
        /// <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;
        }
コード例 #25
0
ファイル: CFindSCU.cs プロジェクト: nhannd/Xian
 public void OnReceiveAssociateAccept(DicomClient client, ClientAssociationParameters association)
 {
     SendCFind();
 }
コード例 #26
0
 public void OnClientClosed(DicomClient client, ClientAssociationParameters association)
 {
     OnClientClosedCalled = true;
 }
コード例 #27
0
ファイル: CFindSCU.cs プロジェクト: nhannd/Xian
        public void OnReceiveRequestMessage(DicomClient client, ClientAssociationParameters association, byte presentationID, DicomMessage message)
        {

        }
コード例 #28
0
 public void OnNetworkError(DicomClient client, ClientAssociationParameters association, Exception e)
 {
     Assert.Fail("Incorrectly received OnNetworkError callback");
 }
コード例 #29
0
 public void OnDimseTimeout(DicomClient client, ClientAssociationParameters association)
 {
 }
コード例 #30
0
ファイル: StorageScu.cs プロジェクト: khaha2210/radio
        public void OnReceiveRequestMessage(DicomClient client, ClientAssociationParameters association, byte presentationID, DicomMessage message)
        {
            Logger.LogError("Unexpected OnReceiveRequestMessage callback on client.");

            throw new Exception("The method or operation is not implemented.");
        }