Esempio n. 1
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)
            {
                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);
        }
Esempio n. 2
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);
        }
Esempio n. 3
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)
                {
                    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);
        }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tag"></param>
        /// <returns></returns>
        public System.String GetInstantiatedValue(Tag tag)
        {
            System.String lValue = System.String.Empty;

            // Try to get the instantiated default tag value
            BaseDicomTagValue instantiatedDefaultTagValue = _instantiatedDefaultTagValues.Find(tag);

            if (instantiatedDefaultTagValue != null)
            {
                if (instantiatedDefaultTagValue is DicomTagValue)
                {
                    DicomTagValue tagValue = (DicomTagValue)instantiatedDefaultTagValue;
                    lValue = tagValue.Value;
                }
            }

            return(lValue);
        }
Esempio n. 5
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);
 }
Esempio n. 6
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);
 }
Esempio n. 7
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)
 {
     _comparatorCollection.AddComparisonTagValueFilter(tagValueFilter);
 }