private DicomReadStatus ParseTag(DicomTag stopAtTag, DicomReadOptions options) { if (_tag == null) { if (_remain >= 4) { _pos = _stream.Position + _offset; ushort g = _reader.ReadUInt16(); if (Flags.IsSet(options, DicomReadOptions.FileMetaInfoOnly) && g != 0x0002) { _stream.Seek(-2, SeekOrigin.Current); return(DicomReadStatus.SuccessEndRead); } ushort e = _reader.ReadUInt16(); if (DicomTag.IsPrivateGroup(g) && e > 0x00ff) { uint card = DicomTag.GetCard(g, e); if ((card & 0xffffff00) != _privateCreatorCard) { _privateCreatorCard = card & 0xffffff00; DicomTag pct = DicomTag.GetPrivateCreatorTag(g, e); DcmDataset ds = _dataset; if (_sds.Count > 0 && _sds.Count == _sqs.Count) { ds = _sds.Peek(); if (!ds.Contains(pct)) { ds = _dataset; } } _privateCreatorId = ds.GetString(pct, String.Empty); } _tag = new DicomTag(g, e, _privateCreatorId); } else { _tag = new DicomTag(g, e); if (g == 0xfffe) { if (_tag == DicomTags.Item || _tag == DicomTags.ItemDelimitationItem || _tag == DicomTags.SequenceDelimitationItem) { _vr = DicomVR.NONE; } } } _remain -= 4; _bytes += 4; _read += 4; } else { return(NeedMoreData(4)); } } if (_tag == DicomTags.ItemDelimitationItem && Flags.IsSet(options, DicomReadOptions.SequenceItemOnly)) { return(DicomReadStatus.SuccessEndRead); } if (_tag >= stopAtTag) { return(DicomReadStatus.SuccessEndRead); } return(DicomReadStatus.Success); }