Commit 654118c 1 parent 98f4851 commit 654118c Copy full SHA for 654118c
File tree 2 files changed +8
-5
lines changed
2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -178,7 +178,7 @@ function ViewerViewportGrid(props: withAppTypes) {
178
178
const { displaySetInstanceUID : referencedDisplaySetInstanceUID } = measurement ;
179
179
180
180
const updatedViewports = _getUpdatedViewports ( viewportId , referencedDisplaySetInstanceUID ) ;
181
- let viewportToUpdate = updatedViewports [ 0 ] ;
181
+ let viewportToUpdate ;
182
182
if ( updatedViewports . length > 1 ) {
183
183
// To get the viewport which orientation is closest to IOP
184
184
const closestOrientation = getClosestOrientationFromIOP (
@@ -189,7 +189,8 @@ function ViewerViewportGrid(props: withAppTypes) {
189
189
viewport => viewport . viewportOptions ?. orientation == closestOrientation
190
190
) ;
191
191
}
192
-
192
+ // If closest orientation viewport is not find then choose 0
193
+ viewportToUpdate = updatedViewports [ 0 ] ;
193
194
if ( ! viewportToUpdate ) {
194
195
console . warn (
195
196
'ViewportGrid::Unable to navigate to viewport containing' ,
Original file line number Diff line number Diff line change @@ -5,17 +5,19 @@ import OrientationAxis = Enums.OrientationAxis;
5
5
/**
6
6
* Get the plane (orientation) to which the ImageOrientationPatient is most closely aligned
7
7
*
8
- * @param {Array } imageOrientationPatient - ImageOrientationPatient vector for the image
9
- * @returns
8
+ * @param displaySetService
9
+ * @param displaySetInstanceUID
10
+ * @returns orientation
10
11
*/
11
12
export default function getClosestOrientationFromIOP (
12
13
displaySetService ,
13
14
displaySetInstanceUID
14
15
) : OrientationAxis {
15
16
const displaySet = displaySetService . getDisplaySetByUID ( displaySetInstanceUID ) ;
16
17
const imageOrientationPatient = displaySet . instances [ 0 ] . ImageOrientationPatient as Array < number > ;
18
+ // ImageOrientationPatient must be an array of length 6.
17
19
if ( imageOrientationPatient ?. length !== 6 ) {
18
- throw new Error ( 'ImageOrientationPatient must be an array of length 6.' ) ;
20
+ return ;
19
21
}
20
22
21
23
// Take cross product to get vector coming "out" of image plane
You can’t perform that action at this time.
0 commit comments