8000 VR's SV and UV have 16 bit Value Length Fields they should be 32 bit · Issue #1386 · fo-dicom/fo-dicom · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
VR's SV and UV have 16 bit Value Length Fields they should be 32 bit #1386
Closed
@BobSter3000

Description

@BobSter3000

Describe the bug
Dicom Tags with a VR of SV and UV should have a value length field of 16 bits as specified in PS3.5 Section 7.1.2

for VRs of AE, AS, AT, CS, DA, DS, DT, FL, FD, IS, LO, LT, PN, SH, SL, SS, ST, TM, UI, UL and US the Value Length Field is the 16-bit unsigned integer following the two byte VR Field (Table 7.1-2). The value of the Value Length Field shall equal the length of the Value Field.

for all other VRs the 16 bits following the two byte VR Field are reserved for use by later versions of the DICOM Standard. These reserved bytes shall be set to 0000H and shall not be used or decoded (Table 7.1-1). The Value Length Field is a 32-bit unsigned integer.

To Reproduce

    DicomDataset ds = new();
    ds.Add(DicomTag.SOPClassUID, DicomUID.SecondaryCaptureImageStorage);
    ds.Add(DicomTag.SOPInstanceUID, "1.1.1.1");
    ds.Add(DicomTag.PatientName, "TEST");
    ds.Add(DicomTag.SelectorOVValue, (ulong)1);
    ds.Add(DicomTag.SelectorSVValue, (long)2);
    ds.Add(DicomTag.SelectorUVValue, (ulong)3);

    DicomFile file = new DicomFile(ds);
    file.Save(@"d:\ds1.dcm");

View the file with a hex editor
72 00 81 00 4F 56 00 00 08 00 00 00 01 00 00 00 00 00 00 00
72 00 82 00 53 56 08 00 02 00 00 00 00 00 00 00
72 00 83 00 55 56 08 00 03 00 00 00 00 00 00 00

Expected behavior
The OV Tag contains the correct Value Length
The SV and UV tags have only 16 bits for the Value Length

I think this should just be a simple change in DicomVR.cs. Changing the Is16bitLength = false for those two VR's produces the following output

72 00 81 00 4F 56 00 00 08 00 00 00 01 00 00 00 00 00 00 00
72 00 82 00 53 56 00 00 08 00 00 00 02 00 00 00 00 00 00 00
72 00 83 00 55 56 00 00 08 00 00 00 03 00 00 00 00 00 00 00

Environment
Fellow Oak DICOM version: (5.0.2)
OS: Windows 10 64 bit
Platform: .NET 6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0