예제 #1
0
 /// <summary>
 /// Removes all items from the <see cref="T:System.Collections.Generic.ICollection`1"/>.
 /// </summary>
 /// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only. </exception>
 public void Clear()
 {
     _dicomAttributeSQ.ClearSequenceItems();
 }
        private static void DoParseAttributes(
            StudyLoaderArgs studyLoaderArgs,
            ParseResult result,
            string metaUri,
            XmlElement elem)
        {
            var collection = result.Attributes;

            collection.ValidateVrValues  = false;
            collection.ValidateVrLengths = false;
            foreach (var node in elem)
            {
                var attrElem = node as XmlElement;
                if (attrElem == null)
                {
                    continue;
                }
                if (!attrElem.Name.Equals("attr"))
                {
                    continue;
                }
                var              dcmTag = GetTagFromAttrElement(attrElem);
                DicomAttribute   attr   = collection[dcmTag];
                DicomAttributeSQ sq     = attr as DicomAttributeSQ;
                if (sq != null)
                {
                    sq.ClearSequenceItems();
                    foreach (XmlNode itemNode in attrElem)
                    {
                        var itemElem = itemNode as XmlElement;
                        if (itemElem != null)
                        {
                            if (itemElem.Name.Equals("item"))
                            {
                                var subResult   = new ParseResult();
                                var subSequence = new DicomSequenceItem();
                                subResult.Attributes = subSequence;
                                DoParseAttributes(studyLoaderArgs, subResult, metaUri, itemElem);
                                sq.AddSequenceItem(subSequence);
                            }
                        }
                    }
                }
                else
                {
                    string val = null;
                    if (attrElem.Attributes["val"] != null)
                    {
                        val = attrElem.Attributes["val"].Value;
                        attr.SetStringValue(val);
                    }
                    else if (attrElem.Attributes["bid"] != null)
                    {
                        // TODO: This tag's value is binary. We're not interested in binary items other
                        // than the pixel data so we ignore them -- they will be added to the
                        // sequence but they will not have any value set.
                        if (attr.Tag.TagValue == DicomTags.PixelData)
                        {
                            result.PixelDataBid = attrElem.Attributes["bid"].Value;
                        }
                    }
                    else if (attrElem.Attributes["bytes"] != null)
                    {
                        // TODO: This tag's value is binary. We're not interested in binary items other
                        // than the pixel data so we ignore them -- they will be added to the
                        // sequence but they will not have any value set.
                        ;
                    }
                    else if (attrElem.Attributes["bsize"] != null)
                    {
                        // TODO: Bulk binary loading can use this.
                    }
                    else
                    {
                        Platform.Log(LogLevel.Warn, "Attr element {0} missing ",
                                     attr.Tag, val);
                    }
                }
            }
        }