public override List <DCMAbstractType> Decode(byte[] data, ref uint idx) { //a) 用ExplicitVRLittleEndian对象实例化filemeta对象,通过其Decode方法从data中读取头元素 filemeta = new DCMFileMeta(new ExplicitVRLittleEndian()); filemeta.Decode(data, ref idx); //b) 读取(0002,0010)头元素 DCMAbstractType head = filemeta.items.Find(x => ((x.gtag == 0x0002) && (x.etag == 0x0010))); //得到数据集传输语法的uid, String uid = head.GetValue <string>(); //在TransferSyntaxes中找到对应的传输语法对象赋给基类的syn字段 base.syn = TransferSyntaxs.All[uid]; //c) 调用base.Decode方法解码数据集。 return(base.Decode(data, ref idx)); }
public override List <DCMAbstractType> Decode(byte[] data, ref uint idx) { DCMAbstractType elem = syn.Decode(data, ref idx); if (elem.gtag == 0x0002 && elem.etag == 0x0000) { uint ulidx = 0; int glen = (int)elem.GetValue <UInt32>(); byte[] val = new byte[glen]; Array.Copy(data, idx, val, 0, glen); base.Decode(val, ref ulidx); idx += ulidx; } return(items); }