All files / platform/core/src/utils areAllImageOrientationsEqual.ts

81.81% Statements 9/11
0% Branches 0/2
100% Functions 1/1
80% Lines 8/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26                  321x     321x 321x   321x 29419x 29419x   29419x       321x    
import toNumber from './toNumber';
import { _isSameOrientation } from './isDisplaySetReconstructable';
 
/**
 * Check is the series has frames with different orientations
 * @param {*} instances
 * @returns
 */
export default function areAllImageOrientationsEqual(instances: Array<any>): boolean {
  Iif (!instances?.length) {
    return false;
  }
  const firstImage = instances[0];
  const firstImageOrientationPatient = toNumber(firstImage.ImageOrientationPatient);
 
  for (let i = 1; i < instances.length; i++) {
    const instance = instances[i];
    const imageOrientationPatient = toNumber(instance.ImageOrientationPatient);
 
    Iif (!_isSameOrientation(imageOrientationPatient, firstImageOrientationPatient)) {
      return false;
    }
  }
  return true;
}