示例#1
0
        private void FillSequenceFromElementRef(DicomDataset rootEleList)
        {
            try
            {
                DicomVR vr = _element.ValueRepresentation;

                if (vr == DicomVR.SQ)
                {
                    Sequence = new DSequence(this);
                    DicomSequence sequence = _element as DicomSequence;
                    for (int i = 0; i < sequence.Items.Count; i++)
                    {
                        DicomDataset list = sequence.Items[i];

                        DElementList dlist = new DElementList(list, rootEleList);
                        Sequence._add(dlist);
                    }
                }
            }
            catch (Exception err)
            {
                DElement errEle = new DElement(_tag, _vr);
                LogMgt.Logger.Write(err.ToString());
            }
        }
示例#2
0
        private string getValue()
        {
            try
            {
                int vm = 0;
                DVR vr = DHelper.ConvertToDVR(DicomVR.UN);
                if (_element != null)
                {
                    vr = DHelper.ConvertToDVR(_element.ValueRepresentation);
                    //vm = _element.VM;
                }
                if (vr == DVR.UN)
                {
                    if (_element != null)        // do not implement _element yet, because error handler is using Element with (0000,0000), fix this in the future 20080312
                    {
                        return("");
                    }
                }

                // ----------------

                switch (vr)
                {
                case DVR.UN:
                case DVR.OB:
                case DVR.OF:
                case DVR.OW:
                case DVR.SQ:
                {
                    return("");
                }

                //VRs of LO, LT, SH, ST, and UT plus PN for person name are subject to character set extensions.
                //VRs AE, AS, CS, DS, and IS always use the default character set and have further restrictions on their contents.
                case DVR.LO:
                case DVR.LT:
                case DVR.SH:
                case DVR.ST:
                case DVR.UT:
                default:
                {
                    DicomMultiStringElement dicomMultiStringElement = _element as DicomMultiStringElement;

                    StringBuilder sb = new StringBuilder();
                    for (int i = 0; i < dicomMultiStringElement.Count; i++)
                    {
                        sb.Append(dicomMultiStringElement.Get <string>(i)).Append(DHelper.ValueDelimiter);
                    }
                    return(sb.ToString().TrimEnd(DHelper.ValueDelimiter));
                }
                }
            }
            catch (Exception err)
            {
                DElement errEle = new DElement(_tag, _vr);
                LogMgt.Logger.Write(err.ToString());
            }
            return("");
        }
示例#3
0
 public DElement Add(DElement element)
 {
     if (element == null)
     {
         return(null);
     }
     if (element.IsRef)
     {
         return(null);
     }
     _elementList.Add(element._element);
     return(base.Add(element) as DElement);
 }
示例#4
0
        private void FillBaseCollection(DicomDataset rootEleList)
        {
            base.Clear();

            foreach (DicomItem item in _elementList)
            {
                try
                {
                    //DicomElement eleRef = _elementList.Get<DicomElement>(item.Tag);
                    DElement element = new DElement(item, rootEleList);
                    base.Add(element);
                }
                catch (Exception err)
                {
                    LogMgt.Logger.Write(err.ToString());
                }
            }
        }
示例#5
0
        public void Remove(DElement element)
        {
            if (!Contains(element))
            {
                return;
            }

            //Tag t;
            //if (element.IsRef)
            //{
            //    t = element._elementRef.element.tag;
            //}
            //else
            //{
            //    t = element._element.tag;
            //}

            //_elementList.deleteElement(t);
            base.Remove(element);
        }
示例#6
0
 public void Insert(int index, DElement value)
 {
 }
示例#7
0
 public int IndexOf(DElement element)
 {
     return(base.IndexOf(element));
 }
示例#8
0
 public bool Contains(DElement element)
 {
     return(base.Contains(element));
 }
示例#9
0
        public override XBase Add(XBase value)
        {
            DElement e = value as DElement;

            return(Add(e));
        }
示例#10
0
 public DSequence(DElement rootElement)
     : base(typeof(DElementList))
 {
     _rootElement = rootElement;
 }