private DicomDirectoryRecord ParseDirectoryRecord(uint offset, List <uint> notFoundOffsets)
        {
            DicomDirectoryRecord record = null;

            if (!_lookup.TryGetValue(offset, out var dataset))
            {
                if (offset != 0)
                {
                    notFoundOffsets.Add(offset);
                }
            }
            else
            {
                record = new DicomDirectoryRecord(dataset)
                {
                    Offset = offset
                };

                _lookup.Remove(offset);

                record.NextDirectoryRecord =
                    ParseDirectoryRecord(record.GetSingleValue <uint>(DicomTag.OffsetOfTheNextDirectoryRecord), notFoundOffsets);

                record.LowerLevelDirectoryRecord =
                    ParseDirectoryRecord(record.GetSingleValue <uint>(DicomTag.OffsetOfReferencedLowerLevelDirectoryEntity), notFoundOffsets);
            }

            return(record);
        }
        private DicomDirectoryRecord ParseDirectoryRecord(uint offset)
        {
            DicomDirectoryRecord record = null;

            if (_lookup.ContainsKey(offset))
            {
                record        = new DicomDirectoryRecord(_lookup[offset]);
                record.Offset = offset;

                record.NextDirectoryRecord =
                    ParseDirectoryRecord(record.GetSingleValue <uint>(DicomTag.OffsetOfTheNextDirectoryRecord));

                record.LowerLevelDirectoryRecord =
                    ParseDirectoryRecord(record.GetSingleValue <uint>(DicomTag.OffsetOfReferencedLowerLevelDirectoryEntity));
            }

            return(record);
        }
Beispiel #3
0
            public void AssertRecord(DicomDirectoryRecord record)
            {
                if (Id != 0)
                {
                    Assert.Equal(Id.ToString(), record.GetSingleValue <string>(DicomTag.SOPInstanceUID));
                }

                DicomDirectoryRecord current = record.LowerLevelDirectoryRecord;

                foreach (var child in Children)
                {
                    Assert.NotNull(current);
                    child.AssertRecord(current);
                    current = current.NextDirectoryRecord;
                }
                Assert.Null(current);
            }