Skip to content

Commit

Permalink
[ISSUE-80] Values with VRs constructed of character strings are padde…
Browse files Browse the repository at this point in the history
…d with trailing NULL instead of spaces - per per http://dicom.nema.org/dicom/2013/output/chtml/part05/sect_6.2.html
  • Loading branch information
Selim Youssry committed May 28, 2020
1 parent 5b38ce7 commit 96ff260
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion write/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,14 @@ func Element(e *dicomio.Encoder, elem *element.Element, opts ...Option) {
}
sube.WriteString(s)
if len(s)%2 == 1 {
sube.WriteByte(0)
switch vr {
// Values with VRs constructed of character strings, except in the case of the VR UI, shall be padded with SPACE characters
// per http://dicom.nema.org/dicom/2013/output/chtml/part05/sect_6.2.html
case "DT", "LO", "LT", "PN", "SH", "ST", "UT":
sube.WriteString(" ")
default:
sube.WriteByte(0)
}
}
}
if sube.Error() != nil {
Expand Down

0 comments on commit 96ff260

Please sign in to comment.