Ejemplo n.º 1
0
        private void SetOffsets(DicomDirectoryRecord record)
        {
            if (record.NextDirectoryRecord != null)
            {
                record.Add <uint>(DicomTag.OffsetOfTheNextDirectoryRecord, record.NextDirectoryRecord.Offset);
                SetOffsets(record.NextDirectoryRecord);
            }
            else
            {
                record.Add <uint>(DicomTag.OffsetOfTheNextDirectoryRecord, 0);
            }

            if (record.LowerLevelDirectoryRecord != null)
            {
                record.Add <uint>(DicomTag.OffsetOfReferencedLowerLevelDirectoryEntity, record.LowerLevelDirectoryRecord.Offset);
                SetOffsets(record.LowerLevelDirectoryRecord);
            }
            else
            {
                record.Add <uint>(DicomTag.OffsetOfReferencedLowerLevelDirectoryEntity, 0);
            }
        }
Ejemplo n.º 2
0
        private DicomDirectoryRecord CreateRecordSequenceItem(DicomDirectoryRecordType recordType, DicomDataset dataset)
        {
            if (recordType == null)
            {
                throw new ArgumentNullException("recordType");
            }
            if (dataset == null)
            {
                throw new ArgumentNullException("dataset");
            }

            var sequenceItem = new DicomDirectoryRecord();

            //add record item attributes
            sequenceItem.Add <uint>(DicomTag.OffsetOfTheNextDirectoryRecord, 0);
            sequenceItem.Add <ushort>(DicomTag.RecordInUseFlag, 0xFFFF);
            sequenceItem.Add <uint>(DicomTag.OffsetOfReferencedLowerLevelDirectoryEntity, 0);
            sequenceItem.Add <string>(DicomTag.DirectoryRecordType, recordType.ToString());

            //copy the current dataset character set
            sequenceItem.Add(dataset.FirstOrDefault(d => d.Tag == DicomTag.SpecificCharacterSet));

            foreach (var tag in recordType.Tags)
            {
                if (dataset.Contains(tag))
                {
                    sequenceItem.Add(dataset.Get <DicomItem>(tag));
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("Cannot find tag {0} for record type {1}", tag, recordType);
                }
            }

            return(sequenceItem);
        }
Ejemplo n.º 3
0
		private DicomDirectoryRecord CreateRecordSequenceItem(DicomDirectoryRecordType recordType, DicomDataset dataset) {
			if (recordType == null)
				throw new ArgumentNullException("recordType");
			if (dataset == null)
				throw new ArgumentNullException("dataset");

			var sequenceItem = new DicomDirectoryRecord();

			//add record item attributes
			sequenceItem.Add<uint>(DicomTag.OffsetOfTheNextDirectoryRecord, 0);
			sequenceItem.Add<ushort>(DicomTag.RecordInUseFlag, 0xFFFF);
			sequenceItem.Add<uint>(DicomTag.OffsetOfReferencedLowerLevelDirectoryEntity, 0);
			sequenceItem.Add<string>(DicomTag.DirectoryRecordType, recordType.ToString());

			//copy the current dataset character set
			sequenceItem.Add(dataset.FirstOrDefault(d => d.Tag == DicomTag.SpecificCharacterSet));

			foreach (var tag in recordType.Tags) {
				if (dataset.Contains(tag)) {
					sequenceItem.Add(dataset.Get<DicomItem>(tag));
				} else {
					System.Diagnostics.Debug.WriteLine("Cannot find tag {0} for record type {1}", tag, recordType);
				}
			}

			return sequenceItem;
		}
Ejemplo n.º 4
0
		private void SetOffsets(DicomDirectoryRecord record) {
			if (record.NextDirectoryRecord != null) {
				record.Add<uint>(DicomTag.OffsetOfTheNextDirectoryRecord, record.NextDirectoryRecord.Offset);
				SetOffsets(record.NextDirectoryRecord);
			} else {
				record.Add<uint>(DicomTag.OffsetOfTheNextDirectoryRecord, 0);
			}

			if (record.LowerLevelDirectoryRecord != null) {
				record.Add<uint>(DicomTag.OffsetOfReferencedLowerLevelDirectoryEntity, record.LowerLevelDirectoryRecord.Offset);
				SetOffsets(record.LowerLevelDirectoryRecord);
			} else {
				record.Add<uint>(DicomTag.OffsetOfReferencedLowerLevelDirectoryEntity, 0);
			}
		}