Exemplo n.º 1
0
 public Task OnReceiveAssociationAcceptAsync(DicomAssociation association)
 {
     return(CompletedTaskProvider.CompletedTask);
 }
Exemplo n.º 2
0
 public new Task SendAssociationRequestAsync(DicomAssociation association)
 {
     return(base.SendAssociationRequestAsync(association));
 }
Exemplo n.º 3
0
 public Task OnReceiveAssociationAcceptAsync(DicomAssociation association)
 {
     return(DicomClient.OnReceiveAssociationAcceptAsync(association));
 }
Exemplo n.º 4
0
        public Task OnReceiveAssociationRequestAsync(DicomAssociation association)
        {
            Logger.Info("Received association request from AE: {0} with IP: {1} ", association.CallingAE, RemoteIP);
            string calledAE = association.CalledAE;

            this._config = Config_.Instance.FindPrinter(calledAE);

            if (!ReferenceEquals(this._config, null))
            {
                Printer = new Printer(this._config.AETitle);
            }
            else
            {
                MessageBox.Show("AET ERROR PLEASE CHECK");
            }

            if (Printer.PrinterAet != association.CalledAE)
            {
                Logger.Error(
                    "Association with {0} rejected since requested printer {1} not found",
                    association.CallingAE,
                    association.CalledAE);
                return(SendAssociationRejectAsync(
                           DicomRejectResult.Permanent,
                           DicomRejectSource.ServiceUser,
                           DicomRejectReason.CalledAENotRecognized));
            }

            CallingAE = association.CallingAE;
            CalledAE  = Printer.PrinterAet;

            foreach (var pc in association.PresentationContexts)
            {
                if (pc.AbstractSyntax == DicomUID.Verification ||
                    pc.AbstractSyntax == DicomUID.BasicGrayscalePrintManagementMetaSOPClass ||
                    pc.AbstractSyntax == DicomUID.BasicColorPrintManagementMetaSOPClass ||
                    pc.AbstractSyntax == DicomUID.PrinterSOPClass ||
                    pc.AbstractSyntax == DicomUID.BasicFilmSessionSOPClass ||
                    pc.AbstractSyntax == DicomUID.BasicFilmBoxSOPClass ||
                    pc.AbstractSyntax == DicomUID.BasicGrayscaleImageBoxSOPClass ||
                    pc.AbstractSyntax == DicomUID.BasicColorImageBoxSOPClass)
                {
                    pc.AcceptTransferSyntaxes(AcceptedTransferSyntaxes);
                }
                else if (pc.AbstractSyntax == DicomUID.PrintJobSOPClass)
                {
                    pc.AcceptTransferSyntaxes(AcceptedTransferSyntaxes);
                    _sendEventReports = true;
                }
                else
                {
                    Logger.Warn(
                        "Requested abstract syntax {abstractSyntax} from {callingAE} not supported",
                        pc.AbstractSyntax,
                        association.CallingAE);
                    pc.SetResult(DicomPresentationContextResult.RejectAbstractSyntaxNotSupported);
                }
            }

            Logger.Info("Accepted association request from {callingAE}", association.CallingAE);
            return(SendAssociationAcceptAsync(association));
        }
 public override Task OnReceiveAssociationAcceptAsync(DicomAssociation association)
 {
     _dicomClient.Logger.Warn($"[{this}] Received association accept but we were just in the processing of releasing the association!");
     return(Task.CompletedTask);
 }
 public override Task OnReceiveAssociationAcceptAsync(DicomAssociation association)
 {
     _dicomClient.Logger.Warn($"[{this}] Received association accept but we already have an active association!");
     return(CompletedTaskProvider.CompletedTask);
 }
Exemplo n.º 7
0
 public Task OnReceiveAssociationAcceptAsync(DicomAssociation association) => Task.CompletedTask;
Exemplo n.º 8
0
 public Task OnReceiveAssociationRequestAsync(DicomAssociation association)
 {
     return(Task.Run(() => { OnReceiveAssociationRequest(association); }));
 }
Exemplo n.º 9
0
 public void OnReceiveAssociationRequest(DicomAssociation association)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 10
0
 public Task OnReceiveAssociationAcceptAsync(DicomAssociation association) => DicomClient.OnReceiveAssociationAcceptAsync(association);
Exemplo n.º 11
0
 private void SendAssociationAccept(DicomAssociation association)
 {
     SendAssociationAcceptAsync(association);
 }
Exemplo n.º 12
0
 public new Task SendAssociationRequestAsync(DicomAssociation association) => base.SendAssociationRequestAsync(association);
Exemplo n.º 13
0
 public InstanceReceivedEventArgs(DicomAssociation association, DicomFile instance)
 {
     Association = association;
     Instance    = instance;
 }
Exemplo n.º 14
0
        Task IDicomServiceProvider.OnReceiveAssociationRequestAsync(DicomAssociation association)
        {
            //var taskInfo = $"task: connection: {((DICOMConnection)(base.UserState)).name}";
            var fromConnection = _connectionFinder.GetDicomConnectionToLocalAETitle(_profileStorage.Current, association.CalledAE);

            if (fromConnection == null)
            {
                //We have an inbound Association.CalledAE that we aren't configured for
                logger.Log(LogLevel.Warning,
                           $"There is no connection defined where the LocalAETitle matches the Association.CalledAE: {Association.CalledAE}");
                return(SendAssociationRejectAsync(DicomRejectResult.Permanent, DicomRejectSource.ServiceUser,
                                                  DicomRejectReason.CalledAENotRecognized));
            }


            //load possible and accepted transfer syntaxes into profile if not populated
            bool add = false;

            if (((DICOMConnection)(base.UserState)).AcceptedImageTransferSyntaxUIDs == null)
            {
                ((DICOMConnection)(base.UserState)).AcceptedImageTransferSyntaxUIDs = new List <string>();
            }
            if (((DICOMConnection)(base.UserState)).PossibleImageTransferSyntaxUIDs == null)
            {
                ((DICOMConnection)(base.UserState)).PossibleImageTransferSyntaxUIDs = new List <string>();
            }

            if (((DICOMConnection)(base.UserState)).AcceptedImageTransferSyntaxUIDs.Count == 0)
            {
                add = true;
            }

            ((DICOMConnection)(base.UserState)).PossibleImageTransferSyntaxUIDs.Clear();

            foreach (var dicomTransferSyntax in AcceptedImageTransferSyntaxes)
            {
                logger.Log(LogLevel.Information,
                           $"Possible AcceptedImageTransferSyntaxes UID:{dicomTransferSyntax.UID} Endian:{dicomTransferSyntax.Endian} IsDeflate:{dicomTransferSyntax.IsDeflate} IsEncapsulated:{dicomTransferSyntax.IsEncapsulated} IsExplicitVR:{dicomTransferSyntax.IsExplicitVR} IsLossy:{dicomTransferSyntax.IsLossy} IsRetired:{dicomTransferSyntax.IsRetired} LossyCompressionMethod:{dicomTransferSyntax.LossyCompressionMethod} SwapPixelData:{dicomTransferSyntax.SwapPixelData}");

                if (!((DICOMConnection)(base.UserState)).AcceptedImageTransferSyntaxUIDs.Exists(e =>
                                                                                                e.Equals(dicomTransferSyntax.UID.ToString())))
                {
                    if (add == true)
                    {
                        ((DICOMConnection)(base.UserState)).AcceptedImageTransferSyntaxUIDs.Add(dicomTransferSyntax.UID
                                                                                                .ToString());
                    }
                    else
                    {
                        logger.Log(LogLevel.Warning,
                                   $"Not configured in DICOMConnection.AcceptedImageTransferSyntaxUIDs!!  UID:{dicomTransferSyntax.UID}");
                    }
                }

                ((DICOMConnection)(base.UserState)).PossibleImageTransferSyntaxUIDs.Add(dicomTransferSyntax.UID
                                                                                        .ToString());
            }

            //load AcceptedImageTransferSyntaxes from profile now we are populated one way or another
            var    newAcceptedImageTransferSyntaxes = new List <DicomTransferSyntax>();
            string uidnumber = "";

            foreach (var item in ((DICOMConnection)(base.UserState)).AcceptedImageTransferSyntaxUIDs)
            {
                try
                {
                    uidnumber = item.Substring(item.LastIndexOf("[") + 1).TrimEnd(']'); //,item.IndexOf("]")-1
                    var transfersyntax = DicomTransferSyntax.Parse(uidnumber);
                    newAcceptedImageTransferSyntaxes.Add(transfersyntax);
                }
                catch (Exception)
                {
                    logger.Log(LogLevel.Critical, $"Unable to parse DICOMConnection.AcceptedImageTransferSyntaxUID: {uidnumber}");
                }
            }

            AcceptedImageTransferSyntaxes = newAcceptedImageTransferSyntaxes.ToArray();

            foreach (var pc in association.PresentationContexts)
            {
                if (pc.AbstractSyntax == DicomUID.Verification)
                {
                    pc.AcceptTransferSyntaxes(AcceptedTransferSyntaxes);
                }
                else if (pc.AbstractSyntax.StorageCategory != DicomStorageCategory.None)
                {
                    if (((DICOMConnection)(base.UserState)).AcceptedImageTransferSyntaxUIDs == null ||
                        ((DICOMConnection)(base.UserState)).AcceptedImageTransferSyntaxUIDs.Count == 0)
                    {
                    }

                    pc.AcceptTransferSyntaxes(AcceptedImageTransferSyntaxes);
                }
            }

            return(SendAssociationAcceptAsync(association));
        }
Exemplo n.º 15
0
 internal Task OnReceiveAssociationAcceptAsync(DicomAssociation association)
 => ExecuteWithinTransitionLock(() => State.OnReceiveAssociationAcceptAsync(association));
Exemplo n.º 16
0
 public Task OnReceiveAssociationRequestAsync(DicomAssociation association)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 17
0
 public InitialisationParameters(DicomAssociation association, IDicomClientConnection connection)
 {
     Association = association ?? throw new ArgumentNullException(nameof(association));
     Connection  = connection ?? throw new ArgumentNullException(nameof(connection));
 }
 public abstract Task OnReceiveAssociationAcceptAsync(DicomAssociation association);
Exemplo n.º 19
0
        public override Task OnReceiveAssociationAcceptAsync(DicomAssociation association)
        {
            _onAssociationAcceptedTaskCompletionSource.TrySetResultAsynchronously(new DicomAssociationAcceptedEvent(association));

            return(CompletedTaskProvider.CompletedTask);
        }
 /// <summary>
 /// Initializes an instance of the <see cref="AssociationAcceptedEventArgs"/> class.
 /// </summary>
 /// <param name="association">Accepted association.</param>
 public AssociationAcceptedEventArgs(DicomAssociation association)
 {
     Association = association;
 }
Exemplo n.º 21
0
 public Task OnReceiveAssociationRequestAsync(DicomAssociation association)
 {
     OnReceiveAssociationRequest(association);
     return(SendAssociationAcceptAsync(association));
 }
Exemplo n.º 22
0
 public DicomAssociationAcceptedEvent(DicomAssociation association)
 {
     Association = association ?? throw new ArgumentNullException(nameof(association));
 }