/// <summary> /// Reads raw, unprocessed tag data. /// </summary> /// <param name="identity">The identity of the caller.</param> /// <param name="tags">The tags to query.</param> /// <param name="utcStartTime">The UTC start time for the query.</param> /// <param name="utcEndTime">The UTC end time for the query.</param> /// <param name="pointCount"> /// The maximum number of samples to return per tag. Note that the implementation can apply /// its own restrictions to this limit. A value of less than one should result in all raw /// samples between the start and end time being returned, up to the implementation's own /// internal limit. /// </param> /// <param name="cancellationToken">The cancellation token for the request.</param> /// <returns> /// A dictionary of historical data, indexed by tag. /// </returns> protected override async Task <IDictionary <TagDefinition, TagValueCollection> > ReadRawData(ClaimsPrincipal identity, IEnumerable <TagDefinition> tags, DateTime utcStartTime, DateTime utcEndTime, int pointCount, CancellationToken cancellationToken) { var result = new ConcurrentDictionary <TagDefinition, TagValueCollection>(); var tasks = tags.Select(t => Task.Run(async() => { var tag = t as RedisTagDefinition; if (tag == null) { return; } var vals = await tag.GetRawValues(identity, utcStartTime, utcEndTime, pointCount, cancellationToken).ConfigureAwait(false); result[tag] = new TagValueCollection() { VisualizationHint = TagValueCollectionVisualizationHint.TrailingEdge, Values = vals.ToArray() }; })); await Task.WhenAny(Task.WhenAll(tasks), Task.Delay(-1, cancellationToken)).ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); return(result); }
public void WriteXmlTest() { XmlWriterSettings settings = new XmlWriterSettings(); string value = "Test"; TagType type = TagType.Additive; bool isUser = false; TagValue firstItem = new TagValue(value, type, isUser); StringWriter stringWriter = new StringWriter(); XmlWriter writer = XmlWriter.Create(stringWriter, settings); var serial = new XmlSerializer(typeof(TagValueCollection)); var coll = new TagValueCollection(); coll.Add(firstItem); serial.Serialize(writer, coll); Assert.AreEqual(m_1ItemXml, stringWriter.ToString()); coll.Add(new TagValue("AnotherTestValue", TagType.Additive, false)); stringWriter = new StringWriter(); writer = XmlWriter.Create(stringWriter, settings); serial.Serialize(writer, coll); Assert.AreEqual(m_2ItemXml, stringWriter.ToString()); }
/// <summary> /// Send a CFind Modality Worklist Query trigger from the given queryTags. /// All other return keys are taken from the supported return key attributes /// in the Worklist Information Model. /// </summary> /// <param name="queryTags">List of Query Tags.</param> /// <returns>Boolean indicating success or failure.</returns> public bool SendQueryModalityWorklist(TagValueCollection queryTags) { // Generate trigger using the query tags DicomTrigger trigger = new DicomTrigger(TransactionNameEnum.RAD_5); trigger.AddItem(GenerateTriggers.MakeCFindModalityWorklist(queryTags), "1.2.840.10008.5.1.4.31", "1.2.840.10008.1.2"); return(TriggerModalityWorklistQuery(trigger)); }
internal static HistoricalTagValuesDto ToHistoricalTagValuesDto(this TagValueCollection values) { if (values == null) { return(null); } return(new HistoricalTagValuesDto() { Values = values.Values.Select(x => x.ToTagValueDto()).ToArray(), VisualizationHint = values.VisualizationHint.ToString() }); }
public bool UseComparator(TagValueCollection tagValueFilterCollection, bool universalMatchAllowed) { int filterCounter = 0; // Check if the filter values match those in the template foreach (BaseTagValue baseTagValue in tagValueFilterCollection) { Hl7TagValue hl7TagValue = null; if (baseTagValue is Hl7TagValue) { hl7TagValue = (Hl7TagValue)baseTagValue; } else if (baseTagValue is DicomTagValue) { DicomTagValue dicomTagValue = (DicomTagValue)baseTagValue; hl7TagValue = new Hl7TagValue(DicomHl7TagMapTemplate.DicomToHl7Tag(dicomTagValue.Tag), dicomTagValue.Value); } if (hl7TagValue.Tag != null) { foreach (Hl7ComparisonTag thisComparisonTag in this.Template.ComparisonTags) { // Tags are the same if (thisComparisonTag.Tag == hl7TagValue.Tag) { if (universalMatchAllowed == true) { // When universal matching either a zero-length or exact match are OK if ((hl7TagValue.Value == System.String.Empty) || (thisComparisonTag.DataFormat.ToHl7Format() == hl7TagValue.Value)) { filterCounter++; } } else if ((universalMatchAllowed == false) && (thisComparisonTag.DataFormat.ToHl7Format() == hl7TagValue.Value)) { // Not universal matching so only an exact match is OK filterCounter++; } break; } } } } bool useThisComparator = (tagValueFilterCollection.Count == filterCounter) ? true : false; return(useThisComparator); }
private TagValueCollection GenerateTagValueCollection(TagValueCollection tagValueFilterCollection) { TagValueCollection localTagValueCollection = new TagValueCollection(); // Check if the comparator can be used with a Universal Match on the Value of the Tag // - that is zero-length Value. if (this.UseComparator(tagValueFilterCollection, true) == true) { foreach (BaseTagValue baseTagValue in tagValueFilterCollection) { Hl7TagValue hl7TagValue = null; if (baseTagValue is Hl7TagValue) { hl7TagValue = (Hl7TagValue)baseTagValue; } else if (baseTagValue is DicomTagValue) { DicomTagValue dicomTagValue = (DicomTagValue)baseTagValue; hl7TagValue = new Hl7TagValue(DicomHl7TagMapTemplate.DicomToHl7Tag(dicomTagValue.Tag), dicomTagValue.Value); } // If the Value is empty (Universal Match) then try to get the actual // value from the comparator so that is actual value will be used against // other comparators. if (hl7TagValue.Tag != null) { if (hl7TagValue.Value == System.String.Empty) { // try to get a value for this Tag from this comparator System.String lValue = getValue(hl7TagValue.Tag); // Add a new Tag Value - with Value coming from this comparator // to the local filter. Hl7TagValue lHl7TagValue = new Hl7TagValue(hl7TagValue.Tag, lValue); localTagValueCollection.Add(lHl7TagValue); } else { // Just add the given Tag Value pair to the local filter localTagValueCollection.Add(hl7TagValue); } } } } // Return the local filter return(localTagValueCollection); }
/// <summary> /// Create a Worklist Query Dataset from the given query tags and the default return keys. /// </summary> /// <param name="queryTags">Query Tags.</param> /// <returns>DvtkData.Dimse.DataSet - Modality Worklist Query Dataset.</returns> public static DvtkData.Dimse.DataSet CreateWorklistQueryDataset(TagValueCollection queryTags) { DvtkData.Dimse.DataSet dataset = new DvtkData.Dimse.DataSet("Modality Worklist Information Model - FIND SOP Class"); // update the query tags with any parent sequence information needed UpdateTagParentSequences(queryTags); // add the default return keys AddDefaultReturnKeys(dataset); // add the query keys AddTagsToDataset(queryTags, dataset); return(dataset); }
/// <summary> /// /// </summary> public void CreateDefaultTagValues() { // Create a default value list that is the combination of the user defined // default values and the in-built default values. The user defined values // take precedence. _defaultDicomTagValues = new TagValueCollection(); // Add all the user defined default values provided foreach (BaseDicomTagValue userDefinedTagValue in _userDefinedDefaultTagValues) { if (userDefinedTagValue is DicomTagValueDelete) { // Do not add this to the list as the default should be deleted } else { _defaultDicomTagValues.Add(userDefinedTagValue); } } // Generate all the in-built default values InBuiltDefaultTagValues inBuiltDefaultTagValues = new InBuiltDefaultTagValues(); // Add the in-built default values - but only if not defined by the user foreach (BaseDicomTagValue inBuiltTagValue in inBuiltDefaultTagValues.TagValueDefaults) { BaseDicomTagValue userDefinedTagValue = _userDefinedDefaultTagValues.Find(inBuiltTagValue.Tag); if ((userDefinedTagValue != null) && (userDefinedTagValue is DicomTagValueDelete)) { // Do not add this to the list as the default should be deleted } else if (_defaultDicomTagValues.Find(inBuiltTagValue.Tag) == null) { _defaultDicomTagValues.Add(inBuiltTagValue); } } // Now instantiate the default tag value list _instantiatedDefaultTagValues = new TagValueCollection(); foreach (BaseDicomTagValue defaultTagValue in _defaultDicomTagValues) { // The Value property of defaultTagValue returns the next instantiated value based on the // how the default value was defined at setup. _instantiatedDefaultTagValues.Add(new DicomTagValue(defaultTagValue.Tag, defaultTagValue.Value)); } }
/// <summary> /// Reads raw data for the specified tags. /// </summary> /// <param name="identity">The identity of the caller.</param> /// <param name="tags">The tags to read from.</param> /// <param name="utcStartTime">The UTC start time for the request.</param> /// <param name="utcEndTime">The UTC end time for the request.</param> /// <param name="pointCount"> /// The number of raw samples to request per tag. If not specified or less than zero, /// <see cref="MaxRawSampleCount"/> will be used. /// </param> /// <param name="cancellationToken">The cancellation token for the request.</param> /// <returns> /// A dictionary of query results, indexed by tag. /// </returns> private Task <IDictionary <TagDefinition, TagValueCollection> > ReadRawDataInternal(ClaimsPrincipal identity, IEnumerable <TagDefinition> tags, DateTime utcStartTime, DateTime utcEndTime, int?pointCount, CancellationToken cancellationToken) { var result = new Dictionary <TagDefinition, TagValueCollection>(); foreach (var tag in tags) { if (!_archive.TryGetValue(tag.Id, out var rawData)) { continue; } rawData.Lock.EnterReadLock(); try { var take = pointCount.HasValue ? pointCount.Value <1 || pointCount.Value> MaxRawSampleCount ? MaxRawSampleCount : pointCount.Value : MaxRawSampleCount; var nonArchiveValues = new List <TagValue>(); if (_archiveCandidates.TryGetValue(tag.Id, out var candidate) && candidate?.Value != null) { nonArchiveValues.Add(candidate.Value); } var snapshot = tag.ReadSnapshotValue(identity); if (snapshot != null) { nonArchiveValues.Add(snapshot); } var selected = rawData.Values.Concat(nonArchiveValues).Where(x => x.UtcSampleTime >= utcStartTime && x.UtcSampleTime <= utcEndTime).Take(take); result[tag] = new TagValueCollection() { Values = selected.ToArray(), VisualizationHint = TagValueCollectionVisualizationHint.TrailingEdge }; } finally { rawData.Lock.ExitReadLock(); } } return(Task.FromResult <IDictionary <TagDefinition, TagValueCollection> >(result)); }
private static void UpdateTagParentSequences(TagValueCollection tags) { ScheduledProcedureStepInformationEntity scheduledProcedureStepIe = new ScheduledProcedureStepInformationEntity(); foreach (DicomTagValue tag in tags) { foreach (TagType tagType in scheduledProcedureStepIe.TagTypeList) { // special check to be made on the Specific Character Set tag // - this tag is added to the scheduledProcedureStepIe.TagTypeList purely to // be able to return the correct values in the query response - we should not set // the ParentSequenceTag for this attribute // - this is a workaround - but please do not change it! if ((tag.Tag == tagType.Tag) && (tag.Tag != Tag.SPECIFIC_CHARACTER_SET)) { // set the parent sequence in the tag tag.ParentSequenceTag = Tag.SCHEDULED_PROCEDURE_STEP_SEQUENCE; break; } } } }
/// <summary> /// Compare the two messages. /// </summary> /// <param name="tagValueFilterCollection">Tag Value Filter.</param> /// <param name="resultsReporter">Results reporter.</param> /// <param name="thatBaseComparator">Reference comparator.</param> /// <returns>bool - true = messages compared, false messages not compared</returns> public abstract bool Compare(TagValueCollection tagValueFilterCollection, ResultsReporter resultsReporter, BaseComparator thatBaseComparator);
private static void AddTagsToDataset(TagValueCollection tags, DvtkData.Dimse.DataSet dataset) { // iterate over the tags foreach (DicomTagValue tag in tags) { if (tag.ParentSequenceTag != Tag.UNDEFINED) { // try to get the sequence tag in the dataset DvtkData.Dimse.Attribute sequenceAttribute = dataset.GetAttribute(tag.ParentSequenceTag); if ((sequenceAttribute != null) && (sequenceAttribute.ValueRepresentation == DvtkData.Dimse.VR.SQ)) { SequenceOfItems sequenceOfItems = (SequenceOfItems)sequenceAttribute.DicomValue; if (sequenceOfItems.Sequence.Count == 1) { SequenceItem item = sequenceOfItems.Sequence[0]; if (item != null) { VR vr = VR.UN; // try to get the attribute in the item DvtkData.Dimse.Attribute attribute = item.GetAttribute(tag.Tag); if (attribute != null) { vr = attribute.ValueRepresentation; item.Remove(attribute); } // add the query value item.AddAttribute(tag.Tag.GroupNumber, tag.Tag.ElementNumber, vr, tag.Value); } } } } else { VR vr = VR.UN; // try to get the attribute in the dataset DvtkData.Dimse.Attribute attribute = dataset.GetAttribute(tag.Tag); if (attribute != null) { vr = attribute.ValueRepresentation; dataset.Remove(attribute); } // special check for the SPECIFIC CHARACTER SET attribute if (tag.Tag == Tag.SPECIFIC_CHARACTER_SET) { vr = VR.CS; } // add the query value dataset.AddAttribute(tag.Tag.GroupNumber, tag.Tag.ElementNumber, vr, tag.Value); } } }
/// <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); }
/// <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); }
public void TagValueCollectionConstructorTest() { TagValueCollection target = new TagValueCollection(); Assert.AreEqual(0, target.Count); }
/// <summary> /// Compare the two messages. /// </summary> /// <param name="tagValueFilterCollection">Tag Value Filter.</param> /// <param name="resultsReporter">Results reporter.</param> /// <param name="thatBaseComparator">Reference comparator.</param> /// <returns>bool - true = messages compared, false messages not compared</returns> public override bool Compare(TagValueCollection tagValueFilterCollection, ResultsReporter resultsReporter, BaseComparator thatBaseComparator) { bool compared = false; if (thatBaseComparator is Hl7Comparator) { Hl7Comparator thatHl7Comparator = (Hl7Comparator)thatBaseComparator; // Check if both templates have been initialized correctly if ((this.Template == null) || (thatHl7Comparator.Template == null)) { return(false); } // Check for comparator equality if (this == thatHl7Comparator) { return(true); } // filter out comparators for the same message types if ((this.Template.MessageType == thatHl7Comparator.Template.MessageType) && (this.Template.MessageSubType == thatHl7Comparator.Template.MessageSubType)) { return(false); } // generate a local Tag Value collection from this // - this collection will include any tag value pair from the original collection and // the tag value pairs of any tags only (in the original collection) that match from this // comparator - that is the values are taken from this comparator. TagValueCollection lTagValueFilterCollection = GenerateTagValueCollection(tagValueFilterCollection); // check to see if the comparision filters match - without Univeral Matching // - now try to match this local filter collection against thatDicomComparator // - comparators that match will have the same tag value pairs (including the value) as // each other. if ((tagValueFilterCollection.Count == lTagValueFilterCollection.Count) && (thatHl7Comparator.UseComparator(lTagValueFilterCollection, false) == true)) { MessageComparisonResults messageComparisonResults = new MessageComparisonResults(this.Name, thatHl7Comparator.Name, this.Template.MessageType, thatHl7Comparator.Template.MessageType, this.Template.MessageSubType, thatHl7Comparator.Template.MessageSubType); // Iterate over this comparator foreach (Hl7ComparisonTag thisComparisonTag in this.Template.ComparisonTags) { // try to get the equivalent tag in thatHl7Comparator Hl7ComparisonTag thatComparisonTag = thatHl7Comparator.Template.ComparisonTags.Find(thisComparisonTag.Tag); if (thatComparisonTag != null) { AttributeComparisonResults attributeComparisonResults = new AttributeComparisonResults(SegmentNames.Name(thisComparisonTag.Tag.Segment), thisComparisonTag.Tag.FieldIndex, thisComparisonTag.DataFormat.ToHl7Format(), thatComparisonTag.DataFormat.ToHl7Format()); attributeComparisonResults.Name = DicomHl7TagMapTemplate.Hl7NameFromHl7Tag(thisComparisonTag.Tag); if (thisComparisonTag.DataFormat.Equals(thatComparisonTag.DataFormat) == false) { DvtkData.Validation.ValidationMessage validationMessage = new DvtkData.Validation.ValidationMessage(); validationMessage.Type = DvtkData.Validation.MessageType.Error; validationMessage.Message = "Attribute values do not match."; attributeComparisonResults.Messages.Add(validationMessage); } messageComparisonResults.Add(attributeComparisonResults); } } resultsReporter.WriteMessageComparisonResults(messageComparisonResults); compared = true; } } else if (thatBaseComparator is DicomComparator) { DicomComparator thatDicomComparator = (DicomComparator)thatBaseComparator; // Check if both templates have been initialized correctly if ((this.Template == null) || (thatDicomComparator.Template == null)) { return(false); } // generate a local Tag Value collection from this // - this collection will include any tag value pair from the original collection and // the tag value pairs of any tags only (in the original collection) that match from this // comparator - that is the values are taken from this comparator. TagValueCollection lTagValueFilterCollection = GenerateTagValueCollection(tagValueFilterCollection); // check to see if the comparision filters match - without Univeral Matching // - now try to match this local filter collection against thatDicomComparator // - comparators that match will have the same tag value pairs (including the value) as // each other. if ((tagValueFilterCollection.Count == lTagValueFilterCollection.Count) && (thatDicomComparator.UseComparator(lTagValueFilterCollection, false) == true)) { MessageComparisonResults messageComparisonResults = new MessageComparisonResults(this.Name, thatDicomComparator.Name, this.Template.MessageType, thatDicomComparator.Template.Command, this.Template.MessageSubType, thatDicomComparator.Template.SopClassUid); // Iterate over this comparator foreach (Hl7ComparisonTag thisComparisonTag in this.Template.ComparisonTags) { // try to get the equivalent tag in thatDicomComparator DicomComparisonTag thatComparisonTag = thatDicomComparator.Template.ComparisonTags.Find(DicomHl7TagMapTemplate.Hl7ToDicomTag(thisComparisonTag.Tag)); if (thatComparisonTag != null) { AttributeComparisonResults attributeComparisonResults = new AttributeComparisonResults(thatComparisonTag.Tag, SegmentNames.Name(thisComparisonTag.Tag.Segment), thisComparisonTag.Tag.FieldIndex, thisComparisonTag.DataFormat.ToHl7Format(), thatComparisonTag.DataFormat.ToDicomFormat()); if (thisComparisonTag.DataFormat.Equals(thatComparisonTag.DataFormat) == false) { DvtkData.Validation.ValidationMessage validationMessage = new DvtkData.Validation.ValidationMessage(); validationMessage.Type = DvtkData.Validation.MessageType.Error; validationMessage.Message = "Attribute values do not match."; attributeComparisonResults.Messages.Add(validationMessage); } messageComparisonResults.Add(attributeComparisonResults); } } resultsReporter.WriteMessageComparisonResults(messageComparisonResults); compared = true; } } return(compared); }
/// <summary> /// Create an unscheduled worklist item by adding the given user defined tags to those /// of the Default Value Manager. This worklist item can then be used in the /// SendNCreateModalityProcedureStepInProgress() and SendModalityImagesStored() method /// calls. /// This simulates the IHE Unscheduled Use Case. /// </summary> /// <param name="userDefinedTags">User defined Tags.</param> /// <returns>Modality worklist item populated from the user defined tags and default values.</returns> public DicomQueryItem CreateUnscheduledWorklistItem(TagValueCollection userDefinedTags) { return(new DicomQueryItem(1, GenerateTriggers.MakeModalityWorklistItem(DefaultValueManager, userDefinedTags))); }