Пример #1
0
		public void BeginTransferringDicomInstancesAuditTest()
		{
			AssociationParameters parms = new ClientAssociationParameters("CLIENT", "SERVER",
																		  new IPEndPoint(new IPAddress(new byte[] { 2, 2, 2, 2 }),
																						 2));
			parms.LocalEndPoint = new IPEndPoint(new IPAddress(new byte[] { 1, 1, 1, 1 }),
												 1);


			BeginTransferringDicomInstancesAuditHelper helper =
				new BeginTransferringDicomInstancesAuditHelper(
					new DicomAuditSource("testApp", "Site", AuditSourceTypeCodeEnum.ApplicationServerProcessTierInMultiTierSystem),
					EventIdentificationContentsEventOutcomeIndicator.Success,
					parms, new AuditPatientParticipantObject("id1234", "Test Patient"));

			DicomAttributeCollection collection = new DicomAttributeCollection();
			SetupMR(collection);
			helper.AddStorageInstance(new StorageInstance(new DicomMessage(new DicomAttributeCollection(), collection)));
			
			string output = helper.Serialize(true);

			Assert.IsNotEmpty(output);

			Assert.Ignore("Skipping schema validation due to schema bug #9455");
			Exception exception;
			if (!helper.Verify(out exception))
				throw exception;
		}
Пример #2
0
        private void SetSocketOptions(ClientAssociationParameters parameters)
        {
            _socket.ReceiveBufferSize = parameters.ReceiveBufferSize;
            _socket.SendBufferSize = parameters.SendBufferSize;
            _socket.ReceiveTimeout = parameters.ReadTimeout;
            _socket.SendTimeout = parameters.WriteTimeout;
            _socket.LingerState = new LingerOption(false, 0);
            // Nagle option
			_socket.NoDelay = parameters.DisableNagle;
        }
Пример #3
0
 private void SetSocketOptions(ClientAssociationParameters parameters)
 {
     _socket.ReceiveBufferSize = parameters.ReceiveBufferSize;
     _socket.SendBufferSize    = parameters.SendBufferSize;
     _socket.ReceiveTimeout    = parameters.ReadTimeout;
     _socket.SendTimeout       = parameters.WriteTimeout;
     _socket.LingerState       = new LingerOption(false, 0);
     // Nagle option
     _socket.NoDelay = parameters.DisableNagle;
 }
Пример #4
0
        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);
            }
        }
Пример #5
0
        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);

        }
Пример #6
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");
            }
        }
Пример #7
0
 public void OnNetworkError(DicomClient client, ClientAssociationParameters association, Exception e)
 {
     Assert.Fail("Incorrectly received OnNetworkError callback");
 }
Пример #8
0
 public void OnReceiveAbort(DicomClient client, ClientAssociationParameters association, DicomAbortSource source, DicomAbortReason reason)
 {
     Logger.LogError("Unexpected association abort received from {0}", association.CalledAE);
     _dicomClient = null;
 }
Пример #9
0
 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
        public void OnReceiveAssociateReject(DicomClient client, ClientAssociationParameters association, DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
        {

        }
Пример #11
0
 public void OnNetworkError(DicomClient client, ClientAssociationParameters association, Exception e)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Пример #12
0
 public void OnReceiveReleaseResponse(DicomClient client, ClientAssociationParameters association)
 {
     if (OnQueryCompleted != null)
     {
         OnQueryCompleted();
         _dicomClient.Dispose();
     }
 }
Пример #13
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");
 }
Пример #14
0
 internal ClientAssociationParameters Copy(ClientAssociationParameters sourceParameters)
 {
     return(new ClientAssociationParameters(sourceParameters));
 }
Пример #15
0
 internal ClientAssociationParameters Copy(ClientAssociationParameters sourceParameters)
 {
     return new ClientAssociationParameters(sourceParameters);
 }
Пример #16
0
 private ClientAssociationParameters(ClientAssociationParameters parameters)
     : base(parameters)
 {
 }
Пример #17
0
 public void OnDimseTimeout(DicomClient client, ClientAssociationParameters association)
 {
     Logger.LogInfo("Timeout waiting for response message, continuing.");
 }
Пример #18
0
 public void OnNetworkError(DicomClient client, ClientAssociationParameters association, Exception e)
 {
     Logger.LogErrorException(e, "Unexpected network error");
     _dicomClient = null;
 }
Пример #19
0
 public void OnReceiveReleaseResponse(DicomClient client, ClientAssociationParameters association)
 {
     // Signal the main thread we're exiting
     _threadStop.Set();
 }
Пример #20
0
 public void OnReceiveRequestMessage(DicomClient client, ClientAssociationParameters association, byte presentationID, DicomMessage message)
 {
     Assert.Fail("Incorrectly received OnReceiveRequestMessage callback");
 }
Пример #21
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");
 }
Пример #22
0
 public void OnReceiveAbort(DicomClient client, ClientAssociationParameters association, DicomAbortSource source, DicomAbortReason reason)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Пример #23
0
 public void OnReceiveAbort(DicomClient client, ClientAssociationParameters association, DicomAbortSource source, DicomAbortReason reason)
 {
     Assert.Fail("Incorrectly received OnReceiveAbort callback");
 }
Пример #24
0
 public void OnDimseTimeout(DicomClient server, ClientAssociationParameters association)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Пример #25
0
		public void DicomInstancesTransferredAuditTest()
		{
			AssociationParameters parms = new ClientAssociationParameters("CLIENT", "SERVER",
			                                                              new IPEndPoint(new IPAddress(new byte[] {2, 2, 2, 2}),
			                                                                             2));
			parms.LocalEndPoint = new IPEndPoint(new IPAddress(new byte[] {1, 1, 1, 1}),
			                                     1);


			DicomInstancesTransferredAuditHelper helper =
				new DicomInstancesTransferredAuditHelper(
					new DicomAuditSource("testApp", "Site", AuditSourceTypeCodeEnum.ApplicationServerProcessTierInMultiTierSystem),
					EventIdentificationTypeEventOutcomeIndicator.Success,
					EventIdentificationTypeEventActionCode.R,
					parms);

			DicomAttributeCollection collection = new DicomAttributeCollection();
			SetupMultiframeXA(collection,128,128,2);
			helper.AddPatientParticipantObject(new AuditPatientParticipantObject(collection));
			helper.AddStorageInstance(new StorageInstance(new DicomMessage(new DicomAttributeCollection(), collection)));

			string output = helper.Serialize(true);

			Assert.IsNotEmpty(output);

			string failure;
			bool result = helper.Verify(out failure);

			Assert.IsTrue(result, failure);
		}
Пример #26
0
 public void OnReceiveAssociateAccept(DicomClient client, ClientAssociationParameters association)
 {
     SendCFind();
 }
Пример #27
0
 private ClientAssociationParameters(ClientAssociationParameters parameters)
     : base(parameters)
 {
 }
Пример #28
0
        public void OnReceiveRequestMessage(DicomClient client, ClientAssociationParameters association, byte presentationID, DicomMessage message)
        {

        }
Пример #29
0
 public void OnClientClosed(DicomClient client, ClientAssociationParameters association)
 {
     OnClientClosedCalled = true;
 }
Пример #30
0
        public void ServerTest()
        {
            int port = 2112;

            /* Setup the Server */
            ServerAssociationParameters serverParameters = new ServerAssociationParameters("AssocTestServer",new IPEndPoint(IPAddress.Any,port));
            byte pcid = serverParameters.AddPresentationContext(SopClass.MrImageStorage);
            serverParameters.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrLittleEndian);
            serverParameters.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrBigEndian);
            serverParameters.AddTransferSyntax(pcid, TransferSyntax.ImplicitVrLittleEndian);

            _serverType = TestTypes.SendMR;
            DicomServer.StartListening(serverParameters, ServerHandlerCreator);

            /* Setup the client */
            ClientAssociationParameters clientParameters = new ClientAssociationParameters("AssocTestClient","AssocTestServer",
                                                                                           new System.Net.IPEndPoint(IPAddress.Loopback,port));
            pcid = clientParameters.AddPresentationContext(SopClass.MrImageStorage);
            clientParameters.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrLittleEndian);
            clientParameters.AddTransferSyntax(pcid, TransferSyntax.ImplicitVrLittleEndian);

            pcid = clientParameters.AddPresentationContext(SopClass.CtImageStorage);
            clientParameters.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrLittleEndian);
            clientParameters.AddTransferSyntax(pcid, TransferSyntax.ImplicitVrLittleEndian);

            /* Open the association */
            ClientHandler handler = new ClientHandler(this,TestTypes.SendMR);
            DicomClient client = DicomClient.Connect(clientParameters, handler);


            handler._threadStop.WaitOne();

            client.Dispose();

            DicomServer.StopListening(serverParameters);
        }
Пример #31
0
 public void OnReceiveReleaseResponse(DicomClient client, ClientAssociationParameters association)
 {
     Logger.LogInfo("Association released to {0}", association.CalledAE);
     _dicomClient = null;
 }
Пример #32
0
        public void QueryAuditTest()
        {
        	AssociationParameters parms = new ClientAssociationParameters("CLIENT", "SERVER",
        	                                                         new IPEndPoint(new IPAddress(new byte[] {2, 2, 2, 2}),
        	                                                                       2));
			parms.LocalEndPoint = new IPEndPoint(new IPAddress(new byte[] {1, 1, 1, 1}),
        	                                                                       1);

        	QueryAuditHelper helper =
        		new QueryAuditHelper(new DicomAuditSource("testApplication"), EventIdentificationTypeEventOutcomeIndicator.Success, parms);

			helper.AddOtherParticipant(new AuditPersonActiveParticipant("testUser","test@test","Test Name"));
        	helper.AddPatientParticipantObject(new AuditPatientParticipantObject("id1234", "Test Patient"));

			AuditStudyParticipantObject study = new AuditStudyParticipantObject("1.2.3.4.5", "A1234", "1.2.3");
        	study.AddSopClass("1.2.3", 5);
			helper.AddStudyParticipantObject(study);

        	string output = helper.Serialize(true);

        	Assert.IsNotEmpty(output);

        	string failure;
        	bool result = helper.Verify(out failure);

        	Assert.IsTrue(result, failure);

			helper = new QueryAuditHelper(new DicomAuditSource("testApplication2","enterpriseId", AuditSourceTypeCodeEnum.EndUserInterface),EventIdentificationTypeEventOutcomeIndicator.Success, parms);
			helper.AddStudyParticipantObject(new AuditStudyParticipantObject("1.2.3.4.5"));

			output = helper.Serialize(true);

			Assert.IsNotEmpty(output);

			result = helper.Verify(out failure);

			Assert.IsTrue(result, failure);              
        }
Пример #33
0
 public void OnDimseTimeout(DicomClient client, ClientAssociationParameters association)
 {
 }