From 1a006d11b9ae9daf906a572d2889de9e63d1df5c Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 27 May 2024 18:03:11 +0000 Subject: [PATCH] Edit test to ensure we can now write Pixel Data with OB VR --- write_test.go | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/write_test.go b/write_test.go index 3966b87d..a5fc1840 100644 --- a/write_test.go +++ b/write_test.go @@ -6,9 +6,8 @@ import ( "os" "testing" - "github.com/suyashkumar/dicom/pkg/vrraw" - "github.com/suyashkumar/dicom/pkg/frame" + "github.com/suyashkumar/dicom/pkg/vrraw" "github.com/google/go-cmp/cmp/cmpopts" @@ -400,17 +399,23 @@ func TestWrite(t *testing.T) { dataset: Dataset{Elements: []*Element{ mustNewElement(tag.MediaStorageSOPClassUID, []string{"1.2.840.10008.5.1.4.1.1.1.2"}), mustNewElement(tag.MediaStorageSOPInstanceUID, []string{"1.2.3.4.5.6.7"}), - mustNewElement(tag.TransferSyntaxUID, []string{uid.ImplicitVRLittleEndian}), + mustNewElement(tag.TransferSyntaxUID, []string{uid.ExplicitVRLittleEndian}), mustNewElement(tag.BitsAllocated, []int{8}), - setUndefinedLength(mustNewElement(tag.PixelData, PixelDataInfo{ - IsEncapsulated: true, - Frames: []*frame.Frame{ - { - Encapsulated: true, - EncapsulatedData: frame.EncapsulatedFrame{Data: []byte{1, 2, 3, 4}}, + setUndefinedLength(&Element{ + Tag: tag.PixelData, + ValueRepresentation: tag.VRPixelData, + // Encapsulated should always have OB VR, but mustNewElement would make it OW. + RawValueRepresentation: "OB", + Value: mustNewValue(PixelDataInfo{ + IsEncapsulated: true, + Frames: []*frame.Frame{ + { + Encapsulated: true, + EncapsulatedData: frame.EncapsulatedFrame{Data: []byte{1, 2, 3, 4}}, + }, }, - }, - })), + }), + }), mustNewElement(tag.FloatingPointValue, []float64{128.10}), mustNewElement(tag.DimensionIndexPointer, []int{32, 36950}), }},