UIDs of odd length.

16 views
Skip to first unread message

Brian O'Brien

unread,
Jul 14, 2023, 8:29:46 AM7/14/23
to pydicom
Has anyone noticed if UIDs of odd length are terminated in 0x00 or 0x20 when written to Part10?


Darcy Mason

unread,
Jul 14, 2023, 8:47:08 AM7/14/23
to pydicom
According to the standard, they should be null-terminated: https://dicom.nema.org/medical/dicom/current/output/chtml/part05/chapter_9.html#sect_9.1

Brian O'Brien

unread,
Jul 14, 2023, 11:48:20 AM7/14/23
to pydicom
If I'm not mistaken they are currently padded with spaces instead of nul

Darcy Mason

unread,
Jul 16, 2023, 9:39:36 AM7/16/23
to pydicom

Shouldn't be - checking the code, `write_UI` passes a `\0` to `write_string`, which does seem to use the passed value for padding.

However, if the original read from a file came padded with a space character, pydicom might write that back unchanged if the value had never been accessed (and therefore decoded, forcing pydicom to encode it when writing back).
Reply all
Reply to author
Forward
0 new messages