Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedItem == null)
            {
                MessageBox.Show("请选择传输语法");
            }
            else
            {
                TransferSyntax syntax = (TransferSyntax)comboBox1.SelectedItem;
                byte[]         data   = HexStringToByteArray(richTextBox1.Text);
                DCMDataSet     dCM    = new DCMDataSet(syntax);
                uint           idx    = 0;
                //调用Decode方法进行解码
                try
                {
                    dCM.Decode(data, ref idx);
                }
                catch (Exception erro)
                {
                    MessageBox.Show(erro.Message);
                }

                string   str   = dCM.ToString("").Replace("\0", "");
                string[] lines = str.Split('\n');
                lvOutput.Items.Clear();
                for (int i = 0; i < lines.Length; i++)
                {
                    ListViewItem item = new ListViewItem(lines[i].Split('\t'));
                    lvOutput.Items.Add(item);
                }
            }
        }
        public override List <DCMAbstractType> Decode(byte[] data, ref uint idx)
        {
            filemete = new DCMFileMeta(new ExplicitVRLittleEndian());
            DCMAbstractType uid  = filemete.Decode(data, ref idx).Find((DCMAbstractType type) => type.etag == 0x0010 && type.gtag == 0x0002);
            string          uid1 = uid.GetValue <string>();
            TransferSyntax  syn  = TransferSyntaxs.All[uid1];

            Data = new DCMDataSet(syn);
            Data.Decode(data, ref idx);

            return(items);
        }
Example #3
0
 public frmImage(DCMDataSet items)
 {
     InitializeComponent();
     this.items = items;
 }