Skip to content

Commit 654118c

Browse files
committed
minor code changes
1 parent 98f4851 commit 654118c

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

platform/app/src/components/ViewportGrid.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ function ViewerViewportGrid(props: withAppTypes) {
178178
const { displaySetInstanceUID: referencedDisplaySetInstanceUID } = measurement;
179179

180180
const updatedViewports = _getUpdatedViewports(viewportId, referencedDisplaySetInstanceUID);
181-
let viewportToUpdate = updatedViewports[0];
181+
let viewportToUpdate;
182182
if (updatedViewports.length > 1) {
183183
// To get the viewport which orientation is closest to IOP
184184
const closestOrientation = getClosestOrientationFromIOP(
@@ -189,7 +189,8 @@ function ViewerViewportGrid(props: withAppTypes) {
189189
viewport => viewport.viewportOptions?.orientation == closestOrientation
190190
);
191191
}
192-
192+
// If closest orientation viewport is not find then choose 0
193+
viewportToUpdate = updatedViewports[0];
193194
if (!viewportToUpdate) {
194195
console.warn(
195196
'ViewportGrid::Unable to navigate to viewport containing',

platform/app/src/utils/getClosestOrientationFromIOP.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@ import OrientationAxis = Enums.OrientationAxis;
55
/**
66
* Get the plane (orientation) to which the ImageOrientationPatient is most closely aligned
77
*
8-
* @param {Array} imageOrientationPatient - ImageOrientationPatient vector for the image
9-
* @returns
8+
* @param displaySetService
9+
* @param displaySetInstanceUID
10+
* @returns orientation
1011
*/
1112
export default function getClosestOrientationFromIOP(
1213
displaySetService,
1314
displaySetInstanceUID
1415
): OrientationAxis {
1516
const displaySet = displaySetService.getDisplaySetByUID(displaySetInstanceUID);
1617
const imageOrientationPatient = displaySet.instances[0].ImageOrientationPatient as Array<number>;
18+
// ImageOrientationPatient must be an array of length 6.
1719
if (imageOrientationPatient?.length !== 6) {
18-
throw new Error('ImageOrientationPatient must be an array of length 6.');
20+
return;
1921
}
2022

2123
// Take cross product to get vector coming "out" of image plane

0 commit comments

Comments
 (0)