当前位置: 首页>>代码示例>>C#>>正文


C# DicomServer.SendCFindResponse方法代码示例

本文整理汇总了C#中ClearCanvas.Dicom.Network.DicomServer.SendCFindResponse方法的典型用法代码示例。如果您正苦于以下问题:C# DicomServer.SendCFindResponse方法的具体用法?C# DicomServer.SendCFindResponse怎么用?C# DicomServer.SendCFindResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ClearCanvas.Dicom.Network.DicomServer的用法示例。


在下文中一共展示了DicomServer.SendCFindResponse方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnReceiveRequestMessage

		public void OnReceiveRequestMessage(DicomServer server, ServerAssociationParameters association, byte presentationID, ClearCanvas.Dicom.DicomMessage message)
		{
			foreach (byte pcid in association.GetPresentationContextIDs())
			{
				DicomPresContext context = association.GetPresentationContext(pcid);
				if (context.Result == DicomPresContextResult.Accept)
				{
					if (context.AbstractSyntax == SopClass.StudyRootQueryRetrieveInformationModelFind)
					{
						DicomMessage response = new DicomMessage();
						response.DataSet[DicomTags.StudyInstanceUid].SetStringValue("1.2.3");
						response.DataSet[DicomTags.PatientId].SetStringValue("1");
						response.DataSet[DicomTags.PatientsName].SetStringValue("test");
						response.DataSet[DicomTags.StudyId].SetStringValue("1");
						response.DataSet[DicomTags.StudyDescription].SetStringValue("dummy");
						server.SendCFindResponse(presentationID, message.MessageId, response, DicomStatuses.Pending);

						DicomMessage finalResponse = new DicomMessage();
						server.SendCFindResponse(presentationID, message.MessageId, finalResponse, DicomStatuses.Success);
					}
					else if (context.AbstractSyntax == SopClass.VerificationSopClass)
					{
						server.SendCEchoResponse(presentationID, message.MessageId, DicomStatuses.Success);
					}
				}
			}
		}
开发者ID:nhannd,项目名称:Xian,代码行数:27,代码来源:Form1.cs

示例2: OnReceiveSeriesLevelQuery

        /// <summary>
        /// Method for processing Series level queries.
        /// </summary>
        /// <param name="server"></param>
        /// <param name="presentationId"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        private void OnReceiveSeriesLevelQuery(DicomServer server, byte presentationId, DicomMessage message)
        {
            //Read context for the query.
            using (IReadContext read = PersistentStoreRegistry.GetDefaultStore().OpenReadContext())
            {
                var tagList = new List<DicomTag>();

                var selectSeries = read.GetBroker<ISeriesEntityBroker>();

                var criteria = new SeriesSelectCriteria();
                criteria.ServerPartitionKey.EqualTo(Partition.GetKey());

                DicomAttributeCollection data = message.DataSet;
                foreach (DicomAttribute attrib in message.DataSet)
                {
                    tagList.Add(attrib.Tag);
                    if (!attrib.IsNull)
                        switch (attrib.Tag.TagValue)
                        {
                            case DicomTags.StudyInstanceUid:
                                List<ServerEntityKey> list =
                                    LoadStudyKey(read, (string[]) data[DicomTags.StudyInstanceUid].Values);
                                if (list.Count == 0)
                                {
                                    server.SendCFindResponse(presentationId, message.MessageId, new DicomMessage(), 
                                                             DicomStatuses.Success);
                                    AuditLog(server.AssociationParams, EventIdentificationContentsEventOutcomeIndicator.Success, message);
                                    return;
                                }
                                QueryHelper.SetKeyCondition(criteria.StudyKey, list.ToArray());
                                break;
                            case DicomTags.SeriesInstanceUid:
                                QueryHelper.SetStringArrayCondition(criteria.SeriesInstanceUid,
                                                        (string[]) data[DicomTags.SeriesInstanceUid].Values);
                                break;
                            case DicomTags.Modality:
                                QueryHelper.SetStringCondition(criteria.Modality, data[DicomTags.Modality].GetString(0, string.Empty));
                                break;
                            case DicomTags.SeriesNumber:
								QueryHelper.SetStringCondition(criteria.SeriesNumber, data[DicomTags.SeriesNumber].GetString(0, string.Empty));
                                break;
                            case DicomTags.SeriesDescription:
                                QueryHelper.SetStringCondition(criteria.SeriesDescription,
												   data[DicomTags.SeriesDescription].GetString(0, string.Empty));
                                break;
                            case DicomTags.PerformedProcedureStepStartDate:
                                QueryHelper.SetRangeCondition(criteria.PerformedProcedureStepStartDate,
												  data[DicomTags.PerformedProcedureStepStartDate].GetString(0, string.Empty));
                                break;
                            case DicomTags.PerformedProcedureStepStartTime:
                                QueryHelper.SetRangeCondition(criteria.PerformedProcedureStepStartTime,
												  data[DicomTags.PerformedProcedureStepStartTime].GetString(0, string.Empty));
                                break;
                            case DicomTags.RequestAttributesSequence: // todo
                                break;
                            default:
                                foreach (var q in _queryExtensions)
                                    q.OnReceiveSeriesLevelQuery(message, attrib.Tag, criteria);
                                break;
                        }
                }

				int resultCount = 0;
				try
                {
                    // Open a second read context, in case other queries are required.
					using (IReadContext subRead = PersistentStoreRegistry.GetDefaultStore().OpenReadContext())
                    {
                        selectSeries.Find(criteria, delegate(Series row)
                                                        {
															if (CancelReceived)
																throw new DicomException("DICOM C-Cancel Received");

															resultCount++;
															if (DicomSettings.Default.MaxQueryResponses != -1
																&& DicomSettings.Default.MaxQueryResponses < resultCount)
															{
																SendBufferedResponses(server, presentationId, message);
																throw new DicomException("Maximum Configured Query Responses Exceeded: " + resultCount);
															}

                                                        	var response = new DicomMessage();
                                                            PopulateSeries(subRead, message, response, tagList, row);
															_responseQueue.Enqueue(response);

															if (_responseQueue.Count >= DicomSettings.Default.BufferedQueryResponses)
																SendBufferedResponses(server, presentationId, message);
														});
						SendBufferedResponses(server, presentationId, message);
					}
                }
                catch (Exception e)
                {
//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:101,代码来源:QueryScpExtension.cs

示例3: OnReceiveStudyLevelQuery


//.........这里部分代码省略.........
						// First find the Online studies
                    	var storageCriteria = new StudyStorageSelectCriteria();
                    	storageCriteria.StudyStatusEnum.NotEqualTo(StudyStatusEnum.Nearline);
						storageCriteria.QueueStudyStateEnum.NotIn(new[] {QueueStudyStateEnum.DeleteScheduled, QueueStudyStateEnum.WebDeleteScheduled, QueueStudyStateEnum.EditScheduled});
                    	criteria.StudyStorageRelatedEntityCondition.Exists(storageCriteria);

                        find.Find(criteria, delegate(Study row)
                                                {
													if (CancelReceived)
														throw new DicomException("DICOM C-Cancel Received");

													resultCount++;
													if (DicomSettings.Default.MaxQueryResponses != -1
														&& DicomSettings.Default.MaxQueryResponses < resultCount)
													{
														SendBufferedResponses(server, presentationId, message);
														throw new DicomException("Maximum Configured Query Responses Exceeded: " + resultCount);
													}

                                                    var response = new DicomMessage();
                                                    PopulateStudy(subRead, response, tagList, row, "ONLINE");
													_responseQueue.Enqueue(response);

													if (_responseQueue.Count >= DicomSettings.Default.BufferedQueryResponses)
														SendBufferedResponses(server, presentationId, message);
											
                                                });

						// Now find the Nearline studies
						storageCriteria = new StudyStorageSelectCriteria();
						storageCriteria.StudyStatusEnum.EqualTo(StudyStatusEnum.Nearline);
						storageCriteria.QueueStudyStateEnum.NotIn(new[] { QueueStudyStateEnum.DeleteScheduled, QueueStudyStateEnum.WebDeleteScheduled, QueueStudyStateEnum.EditScheduled });
						criteria.StudyStorageRelatedEntityCondition.Exists(storageCriteria);

						find.Find(criteria, delegate(Study row)
												{
													if (CancelReceived)
														throw new DicomException("DICOM C-Cancel Received");

													resultCount++;
													if (DicomSettings.Default.MaxQueryResponses != -1
														&& DicomSettings.Default.MaxQueryResponses < resultCount)
													{
														SendBufferedResponses(server, presentationId, message);
														throw new DicomException("Maximum Configured Query Responses Exceeded: " + resultCount);
													}

													var response = new DicomMessage();
													PopulateStudy(subRead, response, tagList, row, "NEARLINE");
													_responseQueue.Enqueue(response);

													if (_responseQueue.Count >= DicomSettings.Default.BufferedQueryResponses)
														SendBufferedResponses(server, presentationId, message);

												});

						SendBufferedResponses(server, presentationId, message);
					}
                }
                catch (Exception e)
                {
					if (CancelReceived)
					{
						var errorResponse = new DicomMessage();
						server.SendCFindResponse(presentationId, message.MessageId, errorResponse,
												 DicomStatuses.Cancel);
						AuditLog(server.AssociationParams, EventIdentificationContentsEventOutcomeIndicator.Success, message);
        
					}
					else if (DicomSettings.Default.MaxQueryResponses != -1
						  && DicomSettings.Default.MaxQueryResponses < resultCount)
					{
						Platform.Log(LogLevel.Warn, "Maximum Configured Query Responses Exceeded: {0} on query from {1}", resultCount, server.AssociationParams.CallingAE);
						var errorResponse = new DicomMessage();
						server.SendCFindResponse(presentationId, message.MessageId, errorResponse,
												 DicomStatuses.Success);
						AuditLog(server.AssociationParams, EventIdentificationContentsEventOutcomeIndicator.Success, message);
        
					}
					else
					{
						Platform.Log(LogLevel.Error, e, "Unexpected exception when processing FIND request.");
						var errorResponse = new DicomMessage();
						server.SendCFindResponse(presentationId, message.MessageId, errorResponse,
						                         DicomStatuses.ProcessingFailure);
						AuditLog(server.AssociationParams,
								 EventIdentificationContentsEventOutcomeIndicator.SeriousFailureActionTerminated, message);

					}
                	return;
                }
            }

            var finalResponse = new DicomMessage();
            server.SendCFindResponse(presentationId, message.MessageId, finalResponse, DicomStatuses.Success);

			AuditLog(server.AssociationParams, EventIdentificationContentsEventOutcomeIndicator.Success, message);
        
        	return;
        }
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:101,代码来源:QueryScpExtension.cs

示例4: OnReceivePatientQuery


//.........这里部分代码省略.........
                                break;
							case DicomTags.PatientsSex:
								// Specify a subselect on Patients Sex in Study
								QueryHelper.SetStringArrayCondition(studySelect.PatientsSex,
														(string[])data[DicomTags.PatientsSex].Values);
								if (!studySubSelect)
								{
									criteria.StudyRelatedEntityCondition.Exists(studySelect);
									studySubSelect = true;
								}
                        		break;

							case DicomTags.PatientsBirthDate:
								// Specify a subselect on Patients Birth Date in Study
								QueryHelper.SetStringArrayCondition(studySelect.PatientsBirthDate,
														(string[])data[DicomTags.PatientsBirthDate].Values);
								if (!studySubSelect)
								{
									criteria.StudyRelatedEntityCondition.Exists(studySelect);
									studySubSelect = true;
								}
								break;
                            default:
                                foreach (var q in _queryExtensions)
                                {
                                    bool extensionSubSelect;
                                    q.OnReceivePatientLevelQuery(message, attrib.Tag, criteria, studySelect, out extensionSubSelect);
                                    if (extensionSubSelect && !studySubSelect)
                                    {
                                        criteria.StudyRelatedEntityCondition.Exists(studySelect);
                                        studySubSelect = true;
                                    }
                                }
                                break;
                        }
                }

				int resultCount = 0;
                try
                {
                    find.Find(criteria, delegate(Patient row)
                                            {
												if (CancelReceived)
													throw new DicomException("DICOM C-Cancel Received");

                                            	resultCount++;
												if (DicomSettings.Default.MaxQueryResponses != -1
													&& DicomSettings.Default.MaxQueryResponses < resultCount)
												{
													SendBufferedResponses(server, presentationId, message);
													throw new DicomException("Maximum Configured Query Responses Exceeded: " + resultCount);
												}

                                            	var response = new DicomMessage();
												PopulatePatient(response, tagList, row);
                                            	_responseQueue.Enqueue(response);

												if (_responseQueue.Count >= DicomSettings.Default.BufferedQueryResponses)
													SendBufferedResponses(server, presentationId, message);
                                            });

                	SendBufferedResponses(server, presentationId, message);

                }
                catch (Exception e)
                {
					if (CancelReceived)
					{
						var errorResponse = new DicomMessage();
						server.SendCFindResponse(presentationId, message.MessageId, errorResponse,
												 DicomStatuses.Cancel);
					}
					else if (DicomSettings.Default.MaxQueryResponses != -1 
						  && DicomSettings.Default.MaxQueryResponses < resultCount)
					{
						Platform.Log(LogLevel.Warn, "Maximum Configured Query Responses Exceeded: {0} on query from {1}", resultCount, server.AssociationParams.CallingAE);
						var errorResponse = new DicomMessage();
						server.SendCFindResponse(presentationId, message.MessageId, errorResponse,
												 DicomStatuses.Success);
						AuditLog(server.AssociationParams,
								 EventIdentificationContentsEventOutcomeIndicator.Success, message);
					}
					else
					{
						Platform.Log(LogLevel.Error, e, "Unexpected exception when processing FIND request.");
						var errorResponse = new DicomMessage();
						server.SendCFindResponse(presentationId, message.MessageId, errorResponse,
						                         DicomStatuses.QueryRetrieveUnableToProcess);
						AuditLog(server.AssociationParams,
								 EventIdentificationContentsEventOutcomeIndicator.SeriousFailureActionTerminated, message);
					}
                	return;
                }
            }

            var finalResponse = new DicomMessage();
            server.SendCFindResponse(presentationId, message.MessageId, finalResponse, DicomStatuses.Success);
			AuditLog(server.AssociationParams, EventIdentificationContentsEventOutcomeIndicator.Success, message);
        	return;
        }
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:101,代码来源:QueryScpExtension.cs

示例5: SendBufferedResponses

		private void SendBufferedResponses(DicomServer server, byte presentationId, DicomMessage requestMessage)
		{
			while (_responseQueue.Count > 0)
			{
				DicomMessage response = _responseQueue.Dequeue();
				server.SendCFindResponse(presentationId, requestMessage.MessageId, response,
						 DicomStatuses.Pending);

				if (CancelReceived)
					throw new DicomException("DICOM C-Cancel Received");

				if (!server.NetworkActive)
					throw new DicomException("Association is no longer valid.");
			}
		}
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:15,代码来源:QueryScpExtension.cs

示例6: OnReceiveRequest

        /// <summary>
        /// Extension method called when a new DICOM Request message has been called that the 
        /// extension will process.
        /// </summary>
        /// <param name="server"></param>
        /// <param name="association"></param>
        /// <param name="presentationId"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public override bool OnReceiveRequest(DicomServer server, ServerAssociationParameters association,
                                              byte presentationId, DicomMessage message)
        {
            String level = message.DataSet[DicomTags.QueryRetrieveLevel].GetString(0, string.Empty);

			if (message.CommandField == DicomCommandField.CCancelRequest)
			{
				Platform.Log(LogLevel.Info,"Received C-FIND-CANCEL-RQ message.");
				CancelReceived = true;
				return true;
			}

			CancelReceived = false;

            if (message.AffectedSopClassUid.Equals(SopClass.StudyRootQueryRetrieveInformationModelFindUid))
            {
                if (level.Equals("STUDY"))
                {
					// We use the ThreadPool to process the thread requests. This is so that we return back
					// to the main message loop, and continue to look for cancel request messages coming
					// in.  There's a small chance this may cause delays in responding to query requests if
					// the .NET Thread pool fills up.
                	ThreadPool.QueueUserWorkItem(delegate
													{
													    try
													    {
                                                            OnReceiveStudyLevelQuery(server, presentationId, message);
													    }
													    catch (Exception x)
													    {
                                                            Platform.Log(LogLevel.Error, x, "Unexpected exception in OnReceiveStudyLevelQuery.");
													    }
													});
                	return true;
                }
            	if (level.Equals("SERIES"))
            	{
            		ThreadPool.QueueUserWorkItem(delegate
            		                             	{
                                                        try
                                                        {
                                                            OnReceiveSeriesLevelQuery(server, presentationId, message);
                                                        }
                                                        catch (Exception x)
                                                        {
                                                            Platform.Log(LogLevel.Error, x,
                                                                         "Unexpected exception in OnReceiveSeriesLevelQuery.");
                                                        }
            		                             	});
            		return true;
            	}
            	if (level.Equals("IMAGE"))
            	{
            	    ThreadPool.QueueUserWorkItem(delegate
            	                                     {
            	                                         try
            	                                         {
            	                                             OnReceiveImageLevelQuery(server, presentationId, message);
            	                                         }
            	                                         catch (Exception x)
            	                                         {
            	                                             Platform.Log(LogLevel.Error, x,
            	                                                          "Unexpected exception in OnReceiveImageLevelQuery.");
            	                                         }
            	                                     });
            		return true;
            	}
            	Platform.Log(LogLevel.Error, "Unexpected Study Root Query/Retrieve level: {0}", level);

            	server.SendCFindResponse(presentationId, message.MessageId, new DicomMessage(),
            	                         DicomStatuses.QueryRetrieveIdentifierDoesNotMatchSOPClass);
            	return true;
            }
        	if (message.AffectedSopClassUid.Equals(SopClass.PatientRootQueryRetrieveInformationModelFindUid))
        	{
        		if (level.Equals("PATIENT"))
        		{
        		    ThreadPool.QueueUserWorkItem(delegate
        		                                     {
        		                                         try
        		                                         {
        		                                             OnReceivePatientQuery(server, presentationId, message);
        		                                         }
        		                                         catch (Exception x)
        		                                         {
        		                                             Platform.Log(LogLevel.Error, x,
        		                                                          "Unexpected exception in OnReceivePatientQuery.");
        		                                         }
        		                                     });

        			return true;
//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:101,代码来源:QueryScpExtension.cs

示例7: OnReceiveImageLevelQuery

        /// <summary>
        /// Method for processing Image level queries.
        /// </summary>
        /// <param name="server"></param>
        /// <param name="presentationId"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        private void OnReceiveImageLevelQuery(DicomServer server, byte presentationId, DicomMessage message)
        {
            var tagList = new List<DicomTag>();
            var matchingTagList = new List<uint>();

            DicomAttributeCollection data = message.DataSet;
            string studyInstanceUid = data[DicomTags.StudyInstanceUid].GetString(0, String.Empty);
            string seriesInstanceUid = data[DicomTags.SeriesInstanceUid].GetString(0, String.Empty);

            StudyStorageLocation location;
        	try
        	{
        		FilesystemMonitor.Instance.GetReadableStudyStorageLocation(Partition.Key, studyInstanceUid, StudyRestore.True,
        		                                                           StudyCache.True, out location);
        	}
        	catch (Exception e)
        	{
        	    Platform.Log(LogLevel.Error, "Unable to load storage location for study {0}: {1}", studyInstanceUid, e.Message);
                var failureResponse = new DicomMessage();
                failureResponse.DataSet[DicomTags.InstanceAvailability].SetStringValue("NEARLINE");
                failureResponse.DataSet[DicomTags.QueryRetrieveLevel].SetStringValue("IMAGE");
                failureResponse.DataSet[DicomTags.RetrieveAeTitle].SetStringValue(Partition.AeTitle);
                failureResponse.DataSet[DicomTags.StudyInstanceUid].SetStringValue(studyInstanceUid);
				failureResponse.DataSet[DicomTags.SeriesInstanceUid].SetStringValue(seriesInstanceUid);
				server.SendCFindResponse(presentationId, message.MessageId, failureResponse,
                                         DicomStatuses.QueryRetrieveUnableToProcess);

				AuditLog(server.AssociationParams, EventIdentificationContentsEventOutcomeIndicator.SeriousFailureActionTerminated, message);

            	return;
            }
            try
            {
                // Will always return a value, although it may be an empty StudyXml file
                StudyXml studyXml = LoadStudyXml(location);

                SeriesXml seriesXml = studyXml[seriesInstanceUid];
                if (seriesXml == null)
                {
                    var failureResponse = new DicomMessage();
                    failureResponse.DataSet[DicomTags.QueryRetrieveLevel].SetStringValue("IMAGE");
                    server.SendCFindResponse(presentationId, message.MessageId, failureResponse,
                                             DicomStatuses.QueryRetrieveUnableToProcess);
                    AuditLog(server.AssociationParams,
                             EventIdentificationContentsEventOutcomeIndicator.SeriousFailureActionTerminated, message);
                    return;
                }

                foreach (DicomAttribute attrib in message.DataSet)
                {
                    if (attrib.Tag.TagValue.Equals(DicomTags.SpecificCharacterSet)
                        || attrib.Tag.TagValue.Equals(DicomTags.QueryRetrieveLevel))
                        continue;

                    tagList.Add(attrib.Tag);
                    if (!attrib.IsNull)
                        matchingTagList.Add(attrib.Tag.TagValue);
                }

                int resultCount = 0;

                foreach (InstanceXml theInstanceStream in seriesXml)
                {
                    if (CompareInstanceMatch(message, matchingTagList, theInstanceStream))
                    {
                        if (CancelReceived)
                        {
                            var failureResponse = new DicomMessage();
                            failureResponse.DataSet[DicomTags.QueryRetrieveLevel].SetStringValue("IMAGE");
                            server.SendCFindResponse(presentationId, message.MessageId, failureResponse,
                                                     DicomStatuses.Cancel);

                            AuditLog(server.AssociationParams, EventIdentificationContentsEventOutcomeIndicator.Success,
                                     message);
                            return;
                        }
                        resultCount++;
                        if (DicomSettings.Default.MaxQueryResponses != -1
                            && DicomSettings.Default.MaxQueryResponses < resultCount)
                        {
                            SendBufferedResponses(server, presentationId, message);
                            Platform.Log(LogLevel.Warn, "Maximum Configured Query Responses Exceeded: " + resultCount);
                            break;
                        }

                        var response = new DicomMessage();
                        PopulateInstance(message, response, tagList, theInstanceStream);
                        _responseQueue.Enqueue(response);

                        if (_responseQueue.Count >= DicomSettings.Default.BufferedQueryResponses)
                            SendBufferedResponses(server, presentationId, message);
                    }
                }
//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:101,代码来源:QueryScpExtension.cs

示例8: OnReceiveMWLQuery

        void IDicomServerHandler.OnReceiveRequestMessage(DicomServer server, ServerAssociationParameters association, byte presentationID, DicomMessage message)
        {
            //_sessionDebug.SetAssociationDumpString(association);
            //_sessionDebug._request = message.Dump();

            #region Cancel request
            if (message.CommandField == DicomCommandField.CCancelRequest)
            {
                Platform.Log(LogLevel.Info,string.Format("Received CANCEL-RQ message from {0}.", association.CallingAE));
                _cancelReceived = true;
                return;
            }
            #endregion

            #region CEcho request
            if (message.CommandField == DicomCommandField.CEchoRequest)
            {
                server.SendCEchoResponse(presentationID, message.MessageId, DicomStatuses.Success);
                Platform.Log(LogLevel.Info,string.Format("Received ECHO-RQ message from {0}.", association.CallingAE));
                return;
            }
            #endregion

            #region MWL C-FIND request
            if (message.CommandField == DicomCommandField.CFindRequest)
            {                
                Platform.Log(LogLevel.Info,string.Format("Message Dumped :\n" + message.Dump("", DicomDumpOptions.KeepGroupLengthElements)));

                String level = message.DataSet[DicomTags.QueryRetrieveLevel].GetString(0, string.Empty);

                _cancelReceived = false;

                if (message.AffectedSopClassUid.Equals(SopClass.ModalityWorklistInformationModelFindUid))
                    OnReceiveMWLQuery(server, presentationID, message);                    
                else
                   // Not supported message type, send a failure status.
                    server.SendCFindResponse(presentationID, message.MessageId, new DicomMessage(),
                                                DicomStatuses.QueryRetrieveIdentifierDoesNotMatchSOPClass);
                return;

            }
            #endregion          

            //ignore all unsupported request

            server.SendAssociateAbort(DicomAbortSource.ServiceProvider, DicomAbortReason.UnexpectedPDU);
            Platform.Log(LogLevel.Info,string.Format("Unexpected Command. Send Associate Abort message from server to {0}.", association.CallingAE));
            return; 
           
        }
开发者ID:khaha2210,项目名称:radio,代码行数:50,代码来源:MWLScp.cs

示例9: CheckForMissingRequiredMatchingKey

        private bool CheckForMissingRequiredMatchingKey(DicomServer server, byte presentationID, DicomMessage message)
        {
            DicomAttribute attrib;
            bool requiredMatchingKeyMissing = false;
            string  comment=""; // will receive a description of the first encountred missing r key.
                                // we don't need to collect all missing keys to speed up processing.
            do
	        {
                attrib = message.DataSet[DicomTags.ScheduledProcedureStepSequence];
                if (attrib.IsNull)
                {
                    requiredMatchingKeyMissing = true;
                    comment = "Missing Scheduled Procedure Step Sequence";
                    break;
                }
                DicomAttributeSQ sequence = attrib as DicomAttributeSQ;
                if (attrib.Count == 0)
                {
                   requiredMatchingKeyMissing = true;                 
                   comment = "Scheduled Procedure Step Sequence is empty";
                   break;
                }
                if (attrib.Count > 1)
                {
                   requiredMatchingKeyMissing = true;                 
                   comment = "Found Multiple Items in Scheduled Procedure Step Sequence";
                   break;
                }
                
                DicomSequenceItem sequenceSubItems = sequence[0];
                
                if (sequenceSubItems[DicomTags.ScheduledStationAeTitle].IsNull)
                {
                   requiredMatchingKeyMissing = true;
                   comment = "Missing Scheduled Station Ae Title";
                   break;
                }

                if (sequenceSubItems[DicomTags.Modality].IsNull)
                {
                   requiredMatchingKeyMissing = true;                 
                   comment = "Missing Modality";
                   break;
                }

                if (sequenceSubItems[DicomTags.ScheduledPerformingPhysiciansName].IsNull)
                {
                   requiredMatchingKeyMissing = true;                 
                   comment = "Missing Scheduled Performing Physicians Name";
                   break;
                }

                if (sequenceSubItems[DicomTags.ScheduledProcedureStepStartDate].IsNull)
                {
                   requiredMatchingKeyMissing = true;                 
                   comment = "Missing ScheduledProcedureStepStartDate";
                   break;
                }

                if (sequenceSubItems[DicomTags.ScheduledProcedureStepStartTime].IsNull)
                {
                   requiredMatchingKeyMissing = true;                 
                   comment = "Missing Scheduled Procedure Step Start Time";
                   break;
                }
	         
	        } while (false);

             // send specific error status to the calling AE
            if (requiredMatchingKeyMissing)
            {
                Platform.Log(LogLevel.Error, "Required matching key missing on query from {0},"+
                                             "\n Sending Failure Status Identifier Does Not Match SOPClass.",
                                             server.AssociationParams.CallingAE);
                Platform.Log(LogLevel.Error, "Error Details : {0},"+ comment);
                DicomMessage errorResponse = new DicomMessage();
                server.SendCFindResponse(presentationID, message.MessageId, errorResponse,
                                     DicomStatuses.QueryRetrieveIdentifierDoesNotMatchSOPClass);                 
            }

            return requiredMatchingKeyMissing;            
        }
开发者ID:khaha2210,项目名称:radio,代码行数:82,代码来源:MWLScp.cs

示例10: SendBufferedResponses

 private void SendBufferedResponses(DicomServer server, byte presentationId, DicomMessage requestMessage,DicomStatus pendingStatus)
 {
     while (_responseQueue.Count > 0)
     {
         DicomMessage response = _responseQueue.Dequeue();
         //_sessionDebug._responses.Add(response.Dump());
         server.SendCFindResponse(presentationId, requestMessage.MessageId, response,
                  pendingStatus);
         Platform.Log(LogLevel.Info, "Sending a Worklist Response ");
         if (_cancelReceived)
             throw new DicomException("DICOM C-Cancel Received");
     }
 }         
开发者ID:khaha2210,项目名称:radio,代码行数:13,代码来源:MWLScp.cs

示例11: DateTime

        void IDicomServerHandler.OnReceiveRequestMessage(DicomServer server, ServerAssociationParameters association,
                                                         byte presentationID, DicomMessage message)
        {
            if (message.CommandField == DicomCommandField.CEchoRequest)
            {
                server.SendCEchoResponse(presentationID, message.MessageId, DicomStatuses.Success);
                return;
            }
            ushort id = message.MessageId;
            String studyInstanceUid = null;
            String seriesInstanceUid = null;
            DicomUid sopInstanceUid;
            String patientId = null;
            string patientsName = string.Empty;
            DateTime scheduledProcedureStepStartDate = new DateTime();
            PatientIdentificationModuleIod patientIdentificationModuleIod = new PatientIdentificationModuleIod(message.DataSet);
            PatientMedicalModule patientMedicalModule = new PatientMedicalModule(message.DataSet);
            ImagingServiceRequestModule imagingServiceRequestModule = new ImagingServiceRequestModule(message.DataSet);
            ModalityWorklistIod modalityWorklistIod = new ModalityWorklistIod();
            modalityWorklistIod.SetCommonTags();

            DicomSequenceItem[] seq = message.DataSet[DicomTags.ScheduledProcedureStepSequence].Values as DicomSequenceItem[];
            bool patientIdExist = message.DataSet[DicomTags.PatientId].TryGetString(0, out patientId);
            message.DataSet[DicomTags.PatientsName].TryGetString(0, out patientsName);
            if (seq != null)
            {
                bool ok = seq[0][DicomTags.ScheduledProcedureStepStartDate].TryGetDateTime(0, out scheduledProcedureStepStartDate);
                

                if (!(ok|patientIdExist))
                {
                    Platform.Log(LogLevel.Error, "Unable to retrieve UIDs from request message, sending failure status.");

                    server.SendCFindCancelRequest(presentationID, message.MessageId);
                    return;
                }
            }

            message.DataSet[DicomTags.SpecificCharacterSet].SetStringValue("ISO_IR 100");
            message.DataSet.RemoveAttribute(DicomTags.ReferencedStudySequence);

            DataSet ds = GetPatientList(scheduledProcedureStepStartDate, scheduledProcedureStepStartDate, patientId, patientsName, 1);
            if (ds != null)
            {
                
                foreach (DataRow _row in ds.Tables[0].Rows)
                {
                    message.CommandSet.RemoveAttribute(DicomTags.MessageId);
                    Platform.Log(LogLevel.Debug, "Test", _row);
                    message.DataSet[DicomTags.PatientId].SetStringValue(_row["Patient_ID"].ToString());
                    message.DataSet[DicomTags.PatientsName].SetStringValue(_row["Nosign_name"].ToString());
                    message.DataSet[DicomTags.AccessionNumber].SetStringValue(_row["Barcode"].ToString());
                    if(_row["Sex"].ToString() == "1")
                    {
                        message.DataSet[DicomTags.PatientsSex].SetStringValue("M");
                    }
                    else
                    {
                        message.DataSet[DicomTags.PatientsSex].SetStringValue("F");
                    }
                    message.DataSet[DicomTags.PatientsBirthDate].SetNullValue();
                    message.DataSet[DicomTags.PatientsAge].SetStringValue(_row["AGE"].ToString());

                    //message.DataSet[DicomTags.RequestedProcedureId].SetStringValue("0000018705");
                    message.DataSet[DicomTags.StudyInstanceUid].SetUid(0, DicomUid.GenerateUid());

                    seq[0].RemoveAttribute(DicomTags.ScheduledProtocolCodeSequence);

                    //message.DataSet[DicomTags.ScheduledProcedureStepSequence].SetEmptyValue();
                    seq[0][DicomTags.Modality].SetStringValue("CR");
                    seq[0][DicomTags.ScheduledStationAeTitle].SetStringValue("VIETBAIT");

                    seq[0][DicomTags.ScheduledProcedureStepStartDate].SetDateTime(0, new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day));
                    seq[0][DicomTags.ScheduledProcedureStepStartTime].SetNullValue();
                    
                    DataTable tblTestList = GetTestList(_row["PID"].ToString());
                    string _testListString = string.Empty;
                    foreach (DataRow testListRow in tblTestList.Rows)
                    {
                       _testListString = string.Concat(_testListString, testListRow["CodeMeaning"].ToString(),"\r\n");
                    }
                    seq[0][DicomTags.ScheduledProcedureStepDescription].SetStringValue(_testListString);
                    seq[0].RemoveAttribute(DicomTags.ScheduledProcedureStepId);

                    server.SendCFindResponse(presentationID, id, message, DicomStatuses.Pending);
                }
            }                                       

            
            

            //Platform.Log(LogLevel.Info, "Received SOP Instance: {0} for patient {1} in syntax {2}", sopInstanceUid,
            //             patientName, syntax.Name);
            
            
                        
            
            
            DicomMessage noDataSetMessage = new DicomMessage();

//.........这里部分代码省略.........
开发者ID:khaha2210,项目名称:radio,代码行数:101,代码来源:WorklistScp.cs


注:本文中的ClearCanvas.Dicom.Network.DicomServer.SendCFindResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。