Beispiel #1
0
        /// <summary>
        /// Checks for other query retrieve levels already used, returns exception if trying to add a different level.
        /// Sets the QueryRetrieveLevel tag to the <paramref name="queryRetrieveLevel"/> if it's not invalid.
        /// </summary>
        /// <param name="queryRetrieveLevel">The query retrieve level.</param>
        /// <exception cref="InvalidOperationException">If adding an instance of a different Query Level</exception>
        private void CheckForOtherLevel(QueryRetrieveLevel queryRetrieveLevel)
        {
            QueryRetrieveLevel currentLevel = IodBase.ParseEnum(_dicomAttributeCollection[DicomTags.QueryRetrieveLevel].GetString(0, String.Empty), QueryRetrieveLevel.None);

            // Use the highest (most granular) query level (Image > Series > Study > Patient)
            if (queryRetrieveLevel > currentLevel)
            {
                IodBase.SetAttributeFromEnum(_dicomAttributeCollection[DicomTags.QueryRetrieveLevel], queryRetrieveLevel);
            }
            else if (queryRetrieveLevel != currentLevel)
            {
                string message = String.Format("The current query/retrieve level is '{0}' and cannot be set to {1}", currentLevel, queryRetrieveLevel);
                throw new InvalidOperationException(message);
            }
        }
Beispiel #2
0
        public override void OnReceiveRequestMessage(DicomClient client, ClientAssociationParameters association, byte presentationID, DicomMessage message)
        {
            try
            {
                // We only handle NEventReport request messages
                if (message.CommandField != DicomCommandField.NEventReportRequest ||
                    message.AffectedSopClassUid != SopClass.PrinterSopClassUid)
                {
                    base.OnReceiveRequestMessage(client, association, presentationID, message);
                    return;
                }

                var printerStatus = IodBase.ParseEnum(message.EventTypeId.ToString(), PrinterStatus.None);
                var printerModule = new PrinterModuleIod(message.DataSet);
                var logMessage    = string.Format("Received NEventReportRequest, Printer Status: {0}, Status Info = {1}", printerStatus,
                                                  printerModule.PrinterStatusInfo);

                //Always respond.
                Client.SendNEventReportResponse(GetPresentationContextId(this.AssociationParameters),
                                                message, new DicomMessage(), DicomStatuses.Success);

                switch (printerStatus)
                {
                case PrinterStatus.Failure:
                    Platform.Log(LogLevel.Error, logMessage);
                    this.FailureDescription = SR.MessagePrinterError;
                    this.ReleaseConnection(client);
                    return;

                case PrinterStatus.Warning:
                    Platform.Log(LogLevel.Warn, logMessage);
                    break;

                case PrinterStatus.None:
                case PrinterStatus.Normal:
                default:
                    Platform.Log(LogLevel.Debug, logMessage);
                    break;
                }
            }
            catch (Exception ex)
            {
                this.FailureDescription = ex.Message;
                Platform.Log(LogLevel.Error, ex.ToString());
                ReleaseConnection(client);
                throw;
            }
        }
Beispiel #3
0
        public IList <DicomAttributeCollection> Find(string clientAETitle, string remoteAE, string remoteHost, int remotePort, IodBase iod)
        {
            if (iod == null)
            {
                throw new ArgumentNullException("iod");
            }

            return(Find(clientAETitle, remoteAE, remoteHost, remotePort, iod.DicomAttributeProvider as DicomAttributeCollection));
        }