Skip to content

Commit

Permalink
Ensure #190 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
suyashkumar committed Sep 29, 2024
1 parent 9a71c1f commit f9f3484
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions write_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dicom

import (
"fmt"
"bytes"
"encoding/binary"
"errors"
Expand Down Expand Up @@ -964,3 +965,33 @@ func TestWrite_OverrideMissingTransferSyntax(t *testing.T) {
})
}
}

func MustNewValue(data interface{}) Value {
value, err := NewValue(data)
if err != nil {
panic(err)
}

return value
}

func ExampleIssue190() {
dataset := Dataset{
Elements: []*Element{
&Element{
Tag: tag.SmallestImagePixelValue,
ValueRepresentation: tag.VRUInt16List,
RawValueRepresentation: "US",
ValueLength: 0,
Value: MustNewValue([]int{1}),
},
},
}

buffer := new(bytes.Buffer)
err := Write(buffer, dataset, DefaultMissingTransferSyntax())
if err != nil {
fmt.Printf("err: %v", err)
}
// Output:
}

0 comments on commit f9f3484

Please sign in to comment.