Example #1
0
        private void SetValuesCellForAttribute(AttributeList attributeList, int zeroBasedIndex)
        {
            int columnIndex = (int)this.columnIndexAttributeValues[zeroBasedIndex];

            AttributeBase attributebase = attributeList[zeroBasedIndex];

            if (attributebase.IsPresent)
            {
                bool isDicomSequenceAttribute = false;

                if (attributebase is DicomAttribute)
                {
                    if ((attributebase as DicomAttribute).AttributeOnly.VR == VR.SQ)
                    {
                        isDicomSequenceAttribute = true;
                    }
                }

                if (!isDicomSequenceAttribute)
                {
                    bool containsError = false;

                    String valuesString = attributebase.ValuesToString();

                    if ((attributebase.ValidationRule.Flags & FlagsBase.Compare_values) == FlagsBase.Compare_values)
                    {
                        if (attributeList.ContainsCompareValuesErrors)
                        {
                            containsError = true;
                        }
                    }

                    if ((attributebase.ValidationRule.Flags & FlagsBase.Values) == FlagsBase.Values)
                    {
                        if (valuesString.Length == 0)
                        {
                            containsError = true;
                        }
                    }

                    if ((attributebase.ValidationRule.Flags & FlagsBase.No_values) == FlagsBase.No_values)
                    {
                        if (valuesString.Length > 0)
                        {
                            containsError = true;
                        }
                    }

                    // If this is a Dicom attribute which is a group length, only compare when the compareGroupLength
                    // field is true.
                    if ((!this.displayGroupLength) && (attributebase is DicomAttribute))
                    {
                        DicomAttribute dicomAttribute = attributebase as DicomAttribute;

                        TagSequence tagSequence = new TagSequence(dicomAttribute.ValidationRuleDicomAttribute.TagSequenceString);

                        if (tagSequence.LastTag.ElementNumber == 0)
                        {
                            containsError = false;
                        }
                    }

                    // If the attribute contains no values, display this with the text "No values" in italic.
                    if (valuesString.Length == 0)
                    {
                        valuesString = "<i>No values</i>";
                    }

                    if (containsError)
                    {
                        SetCellError(columnIndex, valuesString);
                    }
                    else
                    {
                        SetCellOK(columnIndex, valuesString);
                    }
                }
                else
                // Is Sequence attribute.
                {
                    if ((attributebase.ValidationRule.Flags & FlagsBase.Include_sequence_items) == 0)
                    // If sequence item will not be displayed.
                    {
                        SetCellOK(columnIndex, "<i>Items will not be displayed.</i>");
                    }
                }
            }
        }
Example #2
0
        private void SetPresentCellForAttribute(AttributeList attributeList, int zeroBasedIndex)
        {
            int columnIndex = (int)this.columnIndexAttributePresent[zeroBasedIndex];

            AttributeBase attributebase = attributeList[zeroBasedIndex];

            if (attributebase != null)
            {
                String presentString = "";
                bool   containsError = false;

                if (attributebase.IsPresent)
                {
                    presentString = "+";
                }
                else
                {
                    presentString = "-";
                }

                if ((attributebase.ValidationRule.Flags & FlagsBase.Compare_present) == FlagsBase.Compare_present)
                {
                    if (attributeList.ContainsComparePresentErrors)
                    {
                        containsError = true;
                    }
                }

                if ((attributebase.ValidationRule.Flags & FlagsBase.Present) == FlagsBase.Present)
                {
                    if (!attributebase.IsPresent)
                    {
                        containsError = true;
                    }
                }

                if ((attributebase.ValidationRule.Flags & FlagsBase.Not_present) == FlagsBase.Not_present)
                {
                    if (attributebase.IsPresent)
                    {
                        containsError = true;
                    }
                }

                // If this is a Dicom attribute which is a group length, only compare when the compareGroupLength
                // field is true.
                if ((!this.displayGroupLength) && (attributebase is DicomAttribute))
                {
                    DicomAttribute dicomAttribute = attributebase as DicomAttribute;

                    TagSequence tagSequence = new TagSequence(dicomAttribute.ValidationRuleDicomAttribute.TagSequenceString);

                    if (tagSequence.LastTag.ElementNumber == 0)
                    {
                        containsError = false;
                    }
                }

                if (containsError)
                {
                    SetCellError(columnIndex, presentString);
                }
                else
                {
                    SetCellOK(columnIndex, presentString);
                }
            }
        }
Example #3
0
 //
 // - Methods -
 //
 /// <summary>
 /// Add an attribute to this list.
 /// </summary>
 /// <param name="attributeBase">The attribute to add.</param>
 public void Add(AttributeBase attributeBase)
 {
     this.attributeList.Add(attributeBase);
 }
Example #4
0
        private BaseCommonDataFormat CreateCommonDateFormat(AttributeBase attribute)
        {
            BaseCommonDataFormat commonDataFormat = new CommonStringFormat();

            switch (this.compareRule.CompareValueType)
            {
                case CompareValueTypes.Date:
                    commonDataFormat = new CommonDateFormat();
                    break;

                case CompareValueTypes.ID:
                    commonDataFormat = new CommonIdFormat();
                    break;

                case CompareValueTypes.Name:
                    commonDataFormat = new CommonNameFormat();
                    break;

                case CompareValueTypes.String:
                    commonDataFormat = new CommonStringFormat();
                    break;

                case CompareValueTypes.Time:
                    commonDataFormat = new CommonTimeFormat();
                    break;

                case CompareValueTypes.UID:
                    commonDataFormat = new CommonUidFormat();
                    break;

                default:
                    // Do nothing.
                    break;
            }

            if (attribute is DicomAttribute)
            {
                DvtkHighLevelInterface.Dicom.Other.Attribute dicomAttributeOnly = (attribute as DicomAttribute).AttributeOnly;

                if (dicomAttributeOnly.VM == 0)
                {
                    commonDataFormat.FromDicomFormat("");
                }
                else
                {
                    commonDataFormat.FromDicomFormat(dicomAttributeOnly.Values[0]);
                }

            }
            else if (attribute is Hl7Attribute)
            {
                commonDataFormat.FromHl7Format((attribute as Hl7Attribute).AttributeOnly);
            }
            else
            {
                throw new System.Exception("Not supposed to get here.");
            }

            return(commonDataFormat);
        }
Example #5
0
        //
        // - Methods -
        //

        /// <summary>
        /// Add an attribute to this list.
        /// </summary>
        /// <param name="attributeBase">The attribute to add.</param>
        public void Add(AttributeBase attributeBase)
        {
            this.attributeList.Add(attributeBase);
        }