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); }
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); }
public void RejectTests() { const int port = 2112; /* Setup the Server */ var 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.AssociationReject; DicomServer.StartListening(serverParameters, ServerHandlerCreator); /* Setup the client */ var clientParameters = new ClientAssociationParameters("AssocTestClient", "AssocTestServer", new IPEndPoint(IPAddress.Loopback, port)); pcid = clientParameters.AddPresentationContext(SopClass.CtImageStorage); clientParameters.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrLittleEndian); clientParameters.AddTransferSyntax(pcid, TransferSyntax.ImplicitVrLittleEndian); /* Open the association */ var handler = new ClientHandler(this, TestTypes.AssociationReject); DicomClient client = DicomClient.Connect(clientParameters, handler); handler._threadStop.WaitOne(); client.Dispose(); _serverType = TestTypes.AssociationReject; /* Setup the client */ clientParameters = new ClientAssociationParameters("AssocTestClient", "AssocTestServer", new IPEndPoint(IPAddress.Loopback, port)); pcid = clientParameters.AddPresentationContext(SopClass.MrImageStorage); clientParameters.AddTransferSyntax(pcid, TransferSyntax.Jpeg2000ImageCompressionLosslessOnly); /* Open the association */ var clientHandler = new ClientHandler(this, TestTypes.AssociationReject); client = DicomClient.Connect(clientParameters, clientHandler); handler._threadStop.WaitOne(); client.Dispose(); DicomServer.StopListening(serverParameters); }