Fix issues with isDisplaySetReconstructable when we have empty DICOM tags (closes #1280) (#1426)

This commit is contained in:
Erik Ziegler authored and GitHub committed 2020-02-07 17:09:37 +01:00
1 parent a4c9a86772
commit a6b92a4505
3 files changed
+17 -3

No files matched your search

@@ -46,7 +46,7 @@ export default class RetrieveMetadataLoader {
}
if (loaders.next().done && !result) {
throw 'cant find data';
throw new Error('RetrieveMetadataLoader failed');
}
return result;
@@ -67,6 +67,12 @@ function processSingleframe(instances) {
if (instances.length > 2) {
const firstIpp = _getImagePositionPatient(firstImage);
const lastIpp = _getImagePositionPatient(instances[instances.length - 1]);
// We can't reconstruct if we are missing imagePositionPatient values
if (!firstIpp || !lastIpp) {
return { value: false };
}
const averageSpacingBetweenFrames =
_getPerpendicularDistance(firstIpp, lastIpp) / (instances.length - 1);
@@ -136,8 +142,13 @@ function _getSpacingIssue(spacing, averageSpacing) {
}
function _getImagePositionPatient(instance) {
return instance
.getTagValue('x00200032')
const tagValue = instance
.getTagValue('x00200032');
if (!tagValue) {
return;
}
return tagValue
.split('\\')
.map(element => Number(element));
}