diff --git a/element.go b/element.go index 2682a311..3c9cd2df 100644 --- a/element.go +++ b/element.go @@ -11,10 +11,10 @@ import ( "github.com/suyashkumar/dicom/pkg/tag" ) -// ErrorUnexpectedDataType indicates that an unexpected (not allowed) data type was sent to NewValue. -var ErrorUnexpectedDataType = errors.New("the type of the data was unexpected or not allowed") +// ErrorUnexpectedDataType indicates that an unexpected (not allowed) int16Data type was sent to NewValue. +var ErrorUnexpectedDataType = errors.New("the type of the int16Data was unexpected or not allowed") -// Element represents a standard DICOM data element (see the DICOM standard: +// Element represents a standard DICOM int16Data element (see the DICOM standard: // https://dicom.nema.org/medical/dicom/current/output/html/part05.html#sect_7.1 ). // This Element can be serialized to JSON out of the box and pretty printed as a string via the String() method. type Element struct { @@ -57,14 +57,14 @@ func (e *Element) String() string { e.Value.String()) } -// Value represents a DICOM value. The underlying data that a Value stores can be determined by inspecting its +// Value represents a DICOM value. The underlying int16Data that a Value stores can be determined by inspecting its // ValueType. DICOM values typically can be one of many types (ints, strings, bytes, sequences of other elements, etc), // so this Value interface attempts to represent this as canoically as possible in Golang (since generics do not exist // yet). // // Value is JSON serializable out of the box (implements json.Marshaler). // -// If necessary, a Value's data can be efficiently unpacked by inspecting its underlying ValueType and either using a +// If necessary, a Value's int16Data can be efficiently unpacked by inspecting its underlying ValueType and either using a // Golang type assertion or using the helper functions provided (like MustGetStrings). Because for each ValueType there // is exactly one underlying Golang type, this should be safe, efficient, and straightforward. // @@ -79,14 +79,14 @@ func (e *Element) String() string { // // ... // } // -// Unpacking the data like above is only necessary if something specific needs to be done with the underlying data. -// See the Element and Dataset examples as well to see how to work with this kind of data, and common patterns for doing +// Unpacking the int16Data like above is only necessary if something specific needs to be done with the underlying int16Data. +// See the Element and Dataset examples as well to see how to work with this kind of int16Data, and common patterns for doing // so. type Value interface { // All types that can be a "Value" for an element will implement this empty method, similar to how protocol buffers // implement "oneof" in Go isElementValue() - // ValueType returns the underlying ValueType of this Value. This can be used to unpack the underlying data in this + // ValueType returns the underlying ValueType of this Value. This can be used to unpack the underlying int16Data in this // Value. ValueType() ValueType // GetValue returns the underlying value that this Value holds. What type is returned here can be determined exactly @@ -98,7 +98,7 @@ type Value interface { Equals(Value) bool } -// NewValue creates a new DICOM value for the supplied data. Likely most useful +// NewValue creates a new DICOM value for the supplied int16Data. Likely most useful // if creating an Element in testing or write scenarios. // // Data must be one of the following types, otherwise and error will be returned @@ -140,7 +140,7 @@ func mustNewValue(data interface{}) Value { } // NewElement creates a new DICOM Element with the supplied tag and with a value -// built from the provided data. The data can be one of the types that is +// built from the provided int16Data. The int16Data can be one of the types that is // acceptable to NewValue. func NewElement(t tag.Tag, data interface{}) (*Element, error) { tagInfo, err := tag.Find(t) @@ -337,7 +337,7 @@ type SequenceItemValue struct { func (s *SequenceItemValue) isElementValue() {} // ValueType returns the underlying ValueType of this Value. This can be used -// to unpack the underlying data in this Value. +// to unpack the underlying int16Data in this Value. func (s *SequenceItemValue) ValueType() ValueType { return SequenceItem } // GetValue returns the underlying value that this Value holds. What type is @@ -406,7 +406,7 @@ func (s *sequencesValue) Equals(target Value) bool { // PixelDataInfo is a representation of DICOM PixelData. type PixelDataInfo struct { // IntentionallySkipped indicates that reading the PixelData value was - // intentionally skipped and no Value data for this tag was read. + // intentionally skipped and no Value int16Data for this tag was read. // This is likely true if the dicom.SkipPixelData option was set. If true, // the rest of this PixelDataInfo will be empty. IntentionallySkipped bool `json:"intentionallySkipped"` @@ -428,7 +428,7 @@ type PixelDataInfo struct { // should work. This will be true if the // dicom.SkipProcessingPixelDataValue flag is set with a PixelData tag. IntentionallyUnprocessed bool `json:"intentionallyUnprocessed"` - // UnprocessedValueData holds the unprocessed Element value data if + // UnprocessedValueData holds the unprocessed Element value int16Data if // IntentionallyUnprocessed=true. UnprocessedValueData []byte } @@ -443,7 +443,7 @@ func (p *pixelDataValue) ValueType() ValueType { return PixelData } func (p *pixelDataValue) GetValue() interface{} { return p.PixelDataInfo } func (p *pixelDataValue) String() string { if len(p.Frames) == 0 { - return "empty pixel data" + return "empty pixel int16Data" } if p.IsEncapsulated { return fmt.Sprintf("encapsulated FramesLength=%d Frame[0] size=%d", len(p.Frames), len(p.Frames[0].EncapsulatedData.Data)) diff --git a/parse.go b/parse.go index ef15c863..98757680 100644 --- a/parse.go +++ b/parse.go @@ -2,7 +2,7 @@ // work with DICOM (https://dicom.nema.org/) medical image files in Go. // // dicom.Parse and dicom.Write provide the core functionality to read and write -// DICOM Datasets. This package provides Go data structures that represent +// DICOM Datasets. This package provides Go int16Data structures that represent // DICOM concepts (for example, dicom.Dataset and dicom.Element). These // structures will pretty-print by default and are JSON serializable out of the // box. @@ -260,10 +260,10 @@ func SkipMetadataReadOnNewParserInit() ParseOption { } } -// SkipPixelData skips reading data from the PixelData tag, wherever it appears +// SkipPixelData skips reading int16Data from the PixelData tag, wherever it appears // (e.g. even if within an IconSequence). A PixelDataInfo will be added to the // Dataset with the IntentionallySkipped property set to true, and no other -// data. Use this option if you don't need the PixelData value to be in the +// int16Data. Use this option if you don't need the PixelData value to be in the // Dataset at all, and want to save both CPU and Memory. If you need the // PixelData value in the Dataset (e.g. so it can be written out identically // later) but _don't_ want to process/parse the value, see the @@ -281,8 +281,8 @@ func SkipPixelData() ParseOption { // a PixelData element will be added to the dataset with the // PixelDataInfo.IntentionallyUnprocessed = true, and the raw bytes of the // entire PixelData element stored in PixelDataInfo.UnprocessedValueData. -// -// In the future, we may be able to extend this functionality to support +// +// In the future, we may be able to extend this functionality to support // on-demand processing of elements elsewhere in the library. func SkipProcessingPixelDataValue() ParseOption { return func(set *parseOptSet) { diff --git a/parse_test.go b/parse_test.go index 584e40ca..457c5295 100644 --- a/parse_test.go +++ b/parse_test.go @@ -275,7 +275,7 @@ func Example_readFile() { // See also: dicom.Parse, which uses a more generic io.Reader API. dataset, _ := dicom.ParseFile("testdata/1.dcm", nil) - // Dataset will nicely print the DICOM dataset data out of the box. + // Dataset will nicely print the DICOM dataset int16Data out of the box. fmt.Println(dataset) // Dataset is also JSON serializable out of the box. diff --git a/read.go b/read.go index 54b4e30d..c66112b6 100644 --- a/read.go +++ b/read.go @@ -31,11 +31,11 @@ var ( ErrorUnsupportedBitsAllocated = errors.New("unsupported BitsAllocated") errorUnableToParseFloat = errors.New("unable to parse float type") ErrorExpectedEvenLength = errors.New("field length is not even, in violation of DICOM spec") - ErrorSignedNativePixelDataUnsupported = errors.New("the Pixel Representation tag indicates signed native pixel data is present, _and_ negative Pixel Data values were found, but this is not yet supported") + ErrorSignedNativePixelDataUnsupported = errors.New("the Pixel Representation tag indicates signed native pixel int16Data is present, _and_ negative Pixel Data values were found, but this is not yet supported") ) // reader is responsible for mid-level dicom parsing capabilities, like -// reading tags, VRs, and elements from the low-level dicomio.Reader dicom data. +// reading tags, VRs, and elements from the low-level dicomio.Reader dicom int16Data. // TODO(suyashkumar): consider revisiting naming of this struct "reader" as it // interplays with the rawReader dicomio.Reader. We could consider combining // them, or embedding the dicomio.Reader struct into reader. @@ -211,7 +211,7 @@ func (r *reader) readHeader() ([]*Element, error) { return nil, err } debug.Logf("header-group: %v", group) - // Only read group 2 data + // Only read group 2 int16Data if group != 0x0002 { break } @@ -281,8 +281,8 @@ func (r *reader) readPixelData(vl uint32, d *Dataset, fc chan<- *frame.Frame) (V return val, err } - // Assume we're reading NativeData data since we have a defined value length as per Part 5 Sec A.4 of DICOM spec. - // We need Elements that have been already parsed (rows, cols, etc) to parse frames out of NativeData Pixel data + // Assume we're reading NativeData int16Data since we have a defined value length as per Part 5 Sec A.4 of DICOM spec. + // We need Elements that have been already parsed (rows, cols, etc) to parse frames out of NativeData Pixel int16Data if d == nil { return nil, errors.New("the Dataset context cannot be nil in order to read Native PixelData") } @@ -323,7 +323,7 @@ func fillBufferSingleBitAllocated(pixelData []int, d dicomio.Reader, bo binary.B debug.Logf("currentByte: %0b", currentByte) // Read in the 8 bits from the current byte. - // Always treat the data as LittleEndian encoded. + // Always treat the int16Data as LittleEndian encoded. // This is what pydicom appears to do, and I can't get Go to properly // write out bytes literals in BigEndian, even using binary.Write // (in order to test what BigEndian might look like). We should consider diff --git a/read_test.go b/read_test.go index e859ae01..d44f5477 100644 --- a/read_test.go +++ b/read_test.go @@ -211,8 +211,8 @@ func TestReadNativeFrames(t *testing.T) { cases := []struct { Name string existingData Dataset - data []int16 - dataBytes []byte + int16Data []int16 + uint8Data []byte expectedPixelData *PixelDataInfo expectedError error pixelVLOverride uint32 @@ -228,7 +228,7 @@ func TestReadNativeFrames(t *testing.T) { mustNewElement(tag.SamplesPerPixel, []int{1}), mustNewElement(tag.PixelRepresentation, []int{0}), }}, - data: []int16{1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + int16Data: []int16{1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, expectedPixelData: &PixelDataInfo{ IsEncapsulated: false, Frames: []*frame.Frame{ @@ -255,7 +255,7 @@ func TestReadNativeFrames(t *testing.T) { mustNewElement(tag.SamplesPerPixel, []int{1}), mustNewElement(tag.PixelRepresentation, []int{0}), }}, - data: []int16{1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 0}, + int16Data: []int16{1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 0}, expectedPixelData: &PixelDataInfo{ IsEncapsulated: false, Frames: []*frame.Frame{ @@ -300,7 +300,7 @@ func TestReadNativeFrames(t *testing.T) { mustNewElement(tag.SamplesPerPixel, []int{2}), mustNewElement(tag.PixelRepresentation, []int{0}), }}, - data: []int16{1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 5}, + int16Data: []int16{1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 5}, expectedPixelData: &PixelDataInfo{ IsEncapsulated: false, Frames: []*frame.Frame{ @@ -336,7 +336,7 @@ func TestReadNativeFrames(t *testing.T) { mustNewElement(tag.SamplesPerPixel, []int{2}), mustNewElement(tag.PixelRepresentation, []int{0}), }}, - data: []int16{1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3}, + int16Data: []int16{1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3}, expectedPixelData: nil, expectedError: ErrorMismatchPixelDataLength, }, @@ -350,7 +350,7 @@ func TestReadNativeFrames(t *testing.T) { mustNewElement(tag.SamplesPerPixel, []int{2}), mustNewElement(tag.PixelRepresentation, []int{0}), }}, - data: []int16{1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 2}, + int16Data: []int16{1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 2}, expectedPixelData: nil, expectedError: ErrorMismatchPixelDataLength, }, @@ -364,7 +364,7 @@ func TestReadNativeFrames(t *testing.T) { mustNewElement(tag.SamplesPerPixel, []int{2}), mustNewElement(tag.PixelRepresentation, []int{0}), }}, - data: []int16{1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 2}, + int16Data: []int16{1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 2}, expectedPixelData: &PixelDataInfo{ ParseErr: ErrorMismatchPixelDataLength, Frames: []*frame.Frame{ @@ -387,7 +387,7 @@ func TestReadNativeFrames(t *testing.T) { mustNewElement(tag.SamplesPerPixel, []int{1}), mustNewElement(tag.PixelRepresentation, []int{0}), }}, - data: []int16{1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + int16Data: []int16{1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, expectedPixelData: nil, expectedError: ErrorElementNotFound, }, @@ -401,12 +401,12 @@ func TestReadNativeFrames(t *testing.T) { mustNewElement(tag.SamplesPerPixel, []int{1}), mustNewElement(tag.PixelRepresentation, []int{0}), }}, - data: []int16{1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + int16Data: []int16{1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, expectedPixelData: nil, expectedError: ErrorUnsupportedBitsAllocated, }, { - Name: "3x3, 3 frames, 1 samples/pixel, data bytes with padded 0", + Name: "3x3, 3 frames, 1 samples/pixel, int16Data bytes with padded 0", existingData: Dataset{Elements: []*Element{ mustNewElement(tag.Rows, []int{3}), mustNewElement(tag.Columns, []int{3}), @@ -415,7 +415,7 @@ func TestReadNativeFrames(t *testing.T) { mustNewElement(tag.SamplesPerPixel, []int{1}), mustNewElement(tag.PixelRepresentation, []int{0}), }}, - dataBytes: []byte{11, 12, 13, 21, 22, 23, 31, 32, 33, 11, 12, 13, 21, 22, 23, 31, 32, 33, 11, 12, 13, 21, 22, 23, 31, 32, 33, 0}, // there is a 28th byte to make total value length even, as required by DICOM spec + uint8Data: []byte{11, 12, 13, 21, 22, 23, 31, 32, 33, 11, 12, 13, 21, 22, 23, 31, 32, 33, 11, 12, 13, 21, 22, 23, 31, 32, 33, 0}, // there is a 28th byte to make total value length even, as required by DICOM spec expectedPixelData: &PixelDataInfo{ IsEncapsulated: false, Frames: []*frame.Frame{ @@ -452,7 +452,7 @@ func TestReadNativeFrames(t *testing.T) { expectedError: nil, }, { - Name: "1x1, 3 frames, 3 samples/pixel, data bytes with padded 0", + Name: "1x1, 3 frames, 3 samples/pixel, int16Data bytes with padded 0", existingData: Dataset{Elements: []*Element{ mustNewElement(tag.Rows, []int{1}), mustNewElement(tag.Columns, []int{1}), @@ -461,7 +461,7 @@ func TestReadNativeFrames(t *testing.T) { mustNewElement(tag.SamplesPerPixel, []int{3}), mustNewElement(tag.PixelRepresentation, []int{0}), }}, - dataBytes: []byte{1, 2, 3, 1, 2, 3, 1, 2, 3, 0}, // 10th byte to make total value length even + uint8Data: []byte{1, 2, 3, 1, 2, 3, 1, 2, 3, 0}, // 10th byte to make total value length even expectedPixelData: &PixelDataInfo{ IsEncapsulated: false, Frames: []*frame.Frame{ @@ -506,7 +506,7 @@ func TestReadNativeFrames(t *testing.T) { mustNewElement(tag.SamplesPerPixel, []int{3}), mustNewElement(tag.PixelRepresentation, []int{0}), }}, - dataBytes: []byte{1, 2, 3, 1, 2, 3}, + uint8Data: []byte{1, 2, 3, 1, 2, 3}, expectedPixelData: nil, pixelVLOverride: 7, expectedError: ErrorExpectedEvenLength, @@ -521,7 +521,7 @@ func TestReadNativeFrames(t *testing.T) { mustNewElement(tag.SamplesPerPixel, []int{1}), mustNewElement(tag.PixelRepresentation, []int{1}), }}, - dataBytes: []byte{1, 2, 3, 0}, + uint8Data: []byte{1, 2, 3, 0}, expectedPixelData: &PixelDataInfo{ IsEncapsulated: false, Frames: []*frame.Frame{ @@ -547,21 +547,21 @@ func TestReadNativeFrames(t *testing.T) { mustNewElement(tag.SamplesPerPixel, []int{1}), mustNewElement(tag.PixelRepresentation, []int{1}), }}, - dataBytes: []byte{0b10000001, 2, 3, 0}, + uint8Data: []byte{0b10000001, 2, 3, 0}, expectedPixelData: nil, expectedError: ErrorSignedNativePixelDataUnsupported, }, { Name: "Signed Pixel Representation with No Negative Values, uint16: No Error", existingData: Dataset{Elements: []*Element{ - mustNewElement(tag.Rows, []int{5}), - mustNewElement(tag.Columns, []int{5}), + mustNewElement(tag.Rows, []int{2}), + mustNewElement(tag.Columns, []int{2}), mustNewElement(tag.NumberOfFrames, []string{"1"}), mustNewElement(tag.BitsAllocated, []int{16}), mustNewElement(tag.SamplesPerPixel, []int{1}), mustNewElement(tag.PixelRepresentation, []int{1}), }}, - data: []int16{1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + int16Data: []int16{1, 2, 3, 4}, expectedPixelData: &PixelDataInfo{ IsEncapsulated: false, Frames: []*frame.Frame{ @@ -569,9 +569,9 @@ func TestReadNativeFrames(t *testing.T) { Encapsulated: false, NativeData: frame.NativeFrame{ BitsPerSample: 16, - Rows: 5, - Cols: 5, - Data: [][]int{{1}, {2}, {3}, {4}, {5}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}}, + Rows: 2, + Cols: 2, + Data: [][]int{{1}, {2}, {3}, {4}}, }, }, }, @@ -580,14 +580,14 @@ func TestReadNativeFrames(t *testing.T) { { Name: "Signed Pixel Representation with Negative Values, uint16: Returns Error", existingData: Dataset{Elements: []*Element{ - mustNewElement(tag.Rows, []int{5}), - mustNewElement(tag.Columns, []int{5}), + mustNewElement(tag.Rows, []int{2}), + mustNewElement(tag.Columns, []int{2}), mustNewElement(tag.NumberOfFrames, []string{"1"}), mustNewElement(tag.BitsAllocated, []int{16}), mustNewElement(tag.SamplesPerPixel, []int{1}), mustNewElement(tag.PixelRepresentation, []int{1}), }}, - data: []int16{-1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + int16Data: []int16{-1, 2, 3, 4}, expectedPixelData: nil, expectedError: ErrorSignedNativePixelDataUnsupported, }, @@ -599,14 +599,15 @@ func TestReadNativeFrames(t *testing.T) { var dcmdata *bytes.Buffer var expectedBytes int - if len(tc.data) == 0 { + if len(tc.uint8Data) > 0 { // writing byte-by-byte - expectedBytes = len(tc.dataBytes) - dcmdata = writeIntsToBuffer(t, tc.dataBytes) - } else { + expectedBytes = len(tc.uint8Data) + dcmdata = writeIntsToBuffer(t, tc.uint8Data) + } + if len(tc.int16Data) > 0 { // writing 2 bytes (uint16) at a time - expectedBytes = len(tc.data) * 2 - dcmdata = writeIntsToBuffer(t, tc.data) + expectedBytes = len(tc.int16Data) * 2 + dcmdata = writeIntsToBuffer(t, tc.int16Data) } var vl uint32 @@ -623,14 +624,14 @@ func TestReadNativeFrames(t *testing.T) { pixelData, bytesRead, err := r.readNativeFrames(&tc.existingData, nil, vl) if !errors.Is(err, tc.expectedError) { - t.Errorf("TestReadNativeFrames(%v): did not get expected error. got: %v, want: %v", tc.data, err, tc.expectedError) + t.Errorf("TestReadNativeFrames(%v): did not get expected error. got: %v, want: %v", tc.int16Data, err, tc.expectedError) } if err == nil && bytesRead != expectedBytes { - t.Errorf("TestReadNativeFrames(%v): did not read expected number of bytes. got: %d, want: %d", tc.data, bytesRead, expectedBytes) + t.Errorf("TestReadNativeFrames(%v): did not read expected number of bytes. got: %d, want: %d", tc.int16Data, bytesRead, expectedBytes) } if diff := cmp.Diff(tc.expectedPixelData, pixelData, cmpopts.EquateErrors()); diff != "" { - t.Errorf("TestReadNativeFrames(%v): unexpected diff: %v", tc.data, diff) + t.Errorf("TestReadNativeFrames(%v): unexpected diff: %v", tc.int16Data, diff) } }) } @@ -795,9 +796,9 @@ func TestReadPixelData_SkipPixelData(t *testing.T) { } } -// Used to encode the data from the generated headers. +// Used to encode the int16Data from the generated headers. type headerData struct { - // The byte encoded header data. + // The byte encoded header int16Data. HeaderBytes *bytes.Buffer // The decoded elements conforming the header. Elements []*Element @@ -890,7 +891,7 @@ func TestReadHeader_TryAllowErrorMetaElementGroupLength(t *testing.T) { t.Run("NoFileMetaInformationGroupLength", func(t *testing.T) { dcmheaderNoInfoGrpLen, err := headerWithNoFileMetaInformationGroupLength() if err != nil { - t.Fatalf("unsuccesful generation of fake header data") + t.Fatalf("unsuccesful generation of fake header int16Data") } else { r := &reader{ rawReader: dicomio.NewReader(bufio.NewReader(dcmheaderNoInfoGrpLen.HeaderBytes), binary.LittleEndian, int64(dcmheaderNoInfoGrpLen.HeaderBytes.Len())), @@ -911,7 +912,7 @@ func TestReadHeader_TryAllowErrorMetaElementGroupLength(t *testing.T) { t.Run("WithFileMetaInformationGroupLength", func(t *testing.T) { dcmHeaderInfoGrpLen, err := headerWithFileMetaInformationGroupLength() if err != nil { - t.Fatalf("unsuccesful generation of fake header data with FileMetaInformationGroupLength") + t.Fatalf("unsuccesful generation of fake header int16Data with FileMetaInformationGroupLength") } else { r := &reader{ rawReader: dicomio.NewReader(bufio.NewReader(dcmHeaderInfoGrpLen.HeaderBytes), binary.LittleEndian, int64(dcmHeaderInfoGrpLen.HeaderBytes.Len())), @@ -1062,7 +1063,7 @@ func TestReadNativeFrames_OneBitAllocated(t *testing.T) { } if diff := cmp.Diff(tc.expectedPixelData, pixelData); diff != "" { - t.Errorf("TestReadNativeFrames(%v): unexpected diff: %v\ndata:%v", tc.data, diff, pixelData) + t.Errorf("TestReadNativeFrames(%v): unexpected diff: %v\nint16Data:%v", tc.data, diff, pixelData) } }) } diff --git a/write_test.go b/write_test.go index 4385d5da..f0a1e506 100644 --- a/write_test.go +++ b/write_test.go @@ -67,10 +67,10 @@ 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"}), - // We need to use an Explicit transfer syntax here or all data will be + // We need to use an Explicit transfer syntax here or all int16Data will be // read in with "UN". mustNewElement(tag.TransferSyntaxUID, []string{uid.ExplicitVRLittleEndian}), - mustNewPrivateElement(tag.Tag{0x0003, 0x0010}, vrraw.ShortText, []string{"some data"}), + mustNewPrivateElement(tag.Tag{0x0003, 0x0010}, vrraw.ShortText, []string{"some int16Data"}), }}, expectedError: nil, }, @@ -508,7 +508,7 @@ func TestWrite(t *testing.T) { } file.Close() - // Read the data back in and check for equality to the tc.dataset: + // Read the int16Data back in and check for equality to the tc.dataset: if tc.expectedError == nil { f, err := os.Open(file.Name()) if err != nil { @@ -539,7 +539,7 @@ func TestWrite(t *testing.T) { readDS.Elements, cmpOpts..., ); diff != "" { - t.Errorf("Reading back written dataset led to unexpected diff from source data: %s", diff) + t.Errorf("Reading back written dataset led to unexpected diff from source int16Data: %s", diff) } } }) @@ -681,7 +681,7 @@ func TestWriteFloats(t *testing.T) { t.Errorf("writeFloats(%v, %s) returned unexpected err. got: %v, want: %v", tc.value, tc.vr, err, tc.expectedErr) } if diff := cmp.Diff(tc.expectedData, buf.Bytes()); diff != "" { - t.Errorf("writeFloats(%v, %s) wrote unexpected data. diff: %s", tc.value, tc.vr, diff) + t.Errorf("writeFloats(%v, %s) wrote unexpected int16Data. diff: %s", tc.value, tc.vr, diff) t.Errorf("% x", buf.Bytes()) } }) @@ -722,7 +722,7 @@ func TestWriteOtherWord(t *testing.T) { t.Errorf("writeBytes(%v, %s) returned unexpected err. got: %v, want: %v", tc.value, tc.vr, err, tc.expectedErr) } if diff := cmp.Diff(tc.expectedData, buf.Bytes()); diff != "" { - t.Errorf("writeBytes(%v, %s) wrote unexpected data. diff: %s", tc.value, tc.vr, diff) + t.Errorf("writeBytes(%v, %s) wrote unexpected int16Data. diff: %s", tc.value, tc.vr, diff) t.Errorf("% x", buf.Bytes()) } })