예제 #1
0
        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)
                {
                    DicomTagValue dicomTagValue = null;

                    if (baseTagValue is DicomTagValue)
                    {
                        dicomTagValue = (DicomTagValue)baseTagValue;
                    }
                    else if (baseTagValue is Hl7TagValue)
                    {
                        Hl7TagValue hl7TagValue = (Hl7TagValue)baseTagValue;
                        dicomTagValue = new DicomTagValue(DicomHl7TagMapTemplate.Hl7ToDicomTag(hl7TagValue.Tag), hl7TagValue.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 (dicomTagValue.Tag != Tag.UNDEFINED)
                    {
                        if (dicomTagValue.Value == System.String.Empty)
                        {
                            // try to get a value for this Tag from this comparator
                            System.String lValue = getValue(dicomTagValue.Tag);

                            // Add a new Tag Value - with Value coming from this comparator
                            // to the local filter.
                            DicomTagValue lDicomTagValue = new DicomTagValue(dicomTagValue.Tag, lValue);
                            localTagValueCollection.Add(lDicomTagValue);
                        }
                        else
                        {
                            // Just add the given Tag Value pair to the local filter
                            localTagValueCollection.Add(dicomTagValue);
                        }
                    }
                }
            }

            // Return the local filter
            return localTagValueCollection;
        }
예제 #2
0
        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)
            {
                DicomTagValue dicomTagValue = null;

                if (baseTagValue is DicomTagValue)
                {
                    dicomTagValue = (DicomTagValue)baseTagValue;
                }
                else if (baseTagValue is Hl7TagValue)
                {
                    Hl7TagValue hl7TagValue = (Hl7TagValue)baseTagValue;
                    dicomTagValue = new DicomTagValue(DicomHl7TagMapTemplate.Hl7ToDicomTag(hl7TagValue.Tag), hl7TagValue.Value);
                }

                if (dicomTagValue.Tag != Tag.UNDEFINED)
                {
                    foreach (DicomComparisonTag thisComparisonTag in this.Template.ComparisonTags)
                    {
                        // Tags are the same
                        if (thisComparisonTag.Tag == dicomTagValue.Tag)
                        {
                            if (universalMatchAllowed == true)
                            {
                                // When universal matching either a zero-length or exact match are OK
                                if ((dicomTagValue.Value == System.String.Empty) ||
                                    (thisComparisonTag.DataFormat.ToDicomFormat() == dicomTagValue.Value))
                                {
                                    filterCounter++;
                                }
                            }
                            else if ((universalMatchAllowed == false) &&
                                (thisComparisonTag.DataFormat.ToDicomFormat() == dicomTagValue.Value))
                            {
                                // Not universal matching so only an exact match is OK
                                filterCounter++;
                            }
                            break;
                        }
                    }
                }
            }

            bool useThisComparator = (tagValueFilterCollection.Count == filterCounter) ? true : false;

            return useThisComparator;
        }
예제 #3
0
 /// <summary>
 /// Add a Tag Value filter for the comparator.
 /// Only compare messages which contain the same values for this filter.
 /// </summary>
 /// <param name="tagValueFilter">Tag Value Filter.</param>
 public void AddComparisonTagValueFilter(DicomTagValue tagValueFilter)
 {
     _tagValueFilterCollection.Add(tagValueFilter);
 }
예제 #4
0
 /// <summary>
 /// Update the instantiated default tag values with the given tag value.
 /// </summary>
 /// <param name="tagValueUpdate">Tag/Value pair to update.</param>
 public void UpdateInstantiatedDefaultTagValue(DicomTagValue tagValueUpdate)
 {
     _defaultValueManager.UpdateInstantiatedDefaultTagValues(tagValueUpdate);
 }
예제 #5
0
 /// <summary>
 /// Add a Tag Value filter for the comparator.
 /// Only compare messages which contain the same values for this filter.
 /// </summary>
 /// <param name="tagValueFilter">Tag Value Filter.</param>
 public void AddComparisonTagValueFilter(DicomTagValue tagValueFilter)
 {
     _actorsTransactionLog.AddComparisonTagValueFilter(tagValueFilter);
 }
예제 #6
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="tagValue"></param>
        public void UpdateInstantiatedDefaultTagValues(DicomTagValue tagValue)
        {
            // Try to get the instantiated default tag value
            BaseDicomTagValue instantiatedDefaultTagValue = _instantiatedDefaultTagValues.Find(tagValue.Tag);
            if (instantiatedDefaultTagValue != null)
            {
                // Remove the existing tag value
                _instantiatedDefaultTagValues.Remove(instantiatedDefaultTagValue);
            }

            // Add the updated value
            _instantiatedDefaultTagValues.Add(tagValue);
        }