diff --git a/extensions/default/src/utils/validations/checkSingleFrames.ts b/extensions/default/src/utils/validations/checkSingleFrames.ts index 677d66f84..ced5facf0 100644 --- a/extensions/default/src/utils/validations/checkSingleFrames.ts +++ b/extensions/default/src/utils/validations/checkSingleFrames.ts @@ -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 diff --git a/platform/app/cypress/integration/measurement-tracking/OHIFCornerstoneHotkeys.spec.js b/platform/app/cypress/integration/measurement-tracking/OHIFCornerstoneHotkeys.spec.js index b79ad2c93..b0d2f0bd7 100644 --- a/platform/app/cypress/integration/measurement-tracking/OHIFCornerstoneHotkeys.spec.js +++ b/platform/app/cypress/integration/measurement-tracking/OHIFCornerstoneHotkeys.spec.js @@ -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'); }); /* diff --git a/platform/app/cypress/integration/measurement-tracking/OHIFCornerstoneToolbar.spec.js b/platform/app/cypress/integration/measurement-tracking/OHIFCornerstoneToolbar.spec.js index 196ce724a..3af31119e 100644 --- a/platform/app/cypress/integration/measurement-tracking/OHIFCornerstoneToolbar.spec.js +++ b/platform/app/cypress/integration/measurement-tracking/OHIFCornerstoneToolbar.spec.js @@ -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', () => { diff --git a/platform/core/src/classes/ImageSet.ts b/platform/core/src/classes/ImageSet.ts index 19b110942..9fc3abb4d 100644 --- a/platform/core/src/classes/ImageSet.ts +++ b/platform/core/src/classes/ImageSet.ts @@ -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 diff --git a/extensions/default/src/utils/validations/areAllImageOrientationsEqual.ts b/platform/core/src/utils/areAllImageOrientationsEqual.ts similarity index 82% rename from extensions/default/src/utils/validations/areAllImageOrientationsEqual.ts rename to platform/core/src/utils/areAllImageOrientationsEqual.ts index 310bd8448..794cb6d8e 100644 --- a/extensions/default/src/utils/validations/areAllImageOrientationsEqual.ts +++ b/platform/core/src/utils/areAllImageOrientationsEqual.ts @@ -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 diff --git a/platform/core/src/utils/index.ts b/platform/core/src/utils/index.ts index 8cf54c53a..0955686ca 100644 --- a/platform/core/src/utils/index.ts +++ b/platform/core/src/utils/index.ts @@ -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 { diff --git a/platform/core/src/utils/sortStudy.ts b/platform/core/src/utils/sortStudy.ts index 80a4c41c6..404a4853d 100644 --- a/platform/core/src/utils/sortStudy.ts +++ b/platform/core/src/utils/sortStudy.ts @@ -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; }