2023-08-11 19:16:25 -03:00
|
|
|
import toNumber from '@ohif/core/src/utils/toNumber';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check if the frames in a series has different dimensions
|
|
|
|
|
* @param {*} instances
|
|
|
|
|
* @returns
|
|
|
|
|
*/
|
2023-09-01 16:19:39 -04:00
|
|
|
export default function areAllImageDimensionsEqual(instances: Array<any>): boolean {
|
2023-08-11 19:16:25 -03:00
|
|
|
if (!instances?.length) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
const firstImage = instances[0];
|
|
|
|
|
const firstImageRows = toNumber(firstImage.Rows);
|
|
|
|
|
const firstImageColumns = toNumber(firstImage.Columns);
|
|
|
|
|
|
|
|
|
|
for (let i = 1; i < instances.length; i++) {
|
|
|
|
|
const instance = instances[i];
|
|
|
|
|
const { Rows, Columns } = instance;
|
|
|
|
|
|
2025-01-08 14:13:28 -05:00
|
|
|
if (toNumber(Rows) !== firstImageRows || toNumber(Columns) !== firstImageColumns) {
|
2023-08-11 19:16:25 -03:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|