/// <summary> /// Constructor. /// /// Use this constructor to create a new presentation context instance that is to be used in an A-ASSOCIATE-RQ. /// </summary> /// <param name="abstractSyntax">The abstract syntax.</param> /// <param name="transferSyntaxes">The transfer syntaxes (must contain at least one transfer syntax).</param> /// <exception cref="System.ArgumentException">No transfer syntaxes have been supplied.</exception> public PresentationContext(String abstractSyntax, params String[] transferSyntaxes) { // // Check parameter(s). // if (transferSyntaxes.Length < 1) { throw new System.ArgumentException("At least of transfer syntax must be supplied in the PresentationContext constructor."); } // // Create the encapsulated DvtkData instance. // DvtkData.Dul.AbstractSyntax dvtkDataAbstractSyntax = new DvtkData.Dul.AbstractSyntax(abstractSyntax); DvtkData.Dul.TransferSyntax[] dvtkDataTransferSyntaxes = new DvtkData.Dul.TransferSyntax[transferSyntaxes.Length]; for (int index = 0; index < transferSyntaxes.Length; index++) { dvtkDataTransferSyntaxes[index] = new DvtkData.Dul.TransferSyntax(transferSyntaxes[index]); } this.dvtkDataRequestedPresentationContext = new DvtkData.Dul.RequestedPresentationContext(dvtkDataAbstractSyntax, dvtkDataTransferSyntaxes); }
/// <summary> /// Overridden C-FIND-RQ message handler that makes use of the appropriate Information Model to handle the query. /// </summary> /// <param name="queryMessage">C-FIND-RQ Identifier (Dataset) containing query attributes.</param> /// <returns>Boolean - true if dicomMessage handled here.</returns> public override bool HandleCFindRequest(DicomMessage queryMessage) { if (_informationModels == null) return false; // Refresh the Information Models _informationModels.Refresh(); // Validate the received message System.String iodName = DicomThread.GetIodNameFromDefinition(queryMessage); DicomThread.Validate(queryMessage, iodName); // try to get the SOP Class Uid so that we know which Information Model to use. DvtkHighLevelInterface.Values values = queryMessage.CommandSet.GetAttributeValues("0x00000002"); System.String sopClassUid = values.GetString(1); DvtkData.Dul.AbstractSyntax abstractSyntax = new DvtkData.Dul.AbstractSyntax(sopClassUid); // check if we should use the Patient Root Information Model if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Patient_Root_Query_Retrieve_Information_Model_FIND.UID) && (_informationModels.PatientRoot != null)) { DicomMessageCollection responseMessages = _informationModels.PatientRoot.QueryInformationModel(queryMessage); foreach (DicomMessage responseMessage in responseMessages) { this.Send(responseMessage); } } // check if we should use the Study Root Information Model else if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Study_Root_Query_Retrieve_Information_Model_FIND.UID) && (_informationModels.StudyRoot != null)) { DicomMessageCollection responseMessages = _informationModels.StudyRoot.QueryInformationModel(queryMessage); foreach (DicomMessage responseMessage in responseMessages) { this.Send(responseMessage); } } // check if we should use the Patient Study Only Information Model else if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Patient_Study_Only_Query_Retrieve_Information_Model_FIND.UID) && (_informationModels.PatientStudyOnly != null)) { DicomMessageCollection responseMessages = _informationModels.PatientStudyOnly.QueryInformationModel(queryMessage); foreach (DicomMessage responseMessage in responseMessages) { this.Send(responseMessage); } } else { // should never get here - but send a final CFINDRSP anyway DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CFINDRSP); this.Send(responseMessage); } // message handled return true; }
public override bool HandleCMoveRequest(DicomMessage retrieveMessage) { if (_informationModels == null) { return(false); } // Refresh the Information Models _informationModels.Refresh(); // Validate the received message System.String iodName = DicomThread.GetIodNameFromDefinition(retrieveMessage); DicomThread.Validate(retrieveMessage, iodName); // try to get the SOP Class Uid so that we know which Information Model to use. DvtkHighLevelInterface.Values values = retrieveMessage.CommandSet.GetAttributeValues("0x00000002"); System.String sopClassUid = values.GetString(1); DvtkData.Dul.AbstractSyntax abstractSyntax = new DvtkData.Dul.AbstractSyntax(sopClassUid); // try to get the Move Destination AE. values = retrieveMessage.CommandSet.GetAttributeValues("0x00000600"); System.String moveDestinationAE = values.GetString(1); DvtkData.Collections.StringCollection retrieveList = null; // check if we should use the Patient Root Information Model if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Patient_Root_Query_Retrieve_Information_Model_MOVE.UID) && (_informationModels.PatientRoot != null)) { retrieveList = _informationModels.PatientRoot.RetrieveInformationModel(retrieveMessage); } // check if we should use the Study Root Information Model else if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Study_Root_Query_Retrieve_Information_Model_MOVE.UID) && (_informationModels.StudyRoot != null)) { retrieveList = _informationModels.StudyRoot.RetrieveInformationModel(retrieveMessage); } // check if we should use the Patient Study Only Information Model else if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Patient_Study_Only_Query_Retrieve_Information_Model_MOVE.UID) && (_informationModels.PatientStudyOnly != null)) { retrieveList = _informationModels.PatientStudyOnly.RetrieveInformationModel(retrieveMessage); } // process the retrieve list return(ProcessRetrieveList(moveDestinationAE, retrieveList)); }
public override bool HandleCMoveRequest(DicomMessage retrieveMessage) { if (_informationModels == null) return false; // Refresh the Information Models _informationModels.Refresh(); // Validate the received message System.String iodName = DicomThread.GetIodNameFromDefinition(retrieveMessage); DicomThread.Validate(retrieveMessage, iodName); // try to get the SOP Class Uid so that we know which Information Model to use. DvtkHighLevelInterface.Values values = retrieveMessage.CommandSet.GetAttributeValues("0x00000002"); System.String sopClassUid = values.GetString(1); DvtkData.Dul.AbstractSyntax abstractSyntax = new DvtkData.Dul.AbstractSyntax(sopClassUid); // try to get the Move Destination AE. values = retrieveMessage.CommandSet.GetAttributeValues("0x00000600"); System.String moveDestinationAE = values.GetString(1); DvtkData.Collections.StringCollection retrieveList = null; // check if we should use the Patient Root Information Model if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Patient_Root_Query_Retrieve_Information_Model_MOVE.UID) && (_informationModels.PatientRoot != null)) { retrieveList = _informationModels.PatientRoot.RetrieveInformationModel(retrieveMessage); } // check if we should use the Study Root Information Model else if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Study_Root_Query_Retrieve_Information_Model_MOVE.UID) && (_informationModels.StudyRoot != null)) { retrieveList = _informationModels.StudyRoot.RetrieveInformationModel(retrieveMessage); } // check if we should use the Patient Study Only Information Model else if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Patient_Study_Only_Query_Retrieve_Information_Model_MOVE.UID) && (_informationModels.PatientStudyOnly != null)) { retrieveList = _informationModels.PatientStudyOnly.RetrieveInformationModel(retrieveMessage); } // process the retrieve list return ProcessRetrieveList(moveDestinationAE, retrieveList); }
public override bool HandleCMoveRequest(DicomMessage retrieveMessage) { // try to get the SOP Class Uid so that we know which Information Model to use. DvtkHighLevelInterface.Dicom.Other.Values values = retrieveMessage.CommandSet["0x00000002"].Values; System.String sopClassUid = values[0]; DvtkData.Dul.AbstractSyntax abstractSyntax = new DvtkData.Dul.AbstractSyntax(sopClassUid); // try to get the Move Destination AE. values = retrieveMessage.CommandSet["0x00000600"].Values; string vr = retrieveMessage.CommandSet["0x00000600"].VR.ToString(); System.String moveDestinationAE = values[0]; string hexString = moveDestinationAE; System.Text.StringBuilder sb = new System.Text.StringBuilder(); if (DicomThread.Options.LoadedDefinitionFileNames.Length < 10) WriteWarning("Some of the definition files is not loaded properly."); if (vr == "UN") { for (int i = 0; i <= hexString.Length - 2; i += 2) { sb.Append(Convert.ToString(Convert.ToChar(Int32.Parse(hexString.Substring(i, 2), System.Globalization.NumberStyles.HexNumber)))); } } else if (vr == "AE") { sb.Append(moveDestinationAE); } if (moveDestinationAE == null || moveDestinationAE=="") { DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CMOVERSP); responseMessage.Set("0x00000900", VR.US, 0xA801); responseMessage.Set("0x00000902", VR.LO, "Unknown Move Destination"); this.Send(responseMessage); return(true); } MoveAEdetailsIndex=FindMoveAEDetails(sb.ToString()); if (IsHaveMoveDestinations && MoveAEdetailsIndex == -1) { DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CMOVERSP); responseMessage.Set("0x00000900", VR.US, 0xA801); responseMessage.Set("0x00000902", VR.LO, "Move Destination not registered in SCP"); this.Send(responseMessage); WriteWarning("Move destination is not registered in SCP"); return (true); } DvtkData.Collections.StringCollection retrieveList = null; // check if we should use the Patient Root Information Model if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Patient_Root_Query_Retrieve_Information_Model_MOVE.UID) && (PatientRootInformationModel != null)) { // check if the information model should be refreshed before retrieving if (RefreshInformationModelBeforeUse == true) { PatientRootInformationModel.RefreshInformationModel(); } // perform retrieve retrieveList = PatientRootInformationModel.RetrieveInformationModel(retrieveMessage); } // check if we should use the Study Root Information Model else if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Study_Root_Query_Retrieve_Information_Model_MOVE.UID) && (StudyRootInformationModel != null)) { // check if the information model should be refreshed before retrieving if (RefreshInformationModelBeforeUse == true) { StudyRootInformationModel.RefreshInformationModel(); } // perform retrieve retrieveList = StudyRootInformationModel.RetrieveInformationModel(retrieveMessage); } // check if we should use the Patient Study Only Information Model else if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Patient_Study_Only_Query_Retrieve_Information_Model_MOVE.UID) && (PatientStudyOnlyInformationModel != null)) { // check if the information model should be refreshed before retrieving if (RefreshInformationModelBeforeUse == true) { PatientStudyOnlyInformationModel.RefreshInformationModel(); } // perform retrieve retrieveList = PatientStudyOnlyInformationModel.RetrieveInformationModel(retrieveMessage); } // process the retrieve list return ProcessRetrieveList(moveDestinationAE, retrieveList); }
public override bool HandleCMoveRequest(DicomMessage retrieveMessage) { // try to get the SOP Class Uid so that we know which Information Model to use. DvtkHighLevelInterface.Dicom.Other.Values values = retrieveMessage.CommandSet["0x00000002"].Values; System.String sopClassUid = values[0]; DvtkData.Dul.AbstractSyntax abstractSyntax = new DvtkData.Dul.AbstractSyntax(sopClassUid); // try to get the Move Destination AE. values = retrieveMessage.CommandSet["0x00000600"].Values; string vr = retrieveMessage.CommandSet["0x00000600"].VR.ToString(); System.String moveDestinationAE = values[0]; string hexString = moveDestinationAE; System.Text.StringBuilder sb = new System.Text.StringBuilder(); if (DicomThread.Options.LoadedDefinitionFileNames.Length < 10) { WriteWarning("Some of the definition files is not loaded properly."); } if (vr == "UN") { for (int i = 0; i <= hexString.Length - 2; i += 2) { sb.Append(Convert.ToString(Convert.ToChar(Int32.Parse(hexString.Substring(i, 2), System.Globalization.NumberStyles.HexNumber)))); } } else if (vr == "AE") { sb.Append(moveDestinationAE); } if (moveDestinationAE == null || moveDestinationAE == "") { DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CMOVERSP); responseMessage.Set("0x00000900", VR.US, 0xA801); responseMessage.Set("0x00000902", VR.LO, "Unknown Move Destination"); this.Send(responseMessage); return(true); } MoveAEdetailsIndex = FindMoveAEDetails(sb.ToString()); if (IsHaveMoveDestinations && MoveAEdetailsIndex == -1) { DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CMOVERSP); responseMessage.Set("0x00000900", VR.US, 0xA801); responseMessage.Set("0x00000902", VR.LO, "Move Destination not registered in SCP"); this.Send(responseMessage); WriteWarning("Move destination is not registered in SCP"); return(true); } DvtkData.Collections.StringCollection retrieveList = null; // check if we should use the Patient Root Information Model if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Patient_Root_Query_Retrieve_Information_Model_MOVE.UID) && (PatientRootInformationModel != null)) { // check if the information model should be refreshed before retrieving if (RefreshInformationModelBeforeUse == true) { PatientRootInformationModel.RefreshInformationModel(); } // perform retrieve retrieveList = PatientRootInformationModel.RetrieveInformationModel(retrieveMessage); } // check if we should use the Study Root Information Model else if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Study_Root_Query_Retrieve_Information_Model_MOVE.UID) && (StudyRootInformationModel != null)) { // check if the information model should be refreshed before retrieving if (RefreshInformationModelBeforeUse == true) { StudyRootInformationModel.RefreshInformationModel(); } // perform retrieve retrieveList = StudyRootInformationModel.RetrieveInformationModel(retrieveMessage); } // check if we should use the Patient Study Only Information Model else if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Patient_Study_Only_Query_Retrieve_Information_Model_MOVE.UID) && (PatientStudyOnlyInformationModel != null)) { // check if the information model should be refreshed before retrieving if (RefreshInformationModelBeforeUse == true) { PatientStudyOnlyInformationModel.RefreshInformationModel(); } // perform retrieve retrieveList = PatientStudyOnlyInformationModel.RetrieveInformationModel(retrieveMessage); } // process the retrieve list return(ProcessRetrieveList(moveDestinationAE, retrieveList)); }
/// <summary> /// Overridden C-FIND-RQ message handler that makes use of the appropriate Information Model to handle the query. /// </summary> /// <param name="queryMessage">C-FIND-RQ Identifier (Dataset) containing query attributes.</param> /// <returns>Boolean - true if dicomMessage handled here.</returns> public override bool HandleCFindRequest(DicomMessage queryMessage) { if (_informationModels == null) { return(false); } // Refresh the Information Models _informationModels.Refresh(); // Validate the received message System.String iodName = DicomThread.GetIodNameFromDefinition(queryMessage); DicomThread.Validate(queryMessage, iodName); // try to get the SOP Class Uid so that we know which Information Model to use. DvtkHighLevelInterface.Values values = queryMessage.CommandSet.GetAttributeValues("0x00000002"); System.String sopClassUid = values.GetString(1); DvtkData.Dul.AbstractSyntax abstractSyntax = new DvtkData.Dul.AbstractSyntax(sopClassUid); // check if we should use the Patient Root Information Model if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Patient_Root_Query_Retrieve_Information_Model_FIND.UID) && (_informationModels.PatientRoot != null)) { DicomMessageCollection responseMessages = _informationModels.PatientRoot.QueryInformationModel(queryMessage); foreach (DicomMessage responseMessage in responseMessages) { this.Send(responseMessage); } } // check if we should use the Study Root Information Model else if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Study_Root_Query_Retrieve_Information_Model_FIND.UID) && (_informationModels.StudyRoot != null)) { DicomMessageCollection responseMessages = _informationModels.StudyRoot.QueryInformationModel(queryMessage); foreach (DicomMessage responseMessage in responseMessages) { this.Send(responseMessage); } } // check if we should use the Patient Study Only Information Model else if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Patient_Study_Only_Query_Retrieve_Information_Model_FIND.UID) && (_informationModels.PatientStudyOnly != null)) { DicomMessageCollection responseMessages = _informationModels.PatientStudyOnly.QueryInformationModel(queryMessage); foreach (DicomMessage responseMessage in responseMessages) { this.Send(responseMessage); } } else { // should never get here - but send a final CFINDRSP anyway DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CFINDRSP); this.Send(responseMessage); } // message handled return(true); }
/// <summary> /// Overridden C-FIND-RQ message handler that makes use of the appropriate Information Model to handle the query. /// </summary> /// <param name="queryMessage">C-FIND-RQ Identifier (Dataset) containing query attributes.</param> /// <returns>Boolean - true if dicomMessage handled here.</returns> public override bool HandleCFindRequest(DicomMessage queryMessage) { // Validate the received message //System.String iodName = DicomThread.GetIodNameFromDefinition(queryMessage); //DicomThread.Validate(queryMessage, iodName); // try to get the SOP Class Uid so that we know which Information Model to use. DvtkHighLevelInterface.Dicom.Other.Values values = queryMessage.CommandSet["0x00000002"].Values; System.String sopClassUid = values[0]; DvtkData.Dul.AbstractSyntax abstractSyntax = new DvtkData.Dul.AbstractSyntax(sopClassUid); // check if we should use the Patient Root Information Model if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Patient_Root_Query_Retrieve_Information_Model_FIND.UID) && (PatientRootInformationModel != null)) { // check if the information model should be refreshed before querying if (RefreshInformationModelBeforeUse == true) { PatientRootInformationModel.RefreshInformationModel(); } // perform query DicomMessageCollection responseMessages = PatientRootInformationModel.QueryInformationModel(queryMessage); // handle responses foreach (DicomMessage responseMessage in responseMessages) { int waitedTime = 0; // Check for cancel message from SCU if (WaitForPendingDataInNetworkInputBuffer(100, ref waitedTime)) { DicomMessage cancelRq = ReceiveDicomMessage(); if (cancelRq.CommandSet.DimseCommand == DvtkData.Dimse.DimseCommand.CCANCELRQ) { // set up the C-FIND-RSP with cancel status DicomMessage respMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CFINDRSP); respMessage.Set("0x00000900", DvtkData.Dimse.VR.US, 0xFE00); // send the response this.Send(respMessage); break; } } this.Send(responseMessage); } } // check if we should use the Study Root Information Model else if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Study_Root_Query_Retrieve_Information_Model_FIND.UID) && (StudyRootInformationModel != null)) { // check if the information model should be refreshed before querying if (RefreshInformationModelBeforeUse == true) { StudyRootInformationModel.RefreshInformationModel(); } // perform query DicomMessageCollection responseMessages = StudyRootInformationModel.QueryInformationModel(queryMessage); // handle responses foreach (DicomMessage responseMessage in responseMessages) { int waitedTime = 0; // Check for cancel message from SCU if (WaitForPendingDataInNetworkInputBuffer(100, ref waitedTime)) { DicomMessage cancelRq = ReceiveDicomMessage(); if (cancelRq.CommandSet.DimseCommand == DvtkData.Dimse.DimseCommand.CCANCELRQ) { // set up the C-FIND-RSP with cancel status DicomMessage respMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CFINDRSP); respMessage.Set("0x00000900", DvtkData.Dimse.VR.US, 0xFE00); // send the response this.Send(respMessage); break; } } this.Send(responseMessage); } } // check if we should use the Patient Study Only Information Model else if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Patient_Study_Only_Query_Retrieve_Information_Model_FIND.UID) && (PatientStudyOnlyInformationModel != null)) { // check if the information model should be refreshed before querying if (RefreshInformationModelBeforeUse == true) { PatientStudyOnlyInformationModel.RefreshInformationModel(); } // perform query DicomMessageCollection responseMessages = PatientStudyOnlyInformationModel.QueryInformationModel(queryMessage); // handle responses foreach (DicomMessage responseMessage in responseMessages) { int waitedTime = 0; // Check for cancel message from SCU if (WaitForPendingDataInNetworkInputBuffer(100, ref waitedTime)) { DicomMessage cancelRq = ReceiveDicomMessage(); if (cancelRq.CommandSet.DimseCommand == DvtkData.Dimse.DimseCommand.CCANCELRQ) { // set up the C-FIND-RSP with cancel status DicomMessage respMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CFINDRSP); respMessage.Set("0x00000900", DvtkData.Dimse.VR.US, 0xFE00); // send the response this.Send(respMessage); break; } } this.Send(responseMessage); } } else { // should never get here - but send a final CFINDRSP anyway DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CFINDRSP); this.Send(responseMessage); } // message handled return(true); }
/// <summary> /// Overridden C-FIND-RQ message handler that makes use of the appropriate Information Model to handle the query. /// </summary> /// <param name="queryMessage">C-FIND-RQ Identifier (Dataset) containing query attributes.</param> /// <returns>Boolean - true if dicomMessage handled here.</returns> public override bool HandleCFindRequest(DicomMessage queryMessage) { // Validate the received message //System.String iodName = DicomThread.GetIodNameFromDefinition(queryMessage); //DicomThread.Validate(queryMessage, iodName); // try to get the SOP Class Uid so that we know which Information Model to use. DvtkHighLevelInterface.Dicom.Other.Values values = queryMessage.CommandSet["0x00000002"].Values; System.String sopClassUid = values[0]; DvtkData.Dul.AbstractSyntax abstractSyntax = new DvtkData.Dul.AbstractSyntax(sopClassUid); // check if we should use the Patient Root Information Model if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Patient_Root_Query_Retrieve_Information_Model_FIND.UID) && (PatientRootInformationModel != null)) { // check if the information model should be refreshed before querying if (RefreshInformationModelBeforeUse == true) { PatientRootInformationModel.RefreshInformationModel(); } // perform query DicomMessageCollection responseMessages = PatientRootInformationModel.QueryInformationModel(queryMessage); // handle responses foreach (DicomMessage responseMessage in responseMessages) { int waitedTime = 0; // Check for cancel message from SCU if (WaitForPendingDataInNetworkInputBuffer(100, ref waitedTime)) { DicomMessage cancelRq = ReceiveDicomMessage(); if (cancelRq.CommandSet.DimseCommand == DvtkData.Dimse.DimseCommand.CCANCELRQ) { // set up the C-FIND-RSP with cancel status DicomMessage respMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CFINDRSP); respMessage.Set("0x00000900", DvtkData.Dimse.VR.US, 0xFE00); // send the response this.Send(respMessage); break; } } this.Send(responseMessage); } } // check if we should use the Study Root Information Model else if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Study_Root_Query_Retrieve_Information_Model_FIND.UID) && (StudyRootInformationModel != null)) { // check if the information model should be refreshed before querying if (RefreshInformationModelBeforeUse == true) { StudyRootInformationModel.RefreshInformationModel(); } // perform query DicomMessageCollection responseMessages = StudyRootInformationModel.QueryInformationModel(queryMessage); // handle responses foreach (DicomMessage responseMessage in responseMessages) { int waitedTime = 0; // Check for cancel message from SCU if (WaitForPendingDataInNetworkInputBuffer(100, ref waitedTime)) { DicomMessage cancelRq = ReceiveDicomMessage(); if (cancelRq.CommandSet.DimseCommand == DvtkData.Dimse.DimseCommand.CCANCELRQ) { // set up the C-FIND-RSP with cancel status DicomMessage respMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CFINDRSP); respMessage.Set("0x00000900", DvtkData.Dimse.VR.US, 0xFE00); // send the response this.Send(respMessage); break; } } this.Send(responseMessage); } } // check if we should use the Patient Study Only Information Model else if ((abstractSyntax.UID == DvtkData.Dul.AbstractSyntax.Patient_Study_Only_Query_Retrieve_Information_Model_FIND.UID) && (PatientStudyOnlyInformationModel != null)) { // check if the information model should be refreshed before querying if (RefreshInformationModelBeforeUse == true) { PatientStudyOnlyInformationModel.RefreshInformationModel(); } // perform query DicomMessageCollection responseMessages = PatientStudyOnlyInformationModel.QueryInformationModel(queryMessage); // handle responses foreach (DicomMessage responseMessage in responseMessages) { int waitedTime = 0; // Check for cancel message from SCU if (WaitForPendingDataInNetworkInputBuffer(100, ref waitedTime)) { DicomMessage cancelRq = ReceiveDicomMessage(); if (cancelRq.CommandSet.DimseCommand == DvtkData.Dimse.DimseCommand.CCANCELRQ) { // set up the C-FIND-RSP with cancel status DicomMessage respMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CFINDRSP); respMessage.Set("0x00000900", DvtkData.Dimse.VR.US, 0xFE00); // send the response this.Send(respMessage); break; } } this.Send(responseMessage); } } else { // should never get here - but send a final CFINDRSP anyway DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CFINDRSP); this.Send(responseMessage); } // message handled return true; }