Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Other double as explicit value representation #399

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ValueRepresentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function toWindows(inputArray, size) {
let DicomMessage, Tag;

var binaryVRs = ["FL", "FD", "SL", "SS", "UL", "US", "AT"],
explicitVRs = ["OB", "OW", "OF", "SQ", "UC", "UR", "UT", "UN"],
explicitVRs = ["OB", "OW", "OF", "SQ", "UC", "UR", "UT", "UN", "OD"],
singleVRs = ["SQ", "OF", "OW", "OB", "UN"];

class ValueRepresentation {
Expand Down
22 changes: 22 additions & 0 deletions test/data.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1154,3 +1154,25 @@ it.each([
expect(value).toBe(expected);
}
);

describe('test OtherDouble ValueRepresentation', () => {
it('Treat OD as explicit VR with correct length', async () => {
const url =
"https://github.com/dcmjs-org/data/releases/download/od-encoding-data/OD-single-word-example.dcm";
const dcmPath = await getTestDataset(
url,
"OD-single-word-example"
);
const file = fs.readFileSync(dcmPath);
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);
})
});