public void LookupDictionary(ref DCMDataElement element)//未将对象引用设置到对象的实例 原为保护方法 { //查数据字典得到VR,Name,VM DicomDictionaryEntry entry = dictionary.GetEntry(element.gtag, element.etag); if (entry != null) { if (element.vr == "" || element.vr == null) { element.vr = entry.VR; } element.name = entry.Name; element.vm = entry.VM; } else if (element.vr == "" && element.etag == 0) { element.vr = "UL"; } else { Console.WriteLine("tag不存在"); } //得到VR对象实例 element.vrparser = vrfactory.GetVR(element.vr); //Console.WriteLine("LookUpDic"); }
public DicomDictionary(string path) { //#1.open dic FileStream fs = File.OpenRead(path); //#2.load dic //set container string s = ""; //initial StreamReader StreamReader sr = new StreamReader(fs, Encoding.Default); fs.Seek(0, SeekOrigin.Begin); //Stream to string s += sr.ReadToEnd(); sr.Close(); fs.Close(); string[] sp = s.Split('\n'); //#3.attach dic store = new List <DicomDictionaryEntry>(); for (int i = 0; i < sp.Length; i++) { DicomDictionaryEntry buffer = new DicomDictionaryEntry(); string[] cache = sp[i].Split('\t'); buffer.Tag = cache[0]; if (cache.Length > 2) { buffer.Name = cache[1]; buffer.Keyword = cache[2]; buffer.VR = cache[3]; buffer.VM = cache[4]; } if (cache.Length == 6) { buffer.Anno = cache[5]; } else { buffer.Anno = ""; } store.Add(buffer); } }