Skip to content

Commit be5e235

Browse files
author
hackermd
committed
Work around single-frame image case
1 parent 732105e commit be5e235

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/metadata.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ function formatImageMetadata(metadata) {
2222
const sharedFunctionalGroupsSequence = metadata['52009229']['Value'][0];
2323
const pixelMeasuresSequence = sharedFunctionalGroupsSequence['00289110']['Value'][0];
2424
const pixelSpacing = pixelMeasuresSequence['00280030']['Value'];
25-
const numberOfFrames = Number(metadata['00280008']['Value'][0]);
25+
let numberOfFrames = 1;
26+
if ('00280008' in metadata) {
27+
numberOfFrames = Number(metadata['00280008']['Value'][0]);
28+
}
2629

2730
/*
2831
* The values "TILED_SPARSE" and "TILED_FULL" were introduced in the 2018

0 commit comments

Comments
 (0)