Ejemplo n.º 1
0
        internal void CalculateBaseCollectionForSeries()
        {
            if (_instanceList.Count < 2)
            {
                return;
            }

            // Optimization:  a base collection has already been created, just return.
            if (_seriesTagsStream != null)
            {
                return;
            }

            IEnumerator <InstanceXml> iterator = GetEnumerator();

            if (false == iterator.MoveNext())
            {
                return;
            }

            DicomAttributeCollection collect1 = iterator.Current.Collection;

            if (false == iterator.MoveNext())
            {
                return;
            }

            DicomAttributeCollection collect2 = iterator.Current.Collection;

            _seriesTagsStream = new BaseInstanceXml(collect1, collect2);
        }
Ejemplo n.º 2
0
        internal void SetBaseInstance(BaseInstanceXml baseInstance)
        {
            if (_baseInstance != baseInstance)
            {
                // force the element to be regenerated when GetMemento() is called
                _cachedElement = null;
            }

            _baseInstance = baseInstance;
        }
Ejemplo n.º 3
0
        internal void SetMemento(XmlNode theSeriesNode)
        {
            _dirty             = true;
            _seriesInstanceUid = theSeriesNode.Attributes["UID"].Value;

            if (!theSeriesNode.HasChildNodes)
            {
                return;
            }

            XmlNode childNode = theSeriesNode.FirstChild;

            while (childNode != null)
            {
                // Just search for the first study node, parse it, then break
                if (childNode.Name.Equals("BaseInstance"))
                {
                    if (childNode.HasChildNodes)
                    {
                        XmlNode instanceNode = childNode.FirstChild;
                        if (instanceNode.Name.Equals("Instance"))
                        {
                            _seriesTagsStream = new BaseInstanceXml(instanceNode);
                        }
                    }
                }
                else if (childNode.Name.Equals("Instance"))
                {
                    // This assumes the BaseInstance is in the xml ahead of the actual instances, note, however,
                    // that if there is only 1 instance in the series, there will be no base instance value

                    InstanceXml instanceStream;

                    if (_seriesTagsStream == null)
                    {
                        instanceStream = new InstanceXml(childNode, null);
                    }
                    else
                    {
                        instanceStream = new InstanceXml(childNode, _seriesTagsStream.Collection);
                    }

                    _instanceList.Add(instanceStream.SopInstanceUid, instanceStream);
                }

                childNode = childNode.NextSibling;
            }
        }