Skip to content

Commit

Permalink
Add unit test based on external file with OD
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Berry committed Aug 12, 2024
1 parent c78d045 commit 0d97410
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Binary file added test/OD-single-word-example.dcm
Binary file not shown.
16 changes: 16 additions & 0 deletions test/data.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1154,3 +1154,19 @@ it.each([
expect(value).toBe(expected);
}
);

describe('test OtherDouble ValueRepresentation', () => {
test('Treat OD as explicit VR with correct length', () => {
const file = fs.readFileSync(`test/OD-single-word-example.dcm`);
const data = dcmjs.data.DicomMessage.readFile(new Uint8Array(file).buffer);

// expect OD VR data element (VolumetricCurveUpDirections) to be read with expected value
expect(data.dict['00701A07']).toBeTruthy();
const odBuffer = data.dict['00701A07'].Value[0]
expect(new Uint8Array(odBuffer)).toEqual(new Uint8Array([0, 0, 0, 0, 0, 0, 0, 64]))

// expect arbitrary tag (BlendingInputNumber, US VR) after OD VR to be read without issue
expect(data.dict['00701B02']).toBeTruthy();
expect(data.dict['00701B02'].Value[0]).toBe(1);
})
});

0 comments on commit 0d97410

Please sign in to comment.