fix: issue introduced from PR 5022 (#5223)

Co-authored-by: Bill Wallace <wayfarer3130@gmail.com>
This commit is contained in:
arul-trenser 2025-07-24 00:35:42 +05:30 committed by GitHub
parent 78597aacac
commit 428b6ffbe7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 34 additions and 25 deletions

View File

@ -1,9 +1,10 @@
import areAllImageDimensionsEqual from './areAllImageDimensionsEqual';
import areAllImageComponentsEqual from './areAllImageComponentsEqual';
import areAllImageOrientationsEqual from './areAllImageOrientationsEqual';
import areAllImagePositionsEqual from './areAllImagePositionsEqual';
import areAllImageSpacingEqual from './areAllImageSpacingEqual';
import { DisplaySetMessage, DisplaySetMessageList } from '@ohif/core';
import { DisplaySetMessage, DisplaySetMessageList, utils } from '@ohif/core';
const { areAllImageOrientationsEqual } = utils;
/**
* Runs various checks in a single frame series

View File

@ -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');
});
/*

View File

@ -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', () => {

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

View File

@ -1,5 +1,5 @@
import toNumber from '@ohif/core/src/utils/toNumber';
import { _isSameOrientation } from '@ohif/core/src/utils/isDisplaySetReconstructable';
import toNumber from './toNumber';
import { _isSameOrientation } from './isDisplaySetReconstructable';
/**
* Check is the series has frames with different orientations

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 {

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;
}