private Dvtk.Sessions.ValidationControlFlags ValidateUseDefinitions(DicomThread dicomThread, DicomMessage dicomMessage) { Dvtk.Sessions.ValidationControlFlags validationFlag = Dvtk.Sessions.ValidationControlFlags.None; String iodName = dicomThread.GetIodNameFromDefinition(dicomMessage); if (iodName.Length == 0) { this.thread.WriteWarningInternal("- Skipping definition file validation: unable to find correct definition file for DimseCommand " + dicomMessage.CommandSet.DimseCommand.ToString() + " and SOP Class UID " + dicomMessage.CommandSet.GetSopClassUid() + ". Are the correct definition files loaded?"); } else { if (dicomMessage.IodNamesValidatedAgainst.Contains(iodName)) { this.thread.WriteInformationInternal("- Skipping definition file validation: already performed for \"" + iodName + "\"."); } else { dicomMessage.DataSet.IodId = iodName; dicomMessage.IodNamesValidatedAgainst.Add(iodName); validationFlag = Dvtk.Sessions.ValidationControlFlags.UseDefinitions; this.thread.WriteInformationInternal("- Using \"" + iodName + "\" for definition file validation."); } } return(validationFlag); }
public override bool HandleNSetRequest(DicomMessage dicomMessage) { // Try to get the IOD Name System.String iodName = DicomThread.GetIodNameFromDefinition(dicomMessage); System.String messsage = String.Format("Processed N-SET-RQ {0}", iodName); DicomThread.WriteInformation(messsage); DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.NSETRSP); responseMessage.Set("0x00000900", DvtkData.Dimse.VR.US, 0); this.Send(responseMessage); return(true); }
public override bool HandleCGetRequest(DicomMessage dicomMessage) { // Validate the received message System.String iodName = DicomThread.GetIodNameFromDefinition(dicomMessage); DicomThread.Validate(dicomMessage, iodName); // Storage suboperations should be sent over the same association as the CGET. // The CGET SCU becomes a Storage SCP for the duration of the storage suboperations. // The CGET SCU should ensure that all the necessary storage SOP Classes are negotiated // during association establishment. DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CGETRSP); this.Send(responseMessage); 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)); }
/// <summary> /// Overridden N-ACTION-RQ message handler. /// </summary> /// <param name="queryMessage">N-ACTION-RQ and Dataset.</param> /// <returns>Boolean - true if dicomMessage handled here.</returns> public override bool HandleNActionRequest(DicomMessage dicomMessage) { // Validate the received message System.String iodName = DicomThread.GetIodNameFromDefinition(dicomMessage); DicomThread.Validate(dicomMessage, iodName); // set up the default N-ACTION-RSP with a successful status DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.NACTIONRSP); responseMessage.Set("0x00000900", DvtkData.Dimse.VR.US, 0); // send the response this.Send(responseMessage); // message handled return(true); }
public override bool HandleNCreateRequest(DicomMessage dicomMessage) { // Try to get the IOD Name System.String iodName = DicomThread.GetIodNameFromDefinition(dicomMessage); // Try to get the Patient Name DvtkHighLevelInterface.Dicom.Other.Values attributeValues = dicomMessage["0x00100010"].Values; System.String patientName = attributeValues[0]; System.String messsage = String.Format("Processed N-CREATE-RQ {0}: \"{1}\"", iodName, patientName); WriteInformation(messsage); DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.NCREATERSP); responseMessage.Set("0x00000900", VR.US, 0); this.Send(responseMessage); return(true); }
/// <summary> /// Overridden C-STORE-RQ message handler that makes use of the appropriate Information Model to handle the storage. /// </summary> /// <param name="queryMessage">C-STORE-RQ and Dataset.</param> /// <returns>Boolean - true if dicomMessage handled here.</returns> public override bool HandleCStoreRequest(DicomMessage dicomMessage) { // Validate the received message System.String iodName = DicomThread.GetIodNameFromDefinition(dicomMessage); DicomThread.Validate(dicomMessage, iodName); // update the information models if (_informationModels != null) { // add this dataset to the information models _informationModels.Add(dicomMessage.DataSet); } // set up the default C-STORE-RSP with a successful status DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CSTORERSP); responseMessage.Set("0x00000900", DvtkData.Dimse.VR.US, 0); // send the response 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) { 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); }