/// <summary> /// Creates a new instance of DcmHandlerImpl /// </summary> public DcmObjectHandler(DcmObject result) { if (result == null) throw new NullReferenceException(); this.result = result; }
public virtual void PutAll(DcmObject dcmObj) { IEnumerator enu = dcmObj.GetEnumerator(); while( enu.MoveNext() ) { DcmElement el = (DcmElement) enu.Current; if (el.IsEmpty()) { PutXX(el.tag(), el.vr()); } else { DcmElement sq; switch (el.vr()) { case VRs.SQ: sq = PutSQ(el.tag()); for (int i = 0, n = el.vm(); i < n; ++i) { sq.AddItem(el.GetItem(i)); } break; case VRs.OB: case VRs.OW: case VRs.UN: if (el.HasDataFragments()) { sq = PutXXsq(el.tag(), el.vr()); for (int i = 0, n = el.vm(); i < n; ++i) { sq.AddDataFragment(el.GetDataFragment(i)); } break; } goto default; default: PutXX(el.tag(), el.vr(), el.GetByteBuffer()); break; } } } }
public virtual void EndDataset() { curDcmObject = null; }
public virtual void EndCommand() { curDcmObject = null; }
public virtual void StartItem(int id, long pos, int length) { curDcmObject = ((DcmElement) seqStack.Peek()).AddNewItem().SetItemOffset( pos ); }
public virtual void StartFileMetaInfo(byte[] preamble) { if (result is Dataset) { curDcmObject = ((Dataset) result).GetFileMetaInfo(); if (curDcmObject == null) ((Dataset) result).SetFileMetaInfo( (FileMetaInfo) (curDcmObject = new FileMetaInfo()) ); } else curDcmObject = (FileMetaInfo) result; seqStack.Clear(); if (preamble != null) { if (preamble.Length == 128) { Array.Copy(preamble, 0, ((FileMetaInfo) curDcmObject).Preamble, 0, 128); } else { // log.warn } } }
public virtual void StartDataset() { curDcmObject = (Dataset) result; seqStack.Clear(); }
public virtual void StartCommand() { curDcmObject = (Command) result; seqStack.Clear(); }
public virtual void EndItem(int len) { curDcmObject = ((Dataset) curDcmObject).Parent; }
public virtual void EndFileMetaInfo() { if (result is Dataset) { curDcmObject = result; } else curDcmObject = null; }