fix: issue introduced from PR 5022 (#5223)

Co-authored-by: Bill Wallace <wayfarer3130@gmail.com>
This commit is contained in:
arul-trenserandBill Wallace authored and GitHub committed 2025-07-23 15:05:42 -04:00
1 parent 78597aacac
commit 428b6ffbe7
7 files changed
+34 -25

No files matched your search

@@ -18,32 +18,32 @@ describe('OHIF Cornerstone Hotkeys', () => {
it('checks if hotkeys "R" and "L" can rotate the image', () => {
cy.get('body').type('R');
cy.get('@viewportInfoMidLeft').should('contains.text', 'F');
cy.get('@viewportInfoMidTop').should('contains.text', 'A');
cy.get('@viewportInfoMidLeft').should('contains.text', 'P');
cy.get('@viewportInfoMidTop').should('contains.text', 'R');
// Hotkey L
cy.get('body').type('L');
cy.get('@viewportInfoMidLeft').should('contains.text', 'A');
cy.get('@viewportInfoMidTop').should('contains.text', 'H');
cy.get('@viewportInfoMidLeft').should('contains.text', 'R');
cy.get('@viewportInfoMidTop').should('contains.text', 'A');
});
it('checks if hotkeys "ArrowUp" and "ArrowDown" can navigate in the stack', () => {
// Hotkey ArrowDown
cy.get('body').type('{downarrow}');
cy.get('@viewportInfoBottomRight').should('contains.text', 'I:11 (2/26)');
cy.get('@viewportInfoBottomRight').should('contains.text', 'I:2 (2/26)');
// Hotkey ArrowUp
cy.get('body').type('{uparrow}');
cy.get('@viewportInfoBottomRight').should('contains.text', 'I:10 (1/26)');
cy.get('@viewportInfoBottomRight').should('contains.text', 'I:1 (1/26)');
});
it('checks if hotkeys "V" and "H" can flip the image', () => {
// Hotkey H
cy.get('body').type('h');
cy.get('@viewportInfoMidLeft').should('contains.text', 'P');
cy.get('@viewportInfoMidTop').should('contains.text', 'H');
cy.get('@viewportInfoMidLeft').should('contains.text', 'L');
cy.get('@viewportInfoMidTop').should('contains.text', 'A');
// Hotkey V
cy.get('body').type('v');
cy.get('@viewportInfoMidLeft').should('contains.text', 'P');
cy.get('@viewportInfoMidTop').should('contains.text', 'F');
cy.get('@viewportInfoMidLeft').should('contains.text', 'L');
cy.get('@viewportInfoMidTop').should('contains.text', 'P');
});
// it('checks if hotkeys "+", "-" and "=" can zoom in, out and fit to viewport', () => {
@@ -68,13 +68,13 @@ describe('OHIF Cornerstone Hotkeys', () => {
it('checks if hotkey "SPACEBAR" can reset the image', () => {
// Press multiples hotkeys
cy.get('body').type('v+++i');
cy.get('@viewportInfoMidLeft').should('contains.text', 'A');
cy.get('@viewportInfoMidTop').should('contains.text', 'F');
cy.get('@viewportInfoMidLeft').should('contains.text', 'R');
cy.get('@viewportInfoMidTop').should('contains.text', 'P');
// Hotkey SPACEBAR
cy.get('body').type(' ');
cy.get('@viewportInfoMidLeft').should('contains.text', 'A');
cy.get('@viewportInfoMidTop').should('contains.text', 'H');
cy.get('@viewportInfoMidLeft').should('contains.text', 'R');
cy.get('@viewportInfoMidTop').should('contains.text', 'A');
});
/*
@@ -85,7 +85,7 @@ describe('OHIF Cornerstone Toolbar', () => {
// The exact text is slightly dependent on the viewport resolution, so leave a range
cy.get('@viewportInfoBottomLeft').should($txt => {
const text = $txt.text();
expect(text).to.include('L:288');
expect(text).to.include('L:479');
});
});
@@ -143,7 +143,7 @@ describe('OHIF Cornerstone Toolbar', () => {
//Click on reset button
cy.resetViewport();
const expectedText = 'W:576L:288';
const expectedText = 'W:958L:479';
cy.get('@viewportInfoBottomLeft').should('have.text', expectedText);
});
@@ -412,8 +412,8 @@ describe('OHIF Cornerstone Toolbar', () => {
});
*/
it('check if Flip tool will flip the image in the viewport', () => {
cy.get('@viewportInfoMidLeft').should('contains.text', 'A');
cy.get('@viewportInfoMidTop').should('contains.text', 'H');
cy.get('@viewportInfoMidLeft').should('contains.text', 'R');
cy.get('@viewportInfoMidTop').should('contains.text', 'A');
//Click on More button
cy.get('@moreBtnSecondary').click();
@@ -421,8 +421,8 @@ describe('OHIF Cornerstone Toolbar', () => {
//Click on Flip button
cy.get('[data-cy="flipHorizontal"]').click();
cy.waitDicomImage();
cy.get('@viewportInfoMidLeft').should('contains.text', 'P');
cy.get('@viewportInfoMidTop').should('contains.text', 'H');
cy.get('@viewportInfoMidLeft').should('contains.text', 'L');
cy.get('@viewportInfoMidTop').should('contains.text', 'A');
});
// it('checks if stack sync is preserved on new display set and uses FOR', () => {
+1 -1
View File
@@ -103,7 +103,7 @@ class ImageSet {
return this.images.sort(combinedSortFunctions[userSpecifiedCriteria]);
}
// If image position patient is not available, sort by InstanceNumber
if (!isValidForPositionSort(this.images)) {
if (!this.isReconstructable || !isValidForPositionSort(this.images)) {
return this.images.sort(instancesSortCriteria.sortByInstanceNumber);
}
// Do image position patient sorting as default sort
@@ -0,0 +1,25 @@
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 {
if (!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);
if (!_isSameOrientation(imageOrientationPatient, firstImageOrientationPatient)) {
return false;
}
}
return true;
}
+2
View File
@@ -44,6 +44,7 @@ import { sopClassDictionary } from './sopClassDictionary';
import * as MeasurementFilters from './measurementFilters';
import getClosestOrientationFromIOP from './getClosestOrientationFromIOP';
import calculateScanAxisNormal from './calculateScanAxisNormal';
import areAllImageOrientationsEqual from './areAllImageOrientationsEqual';
// Commented out unused functionality.
// Need to implement new mechanism for derived displaySets using the displaySetManager.
@@ -93,6 +94,7 @@ const utils = {
MeasurementFilters,
getClosestOrientationFromIOP,
calculateScanAxisNormal,
areAllImageOrientationsEqual,
};
export {
+6
View File
@@ -1,6 +1,7 @@
import { vec3 } from 'gl-matrix';
import isLowPriorityModality from './isLowPriorityModality';
import calculateScanAxisNormal from './calculateScanAxisNormal';
import areAllImageOrientationsEqual from './areAllImageOrientationsEqual';
const compareSeriesDateTime = (a, b) => {
const seriesDateA = Date.parse(`${a.seriesDate ?? a.SeriesDate} ${a.seriesTime ?? a.SeriesTime}`);
@@ -145,6 +146,11 @@ function isValidForPositionSort(images): boolean {
if (!referenceImagePositionPatient || !imageOrientationPatient) {
return false;
}
if (!areAllImageOrientationsEqual(images)) {
return false;
}
return true;
}