Gets the byte offset of the element from the beginning of the file
public long Offset { get; } Public ReadOnly Property Offset As Long public:property int64 Offset {int64 get();}
The byte offset of the element from the beginning of the file
Depending on the transfer syntax and value representation, a DICOM Element is stored in a file as one of the following
The Offset property returns the byte offset for the DicomElement in the file. If you seek to this offset in the DICOM file, the next 4 bytes will be the Tag (group, element) of the DICOM element.
This example displays information about each element in a DicomDataSet including: * Tag * Name * Offset * Value offset * Value length
using Leadtools;using Leadtools.Dicom;///private void DicomDataSetOffsetTest(DicomDataSet ds){DicomElement element = ds.GetFirstElement(null, false, true);while (element != null){DumpElementValue(element);element = ds.GetNextElement(element, false, true);}}private string GetElementString(DicomElement p){if (p == null)return string.Empty;return string.Format("({0:X4},{1:X4})", p.Tag >> 0x10, p.Tag & 0xFFFF);}private string Truncate(string s, int length){if (s.Length > length)return s.Substring(0, length);return s;}private void DumpElementValue(DicomElement element){DicomTag tag = DicomTagTable.Instance.Find(element.Tag);string name = string.Empty;if (tag != null){name = tag.Name;}Console.WriteLine(@"{0} {1,-30} 0x{2:X8} 0x{3:X8} {4}",GetElementString(element),Truncate(name, 30),element.Offset,element.ValueOffset,element.ValueLength);}
Imports LeadtoolsImports Leadtools.Dicom'''Private Sub DicomDataSetOffsetTest(ByVal ds As DicomDataSet)Dim element As DicomElement = ds.GetFirstElement(Nothing, False, True)Do While element IsNot NothingDumpElementValue(element)element = ds.GetNextElement(element, False, True)LoopEnd SubPrivate Sub DumpElementValue(ByVal element As DicomElement)Dim tag As DicomTag = DicomTagTable.Instance.Find(element.Tag)Dim name As String = String.EmptyIf tag IsNot Nothing Thenname = tag.NameEnd IfConsole.WriteLine("{0} {1,-30} 0x{2:X8} 0x{3:X8} {4}", GetElementString(element), Truncate(name, 30), element.Offset, element.ValueOffset, element.ValueLength)End SubPrivate Function GetElementString(ByVal p As DicomElement) As StringIf p Is Nothing ThenReturn String.EmptyEnd IfReturn String.Format("({0:X4},{1:X4})", p.Tag >> &H10, p.Tag And &HFFFF)End FunctionPrivate Function Truncate(ByVal s As String, ByVal length As Integer) As StringIf s.Length > length ThenReturn s.Substring(0, length)End IfReturn sEnd Function
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
