Пример #1
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("");
        }
Пример #2
0
 public DVR getVR()
 {
     if (_element != null)
     {
         DicomVR vr = _element.ValueRepresentation;
         return(DHelper.ConvertToDVR(vr));
     }
     return(DVR.UN);
 }