示例#1
0
        private void Add(ushort group, ushort element, DicomVR vr, string value)
        {
            var key = String.Format("{0}{1}", group.ToString("X4"), element.ToString("X4"));

            if (IsString(vr))
            {
                var values = new string[1];
                values[0]        = value;
                _attributes[key] = new
                {
                    vr    = vr.ToString(),
                    Value = values
                };
            }
            else if (IsFloat(vr))
            {
                var values = new double[1];
                values[0]        = Double.Parse(value);
                _attributes[key] = new
                {
                    vr    = vr.ToString(),
                    Value = values
                };
            }
            else if (IsInteger(vr))
            {
                var values = new long[1];
                values[0]        = Int64.Parse(value);
                _attributes[key] = new
                {
                    vr    = vr.ToString(),
                    Value = values
                };
            }
            else if (IsName(vr))
            {
                var pnValues = new object[1];
                pnValues[0] = new
                {
                    Alphabetic = value
                };

                _attributes[key] = new
                {
                    vr    = vr.ToString(),
                    Value = pnValues
                };
            }
            else if (IsBase64(vr))
            {
                // todo: base 64 encoding
                return;
            }
            else if (IsSequence(vr))
            {
                // todo: sequence encoding
                return;
            }
        }
示例#2
0
        public void GivenPrivateExtendedQueryTag_WhenInitialize_ThenShouldCreatedSuccessfully()
        {
            DicomTag      tag        = new DicomTag(0x1205, 0x1003, "PrivateCreator1");
            DicomVR       vr         = DicomVR.CS;
            QueryTagLevel level      = QueryTagLevel.Study;
            var           storeEntry = tag.BuildExtendedQueryTagStoreEntry(vr: vr.ToString(), privateCreator: tag.PrivateCreator.Creator, level: level);
            QueryTag      queryTag   = new QueryTag(storeEntry);

            Assert.Equal(tag, queryTag.Tag);
            Assert.Equal(vr, queryTag.VR);
            Assert.Equal(storeEntry, queryTag.ExtendedQueryTagStoreEntry);
            Assert.True(queryTag.IsExtendedQueryTag);
            Assert.Equal(level, queryTag.Level);
        }
示例#3
0
        private string getVRString()
        {
            DicomVR vr = DicomVR.UN;

            if (_element != null)
            {
                vr = _element.ValueRepresentation;
            }

            DicomVR svr = DicomVR.UN;

            if (vr == DicomVR.UN)
            {
                svr = SwitchVR();
            }

            string str = vr.ToString();

            if (svr != DicomVR.UN)
            {
                str += "(" + svr.ToString() + ")";                     // this can only happen when receiving UN tag in explicit transfer syntax 20080319
            }
            return(str);
        }