/// <summary> /// Send a single image generated from the Default Value Manager and /// the given Modality Worklist Item. /// </summary> /// <param name="startNewSeries">Boolean indicating if this image is part of a new /// Series or not.</param> /// <param name="modalityWorklistItem">Worklist Item used to provide overruling values for /// the Image header.</param> /// <returns>Boolean indicating success or failure.</returns> public bool SendModalityImagesStored(bool startNewSeries, DicomQueryItem modalityWorklistItem) { if (modalityWorklistItem == null) { return(false); } // Update the default SeriesEntity values for the next Storage Message if (startNewSeries == true) { DefaultValueManager.UpdateInstantiatedDefaultTagValues(AffectedEntityEnum.SeriesEntity); } // Use modality Worklist Item to help construct the Storage Message // Get the attribute values to copy DvtkHighLevelInterface.Comparator.Comparator worklistItemComparator = new DvtkHighLevelInterface.Comparator.Comparator("WorklistItemComparator"); DicomComparator dicomWorklistItemComparator = worklistItemComparator.InitializeDicomComparator(modalityWorklistItem.DicomMessage); // Also try to use the MPPS InProgress Message to help construct the Storage Message DvtkHighLevelInterface.Comparator.Comparator mppsInProgressComparator = new DvtkHighLevelInterface.Comparator.Comparator("MppsInProgressComparator"); DicomComparator dicomMppsInProgressComparator = null; if (_nCreateSetMppsInProgress != null) { dicomMppsInProgressComparator = mppsInProgressComparator.InitializeDicomComparator(_nCreateSetMppsInProgress); } // Create the Storage message DvtkHighLevelInterface.Comparator.Comparator storageComparator = new DvtkHighLevelInterface.Comparator.Comparator("StorageComparator"); DvtkHighLevelInterface.Dicom.Messages.DicomMessage cStoreInstance = new DvtkHighLevelInterface.Dicom.Messages.DicomMessage(DvtkData.Dimse.DimseCommand.CSTORERQ); GenerateTriggers.MakeCStoreInstance(DefaultValueManager, cStoreInstance); storageComparator.PopulateDicomMessage(cStoreInstance, dicomWorklistItemComparator); if (dicomMppsInProgressComparator != null) { storageComparator.PopulateDicomMessage(cStoreInstance, dicomMppsInProgressComparator); } // Trigger the C-STORE-RQ Instance DicomTrigger trigger = new DicomTrigger(TransactionNameEnum.RAD_8); trigger.HandleInSingleAssociation = true; trigger.AddItem(cStoreInstance, "1.2.840.10008.5.1.4.1.1.7", "1.2.840.10008.1.2"); // Update the default InstanceEntity values for the next Storage Message DefaultValueManager.UpdateInstantiatedDefaultTagValues(AffectedEntityEnum.InstanceEntity); // RAD-8 - trigger the ImageArchive return(TriggerActorInstances(ActorTypeEnum.ImageArchive, trigger, true)); }
private void listViewMWLRsp_SelectedIndexChanged(object sender, System.EventArgs e) { if (listViewMWLRsp.SelectedIndices[0] != -1) { selectedModalityWorklistItem = (DicomQueryItem)wlmQueryRspItems[listViewMWLRsp.SelectedIndices[0]]; } else { selectedModalityWorklistItem = dummyPatientMWLItem; } this.Close(); this.DialogResult = DialogResult.OK; }
private bool TriggerModalityWorklistQuery(DicomTrigger trigger) { // Start with empty worklist and storage commit items _modalityWorklistItems = new DicomQueryItemCollection(); _storageCommitItems = new ReferencedSopItemCollection(); _nCreateSetMppsInProgress = null; // RAD-5 - trigger the DssOrderFiller bool triggerResult = TriggerActorInstances(ActorTypeEnum.DssOrderFiller, trigger, true); // Get the worklist items returned if (triggerResult == true) { foreach (ActorsTransaction actorsTransaction in ActorsTransactionLog) { if (actorsTransaction.FromActorName.Type == ActorTypeEnum.DssOrderFiller) { BaseTransaction baseTransaction = actorsTransaction.Transaction; if (baseTransaction is DicomTransaction) { DicomTransaction dicomTransaction = (DicomTransaction)baseTransaction; if (dicomTransaction.Processed == false) { DicomMessageCollection cFindResponses = dicomTransaction.DicomMessages.CFindResponses; int index = 0; foreach (DvtkHighLevelInterface.Dicom.Messages.DicomMessage dicomMessage in cFindResponses) { if (dicomMessage.DataSet.Count != 0) { DicomQueryItem dicomWorklistItem = new DicomQueryItem(index++, dicomMessage); _modalityWorklistItems.Add(dicomWorklistItem); } } dicomTransaction.Processed = true; } } } } } return(triggerResult); }
/// <summary> /// Send all the images found in the data directory mapped from the given /// Modality Worklist item - the MapWorklistItemToStorageDirectory defines /// the data directory / worklist item attribute value mapping. /// </summary> /// <param name="modalityWorklistItem">Worklist Item used to provide overruling values for /// the Image headers.</param> /// <param name="withSingleAssociation">Boolean indicating whether the images should be sent in a single /// association or not.</param> /// <returns>Boolean indicating success or failure.</returns> public bool SendModalityImagesStored(DicomQueryItem modalityWorklistItem, bool withSingleAssociation) { if (modalityWorklistItem == null) { return(false); } // use the MapWorklistItemToStorageDirectory to get the MapTag DvtkData.Dimse.Tag mapTag = _mapWorklistItemToStorageDirectory.MapTag; if (mapTag == null) { throw new System.Exception("No MapTag defined for MapWorklistItemToStorageDirectory."); } // The MapTag is then used to search the worklist item for a matching description // - first try in the Scheduled Procedure Step Sequence System.String description = modalityWorklistItem.GetValue(Tag.SCHEDULED_PROCEDURE_STEP_SEQUENCE, mapTag); if (description == "Default") { // - now try in the remaining dataset description = modalityWorklistItem.GetValue(mapTag); } // Use the description to get the storage directory containing the DCM files that should be sent System.String storageDirectory = _mapWorklistItemToStorageDirectory.GetStorageDirectory(description); if (storageDirectory == System.String.Empty) { // Try the default mapping storageDirectory = _mapWorklistItemToStorageDirectory.GetStorageDirectory("Default"); } if (storageDirectory == System.String.Empty) { System.String message = System.String.Format("No storageDirectory mapping found for description \"{0}\" or \"Default\".", description); throw new System.Exception(message); } // Send the contents of the storage directory - updated by the modality worklist item contents return(SendModalityImagesStored(storageDirectory, modalityWorklistItem, withSingleAssociation)); }
private bool TriggerModalityProcedureStepInProgress(DicomQueryItem modalityWorklistItem) { // Use modality Worklist Item to help construct the MPPS InProgress Message // Get the attribute values to copy DvtkHighLevelInterface.Comparator.Comparator worklistItemComparator = new DvtkHighLevelInterface.Comparator.Comparator("WorklistItemComparator"); DicomComparator dicomWorklistItemComparator = worklistItemComparator.InitializeDicomComparator(modalityWorklistItem.DicomMessage); DvtkHighLevelInterface.Comparator.Comparator mppsInProgressComparator = new DvtkHighLevelInterface.Comparator.Comparator("MppsInProgressComparator"); mppsInProgressComparator.PopulateDicomMessage(_nCreateSetMppsInProgress, dicomWorklistItemComparator); // Trigger the N-CREATE-RQ MPPS InProgress DicomTrigger trigger = new DicomTrigger(TransactionNameEnum.RAD_6); trigger.AddItem(_nCreateSetMppsInProgress, "1.2.840.10008.3.1.2.3.3", "1.2.840.10008.1.2"); // Update the default PerformedProcedureStepEntity values for the next MPPS In-Progress DefaultValueManager.UpdateInstantiatedDefaultTagValues(AffectedEntityEnum.PerformedProcedureStepEntity); // RAD-6 - trigger the PerformedProcedureStepManager return(TriggerActorInstances(ActorTypeEnum.PerformedProcedureStepManager, trigger, true)); }
private void PreparePatientList() { //Read the dataset of dummy patient and add this as default WLM Response DicomFile dcmFile = new DicomFile(); string definitionDir = Environment.GetEnvironmentVariable("COMMONPROGRAMFILES") + @"\DVTk\Definition Files\DICOM\"; string defFile = definitionDir + "Allotherattributes.def"; dcmFile.Read(Application.StartupPath + @"\data\worklist\WLM RSP\DummyPatient.dcm", defFile); DicomMessage dummyPatient = new DicomMessage(DvtkData.Dimse.DimseCommand.CFINDRSP); dummyPatient.Set("0x00000002", DvtkData.Dimse.VR.UI, "1.2.840.10008.5.1.4.31"); dummyPatient.DataSet.DvtkDataDataSet = dcmFile.DataSet.DvtkDataDataSet; dummyPatientMWLItem = new DicomQueryItem(-1, dummyPatient.Clone()); wlmQueryRspItems.Add(dummyPatientMWLItem); //Add all received WLM Query response items if ((queryRspItems != null) && (queryRspItems.Count > 0)) { foreach (DicomQueryItem mwlItem in queryRspItems) { wlmQueryRspItems.Add(mwlItem); } } else { this.Text = "Please Select Dummy patient"; } //Update the patient listbox for display foreach (DicomQueryItem mwlItem in wlmQueryRspItems) { HLI.Attribute schAETitleAttr = null; if (mwlItem.DicomMessage.DataSet.Exists("0x00400100[1]/0x00400001")) { schAETitleAttr = mwlItem.DicomMessage.DataSet["0x00400100[1]/0x00400001"]; if (schAETitleAttr.Values.Count > 1) { ListViewItem emptyItem = new ListViewItem(""); emptyItem.SubItems.Add(""); emptyItem.SubItems.Add(""); emptyItem.SubItems.Add(""); emptyItem.SubItems.Add(""); emptyItem.SubItems.Add(""); emptyItem.SubItems.Add(""); listViewMWLRsp.Items.Add(emptyItem); continue; } } HLI.Attribute patientNameAttr = null; if (mwlItem.DicomMessage.DataSet.Exists("0x00100010")) { patientNameAttr = mwlItem.DicomMessage.DataSet["0x00100010"]; } ListViewItem item = new ListViewItem(patientNameAttr.Values[0]); if (mwlItem.DicomMessage.DataSet.Exists("0x00100020")) { HLI.Attribute patientIDAttr = mwlItem.DicomMessage.DataSet["0x00100020"]; item.SubItems.Add(patientIDAttr.Values[0]); } if (mwlItem.DicomMessage.DataSet.Exists("0x00080050")) { HLI.Attribute accNrAttr = mwlItem.DicomMessage.DataSet["0x00080050"]; item.SubItems.Add(accNrAttr.Values[0]); } if (mwlItem.DicomMessage.DataSet.Exists("0x00401001")) { HLI.Attribute reqProcIDAttr = mwlItem.DicomMessage.DataSet["0x00401001"]; item.SubItems.Add(reqProcIDAttr.Values[0]); } if (mwlItem.DicomMessage.DataSet.Exists("0x00400100[1]/0x00400002")) { HLI.Attribute schProcAttr = mwlItem.DicomMessage.DataSet["0x00400100[1]/0x00400002"]; item.SubItems.Add(schProcAttr.Values[0]); } if (mwlItem.DicomMessage.DataSet.Exists("0x00400100[1]/0x00080060")) { HLI.Attribute modalityAttr = mwlItem.DicomMessage.DataSet["0x00400100[1]/0x00080060"]; item.SubItems.Add(modalityAttr.Values[0]); } if (mwlItem.DicomMessage.DataSet.Exists("0x00400100[1]/0x00400001")) { HLI.Attribute schStationAETitleAttr = mwlItem.DicomMessage.DataSet["0x00400100[1]/0x00400001"]; item.SubItems.Add(schStationAETitleAttr.Values[0]); } listViewMWLRsp.Items.Add(item); } }
/// <summary> /// Send Images - called from GUI IMAGES button /// </summary> public bool SendImages(DicomQueryItem modalityWorklistItem, bool withSingleAssociation, string retrieveAETitle) { // Send the images - read images based on worklist map to storage directory return(_acquisitionModality.SendModalityImagesStored(modalityWorklistItem, withSingleAssociation, retrieveAETitle)); }
/// <summary> /// Send MPPS IN-PROGRESS - called from GUI IN-PROGRESS button /// </summary> public bool SendMppsInProgress(DicomQueryItem modalityWorklistItem, System.String mppsInProgressDcmFilename) { // send the mpps in-progress return(_acquisitionModality.SendNCreateModalityProcedureStepInProgress(mppsInProgressDcmFilename, modalityWorklistItem)); }
/// <summary> /// Send all the images found in the given storage directory. /// </summary> /// <param name="storageDirectory">Given storage directory - containing storage DCM files.</param> /// <param name="modalityWorklistItem">Worklist Item used to provide overruling values for /// the Image headers.</param> /// <param name="withSingleAssociation">Boolean indicating whether the images should be sent in a single /// association or not.</param> /// <returns>Boolean indicating success or failure.</returns> public bool SendModalityImagesStored(System.String storageDirectory, DicomQueryItem modalityWorklistItem, bool withSingleAssociation) { if ((storageDirectory.Length == 0) || (modalityWorklistItem == null)) { return(false); } // Use a hash table to store the instance uid mappings // - the instance uids for the study, series and sop are going to be updated for all the datasets // read from the storageDirectory Hashtable instanceMapper = new Hashtable(); // Get the directory info for the storage directory - and make sure that it exists DirectoryInfo directoryInfo = new DirectoryInfo(storageDirectory); if (directoryInfo.Exists == false) { System.String message = System.String.Format("storageDirectory:\"{0}\" - does not exist.", storageDirectory); throw new System.Exception(message); } // Get a trigger DicomTrigger trigger = new DicomTrigger(TransactionNameEnum.RAD_8); trigger.HandleInSingleAssociation = withSingleAssociation; // Interate over all the DCM files found in the storage directory // - update the instances found with the worklist item contents and // set up the triggers for the Image Archive foreach (FileInfo fileInfo in directoryInfo.GetFiles()) { if ((fileInfo.Extension.ToLower().Equals(".dcm")) || (fileInfo.Extension == System.String.Empty)) { // Read the file meta information - it must be present for this actor DvtkData.Media.FileMetaInformation fileMetaInformation = Dvtk.DvtkDataHelper.ReadFMIFromFile(fileInfo.FullName); if (fileMetaInformation == null) { continue; } // Try to get the transfer syntax uid // - start with Implicit VR Little Endian System.String transferSyntaxUid = "1.2.840.10008.1.2"; DvtkData.Dimse.Attribute attribute = fileMetaInformation.GetAttribute(DvtkData.Dimse.Tag.TRANSFER_SYNTAX_UID); if (attribute != null) { UniqueIdentifier uniqueIdentifier = (UniqueIdentifier)attribute.DicomValue; if (uniqueIdentifier.Values.Count > 0) { transferSyntaxUid = uniqueIdentifier.Values[0]; } } // Read the dataset from the DCM file DvtkData.Dimse.DataSet dataset = Dvtk.DvtkDataHelper.ReadDataSetFromFile(fileInfo.FullName); if (dataset == null) { continue; } // Remove any Group Lengths from the dataset dataset.RemoveGroupLengthAttributes(); // Try to get the series instance uid System.String oldSeriesInstanceUid = System.String.Empty; DvtkData.Dimse.Attribute seriesInstanceUidAttribute = dataset.GetAttribute(Tag.SERIES_INSTANCE_UID); if (seriesInstanceUidAttribute != null) { UniqueIdentifier uniqueIdentifier = (UniqueIdentifier)seriesInstanceUidAttribute.DicomValue; if (uniqueIdentifier.Values.Count > 0) { oldSeriesInstanceUid = uniqueIdentifier.Values[0]; } // Remove the old series instance from the dataset dataset.Remove(seriesInstanceUidAttribute); } // See if a mapping exists System.String newSeriesInstanceUid = (System.String)instanceMapper[oldSeriesInstanceUid]; if (newSeriesInstanceUid == null) { // Add a mapping DefaultValueManager.UpdateInstantiatedDefaultTagValues(AffectedEntityEnum.SeriesEntity); newSeriesInstanceUid = DefaultValueManager.GetInstantiatedValue(Tag.SERIES_INSTANCE_UID); instanceMapper.Add(oldSeriesInstanceUid, newSeriesInstanceUid); } // Add the new series instance uid to the dataset dataset.AddAttribute(Tag.SERIES_INSTANCE_UID.GroupNumber, Tag.SERIES_INSTANCE_UID.ElementNumber, VR.UI, newSeriesInstanceUid); // Try to get the sop instance uid System.String oldSopInstanceUid = System.String.Empty; DvtkData.Dimse.Attribute sopInstanceUidAttribute = dataset.GetAttribute(Tag.SOP_INSTANCE_UID); if (sopInstanceUidAttribute != null) { UniqueIdentifier uniqueIdentifier = (UniqueIdentifier)sopInstanceUidAttribute.DicomValue; if (uniqueIdentifier.Values.Count > 0) { oldSopInstanceUid = uniqueIdentifier.Values[0]; } // Remove the old sop instance from the dataset dataset.Remove(sopInstanceUidAttribute); } // See if a mapping exists System.String newSopInstanceUid = (System.String)instanceMapper[oldSopInstanceUid]; if (newSopInstanceUid == null) { // Add a mapping DefaultValueManager.UpdateInstantiatedDefaultTagValues(AffectedEntityEnum.InstanceEntity); newSopInstanceUid = DefaultValueManager.GetInstantiatedValue(Tag.SOP_INSTANCE_UID); instanceMapper.Add(oldSopInstanceUid, newSopInstanceUid); } // Add the new sop instance uid to the dataset dataset.AddAttribute(Tag.SOP_INSTANCE_UID.GroupNumber, Tag.SOP_INSTANCE_UID.ElementNumber, VR.UI, newSopInstanceUid); // Use modality Worklist Item to help construct the Storage Message // Get the attribute values to copy DvtkHighLevelInterface.Comparator.Comparator worklistItemComparator = new DvtkHighLevelInterface.Comparator.Comparator("WorklistItemComparator"); DicomComparator dicomWorklistItemComparator = worklistItemComparator.InitializeDicomComparator(modalityWorklistItem.DicomMessage); // Also try to use the MPPS InProgress Message to help construct the Storage Message DvtkHighLevelInterface.Comparator.Comparator mppsInProgressComparator = new DvtkHighLevelInterface.Comparator.Comparator("MppsInProgressComparator"); DicomComparator dicomMppsInProgressComparator = null; if (_nCreateSetMppsInProgress != null) { dicomMppsInProgressComparator = mppsInProgressComparator.InitializeDicomComparator(_nCreateSetMppsInProgress); } // Create the Storage message DvtkHighLevelInterface.Comparator.Comparator storageComparator = new DvtkHighLevelInterface.Comparator.Comparator("StorageComparator"); DvtkHighLevelInterface.Dicom.Messages.DicomMessage cStoreInstance = new DvtkHighLevelInterface.Dicom.Messages.DicomMessage(DvtkData.Dimse.DimseCommand.CSTORERQ); GenerateTriggers.MakeCStoreInstance(DefaultValueManager, cStoreInstance, dataset); storageComparator.PopulateDicomMessage(cStoreInstance, dicomWorklistItemComparator); if (dicomMppsInProgressComparator != null) { storageComparator.PopulateDicomMessage(cStoreInstance, dicomMppsInProgressComparator); } // Try to get the sop class uid System.String sopClassUid = System.String.Empty; DvtkData.Dimse.Attribute sopClassUidAttribute = dataset.GetAttribute(Tag.SOP_CLASS_UID); if (sopClassUidAttribute != null) { UniqueIdentifier uniqueIdentifier = (UniqueIdentifier)sopClassUidAttribute.DicomValue; if (uniqueIdentifier.Values.Count > 0) { sopClassUid = uniqueIdentifier.Values[0]; } } // Add trigger item to the trigger trigger.AddItem(cStoreInstance, sopClassUid, transferSyntaxUid); } } // RAD-8 - trigger the ImageArchive return(TriggerActorInstances(ActorTypeEnum.ImageArchive, trigger, true)); }
/// <summary> /// Send an N-SET MPPS IN-PROGRESS message from the given mppsInProgressDcmFilename. /// Use the modalityWorklistItem to overwrite the appropriate attribute values. /// NOTE: This call should only be made after the SendModalityProcedureStepInProgress() (using default N-CREATE) /// has been made. /// </summary> /// <param name="mppsInProgressDcmFilename">DCM Filename - contains MPPS IN-PROGRESS dataset.</param> /// <param name="modalityWorklistItem">Modality Worklist Item used to update MPPS IN-PROGRESS dataset.</param> /// <returns>Boolean indicating success or failure.</returns> public bool SendNSetModalityProcedureStepInProgress(System.String mppsInProgressDcmFilename, DicomQueryItem modalityWorklistItem) { // Initialize the N-SET MPPS IN-PROGRESS InitializeModalityProcedureStepInProgress(DvtkData.Dimse.DimseCommand.NSETRQ); // Generate the N-SET MPPS IN-PROGRESS from the DCM file contents (default values) GenerateTriggers.MakeMppsInProgress(mppsInProgressDcmFilename, DefaultValueManager, _nCreateSetMppsInProgress, _mppsInstanceUid); return(TriggerModalityProcedureStepInProgress(modalityWorklistItem)); }
/// <summary> /// Send a C-MOVE-RQ Information Model Retrieve. /// Retrieve based on the informationModel provided and the query/retrieve level. Take /// the retrieve tags from the retrieveTags provided. The retrieve is done to the move /// destination. /// /// The C-MOVE-RSP messages returned are stored in a DicomQueryItemCollection named RetrieveItems. /// </summary> /// <param name="informationModel">Q/R Information Model to be used in the retrieve operation.</param> /// <param name="level">Query / retrieve level.</param> /// <param name="moveDestination">AE Title of the "move" destination.</param> /// <param name="retrieveTags">List of Retrieve Tags.</param> /// <returns>Boolean indicating success or failure.</returns> public bool SendRetrieveImages(QueryRetrieveInformationModelEnum informationModel, QueryRetrieveLevelEnum level, System.String moveDestination, TagValueCollection retrieveTags) { System.String queryRetrieveLevel = System.String.Empty; switch (level) { case QueryRetrieveLevelEnum.PatientQueryRetrieveLevel: queryRetrieveLevel = "PATIENT"; break; case QueryRetrieveLevelEnum.StudyQueryRetrieveLevel: queryRetrieveLevel = "STUDY"; break; case QueryRetrieveLevelEnum.SeriesQueryRetrieveLevel: queryRetrieveLevel = "SERIES"; break; case QueryRetrieveLevelEnum.InstanceQueryRetrieveLevel: queryRetrieveLevel = "IMAGE"; break; default: return(false); } if (retrieveTags.Find(Tag.QUERY_RETRIEVE_LEVEL) == null) { retrieveTags.Add(new DicomTagValue(Tag.QUERY_RETRIEVE_LEVEL, queryRetrieveLevel)); } _retrieveItems = new DicomQueryItemCollection(); DicomTrigger trigger = new DicomTrigger(TransactionNameEnum.RAD_16); System.String sopClassUid = System.String.Empty; switch (informationModel) { case QueryRetrieveInformationModelEnum.PatientRootQueryRetrieveInformationModel: sopClassUid = "1.2.840.10008.5.1.4.1.2.1.2"; break; case QueryRetrieveInformationModelEnum.StudyRootQueryRetrieveInformationModel: sopClassUid = "1.2.840.10008.5.1.4.1.2.2.2"; break; case QueryRetrieveInformationModelEnum.PatientStudyOnlyQueryRetrieveInformationModel: sopClassUid = "1.2.840.10008.5.1.4.1.2.3.2"; break; default: return(false); } trigger.AddItem(GenerateTriggers.MakeCMoveRetrieve(informationModel, moveDestination, retrieveTags), sopClassUid, "1.2.840.10008.1.2"); // RAD-16 - trigger the ImageArchive bool triggerResult = TriggerActorInstances(ActorTypeEnum.ImageArchive, trigger, true); // Get the retrieve items returned if (triggerResult == true) { foreach (ActorsTransaction actorsTransaction in ActorsTransactionLog) { if (actorsTransaction.FromActorName.Type == ActorTypeEnum.ImageArchive) { BaseTransaction baseTransaction = actorsTransaction.Transaction; if (baseTransaction is DicomTransaction) { DicomTransaction dicomTransaction = (DicomTransaction)baseTransaction; if (dicomTransaction.Processed == false) { DicomMessageCollection cMoveResponses = dicomTransaction.DicomMessages.CMoveResponses; int index = 0; foreach (DvtkHighLevelInterface.Dicom.Messages.DicomMessage dicomMessage in cMoveResponses) { // store all C-MOVE-RSP messages // - use DicomQueryItem.GetValue(Tag.NUMBER_OF_COMPLETED_SUBOPERATIONS) to get completed count // - use DicomQueryItem.GetValue(Tag.NUMBER_OF_FAILED_SUBOPERATIONS) to get failed count // - use DicomQueryItem.GetValue(Tag.NUMBER_OF_REMAINING_SUBOPERATIONS) to get remaining count // - use DicomQueryItem.GetValue(Tag.NUMBER_OF_WARNING_SUBOPERATIONS) to get warning count DicomQueryItem dicomRetriveItem = new DicomQueryItem(index++, dicomMessage); _retrieveItems.Add(dicomRetriveItem); } dicomTransaction.Processed = true; } } } } } return(triggerResult); }
/// <summary> /// Send a C-FIND-RQ Information Model Query. /// Query based on the informationModel provided and the query/retrieve level. Take /// the query tags from the queryTags provided. /// /// The C-FIND-RSP messages returned are stored in a DicomQueryItemCollection named QueryItems. /// </summary> /// <param name="informationModel">Q/R Information Model to be used in the query operation.</param> /// <param name="level">Query / retrieve level.</param> /// <param name="queryTags">List of Query Tags.</param> /// <returns>Boolean indicating success or failure.</returns> public bool SendQueryImages(QueryRetrieveInformationModelEnum informationModel, QueryRetrieveLevelEnum level, TagValueCollection queryTags) { System.String queryRetrieveLevel = System.String.Empty; switch (level) { case QueryRetrieveLevelEnum.PatientQueryRetrieveLevel: _patientLevelQueryItems = new DicomQueryItemCollection(); queryRetrieveLevel = "PATIENT"; break; case QueryRetrieveLevelEnum.StudyQueryRetrieveLevel: _studyLevelQueryItems = new DicomQueryItemCollection(); queryRetrieveLevel = "STUDY"; break; case QueryRetrieveLevelEnum.SeriesQueryRetrieveLevel: _seriesLevelQueryItems = new DicomQueryItemCollection(); queryRetrieveLevel = "SERIES"; break; case QueryRetrieveLevelEnum.InstanceQueryRetrieveLevel: _instanceLevelQueryItems = new DicomQueryItemCollection(); queryRetrieveLevel = "IMAGE"; break; default: return(false); } if (queryTags.Find(Tag.QUERY_RETRIEVE_LEVEL) == null) { queryTags.Add(new DicomTagValue(Tag.QUERY_RETRIEVE_LEVEL, queryRetrieveLevel)); } DicomQueryItemCollection queryItems = QueryItems(level); DicomTrigger trigger = new DicomTrigger(TransactionNameEnum.RAD_14); System.String sopClassUid = System.String.Empty; switch (informationModel) { case QueryRetrieveInformationModelEnum.PatientRootQueryRetrieveInformationModel: sopClassUid = "1.2.840.10008.5.1.4.1.2.1.1"; break; case QueryRetrieveInformationModelEnum.StudyRootQueryRetrieveInformationModel: sopClassUid = "1.2.840.10008.5.1.4.1.2.2.1"; break; case QueryRetrieveInformationModelEnum.PatientStudyOnlyQueryRetrieveInformationModel: sopClassUid = "1.2.840.10008.5.1.4.1.2.3.1"; break; default: return(false); } trigger.AddItem(GenerateTriggers.MakeCFindQuery(informationModel, queryTags), sopClassUid, "1.2.840.10008.1.2"); // RAD-14 - trigger the ImageArchive bool triggerResult = TriggerActorInstances(ActorTypeEnum.ImageArchive, trigger, true); // Get the query items returned if (triggerResult == true) { foreach (ActorsTransaction actorsTransaction in ActorsTransactionLog) { if (actorsTransaction.FromActorName.Type == ActorTypeEnum.ImageArchive) { BaseTransaction baseTransaction = actorsTransaction.Transaction; if (baseTransaction is DicomTransaction) { DicomTransaction dicomTransaction = (DicomTransaction)baseTransaction; if (dicomTransaction.Processed == false) { DicomMessageCollection cFindResponses = dicomTransaction.DicomMessages.CFindResponses; int index = 0; foreach (DvtkHighLevelInterface.Dicom.Messages.DicomMessage dicomMessage in cFindResponses) { if (dicomMessage.DataSet.Count != 0) { DicomQueryItem dicomQueryItem = new DicomQueryItem(index++, dicomMessage); queryItems.Add(dicomQueryItem); } } dicomTransaction.Processed = true; } } } } } return(triggerResult); }