コード例 #1
0
        /// <summary>
        /// Method used to write an extra row of Atttribute information in both a summary and detailed table.
        /// </summary>
        /// <param name="attribute">The Atttribute.</param>
        /// <param name="table">The table.</param>
        private void WriteCommonInformation(Attribute attribute, Table table)
        {
            table.NewRow();
            table.AddBlackItem(1, string.Empty.PadLeft(attribute.NestingLevel, '>') + attribute.Tag.ToString(Tag.Format.Dicom));
            table.AddBlackItem(2, attribute.VR.ToString());

            AttributeData attributeData = (AttributeData)attribute.Data;

            if (attributeData.Mapping.Count == 0)
            {
                table.AddRedItem(4, "Attribute " + attribute.TagSequenceAsString + " could not be mapped to any attribute specification!\n");

                bool continueToFindMappedParent = true;
                Attribute attributeToCheck = attribute;
                Attribute mappedAttribute = null;

                do
                {
                    if (attributeToCheck.Parent is SequenceItem)
                    {
                        attributeToCheck = (attributeToCheck.Parent as SequenceItem).Parent;
                    }
                    else if (attributeToCheck.Parent is DataSet)
                    {
                        // No more parent attributes available.
                        continueToFindMappedParent = false;
                    }

                    if ((attributeToCheck.Data as AttributeData).Mapping.Count > 0)
                    {
                        mappedAttribute = attributeToCheck;
                        continueToFindMappedParent = false;
                    }
                }
                while (continueToFindMappedParent);

                if (mappedAttribute != null)
                {
                    table.AddBlackItem(4, "First parent attribute that can be mapped is " + mappedAttribute.TagSequenceAsString + " and is mapped to:");

                    foreach (AttributeSpecification attributeSpecification in (mappedAttribute.Data as AttributeData).Mapping)
                    {
                        table.AddBlackItem(4, "Mapped to " + attributeSpecification.Path);
                    }

                }
                else
                {
                    if (attribute.NestingLevel > 0)
                    {
                        table.AddBlackItem(4, "None of the parent attributes can be mapped also");
                    }
                }
            }
            else
            {
                table.AddBlackItem(3, attributeData.Mapping[0].Name);

                foreach (AttributeSpecification attributeSpecification in attributeData.Mapping)
                {
                    table.AddBlackItem(4, "Mapped to " + attributeSpecification.Path);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Method used to write an extra row of Atttribute information in both a summary and detailed table.
        /// </summary>
        /// <param name="attribute">The Atttribute.</param>
        /// <param name="table">The table.</param>
        private void WriteCommonInformation(Attribute attribute, Table table)
        {
            table.NewRow();
            table.AddBlackItem(1, string.Empty.PadLeft(attribute.NestingLevel, '>') + attribute.Tag.ToString(Tag.Format.Dicom));
            table.AddBlackItem(2, attribute.VR.ToString());

            AttributeData attributeData = (AttributeData)attribute.Data;

            if (attributeData.Mapping.Count == 0)
            {
                table.AddRedItem(4, "Attribute " + attribute.TagSequenceAsString + " could not be mapped to any attribute specification!\n");

                bool      continueToFindMappedParent = true;
                Attribute attributeToCheck           = attribute;
                Attribute mappedAttribute            = null;

                do
                {
                    if (attributeToCheck.Parent is SequenceItem)
                    {
                        attributeToCheck = (attributeToCheck.Parent as SequenceItem).Parent;
                    }
                    else if (attributeToCheck.Parent is DataSet)
                    {
                        // No more parent attributes available.
                        continueToFindMappedParent = false;
                    }

                    if ((attributeToCheck.Data as AttributeData).Mapping.Count > 0)
                    {
                        mappedAttribute            = attributeToCheck;
                        continueToFindMappedParent = false;
                    }
                }while (continueToFindMappedParent);

                if (mappedAttribute != null)
                {
                    table.AddBlackItem(4, "First parent attribute that can be mapped is " + mappedAttribute.TagSequenceAsString + " and is mapped to:");

                    foreach (AttributeSpecification attributeSpecification in (mappedAttribute.Data as AttributeData).Mapping)
                    {
                        table.AddBlackItem(4, "Mapped to " + attributeSpecification.Path);
                    }
                }
                else
                {
                    if (attribute.NestingLevel > 0)
                    {
                        table.AddBlackItem(4, "None of the parent attributes can be mapped also");
                    }
                }
            }
            else
            {
                table.AddBlackItem(3, attributeData.Mapping[0].Name);

                foreach (AttributeSpecification attributeSpecification in attributeData.Mapping)
                {
                    table.AddBlackItem(4, "Mapped to " + attributeSpecification.Path);
                }
            }
        }