From 74e62a176374f720080d4e777972f70e7f2d8b2b Mon Sep 17 00:00:00 2001 From: Ibrahim <93064150+IbrahimCSAE@users.noreply.github.com> Date: Tue, 12 Sep 2023 10:30:02 -0400 Subject: [PATCH] fix(health imaging): studies not loading from healthimaging if imagepositionpatient is missing (#3646) --- .../src/utils/validations/areAllImagePositionsEqual.ts | 3 +++ .../src/utils/validations/areAllImageSpacingEqual.ts | 3 +++ platform/app/src/routes/Mode/Mode.tsx | 9 ++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/extensions/default/src/utils/validations/areAllImagePositionsEqual.ts b/extensions/default/src/utils/validations/areAllImagePositionsEqual.ts index 708986a0876..723aa7877ec 100644 --- a/extensions/default/src/utils/validations/areAllImagePositionsEqual.ts +++ b/extensions/default/src/utils/validations/areAllImagePositionsEqual.ts @@ -38,6 +38,9 @@ export default function areAllImagePositionsEqual(instances: Array): boolea return false; } const firstImageOrientationPatient = toNumber(instances[0].ImageOrientationPatient); + if (!firstImageOrientationPatient) { + return false; + } const scanAxisNormal = calculateScanAxisNormal(firstImageOrientationPatient); const firstImagePositionPatient = toNumber(instances[0].ImagePositionPatient); const lastIpp = toNumber(instances[instances.length - 1].ImagePositionPatient); diff --git a/extensions/default/src/utils/validations/areAllImageSpacingEqual.ts b/extensions/default/src/utils/validations/areAllImageSpacingEqual.ts index ae95722c737..49906c3c22d 100644 --- a/extensions/default/src/utils/validations/areAllImageSpacingEqual.ts +++ b/extensions/default/src/utils/validations/areAllImageSpacingEqual.ts @@ -20,6 +20,9 @@ export default function areAllImageSpacingEqual( return; } const firstImagePositionPatient = toNumber(instances[0].ImagePositionPatient); + if (!firstImagePositionPatient) { + return; + } const lastIpp = toNumber(instances[instances.length - 1].ImagePositionPatient); const averageSpacingBetweenFrames = diff --git a/platform/app/src/routes/Mode/Mode.tsx b/platform/app/src/routes/Mode/Mode.tsx index b43d68f0fd0..1e9019e2369 100644 --- a/platform/app/src/routes/Mode/Mode.tsx +++ b/platform/app/src/routes/Mode/Mode.tsx @@ -67,6 +67,13 @@ function defaultRouteInit( }) ); + // log the error if this fails, otherwise it's so difficult to tell what went wrong... + allRetrieves.forEach(retrieve => { + retrieve.catch(error => { + console.error(error); + }); + }); + // The hanging protocol matching service is fairly expensive to run multiple // times, and doesn't allow partial matches to be made (it will simply fail // to display anything if a required match fails), so we wait here until all metadata @@ -436,7 +443,7 @@ export default function ModeRoute({