From 4a184d0be7832edcb4b2477fd82d898beab21b65 Mon Sep 17 00:00:00 2001 From: Alireza Date: Thu, 6 Jul 2023 12:09:34 -0400 Subject: [PATCH] fix(invert): allows volume viewport to invert and sync their invert status (#3514) --- extensions/cornerstone-dicom-sr/package.json | 6 +-- extensions/cornerstone/package.json | 10 ++-- extensions/cornerstone/src/commandsModule.ts | 8 ++-- extensions/cornerstone/src/init.tsx | 6 +-- .../SyncGroupService/SyncGroupService.ts | 4 +- .../src/types/CornerstoneServices.ts | 10 ++-- extensions/measurement-tracking/package.json | 4 +- package.json | 1 - platform/app/package.json | 2 +- platform/core/package.json | 2 +- platform/core/src/types/Services.ts | 24 +++++----- yarn.lock | 46 +++++++++---------- 12 files changed, 59 insertions(+), 64 deletions(-) diff --git a/extensions/cornerstone-dicom-sr/package.json b/extensions/cornerstone-dicom-sr/package.json index 725f6dc38ae..f50a428504f 100644 --- a/extensions/cornerstone-dicom-sr/package.json +++ b/extensions/cornerstone-dicom-sr/package.json @@ -44,9 +44,9 @@ }, "dependencies": { "@babel/runtime": "^7.20.13", - "@cornerstonejs/adapters": "^1.2.8", - "@cornerstonejs/core": "^1.2.8", - "@cornerstonejs/tools": "^1.2.8", + "@cornerstonejs/adapters": "^1.4.1", + "@cornerstonejs/core": "^1.4.1", + "@cornerstonejs/tools": "^1.4.1", "classnames": "^2.3.2" } } diff --git a/extensions/cornerstone/package.json b/extensions/cornerstone/package.json index f36f6e8c139..b3f850487b2 100644 --- a/extensions/cornerstone/package.json +++ b/extensions/cornerstone/package.json @@ -36,7 +36,7 @@ "@cornerstonejs/codec-libjpeg-turbo-8bit": "^1.2.2", "@cornerstonejs/codec-openjpeg": "^1.2.2", "@cornerstonejs/codec-openjph": "^2.4.2", - "@cornerstonejs/dicom-image-loader": "^1.2.8", + "@cornerstonejs/dicom-image-loader": "^1.4.1", "@ohif/core": "3.7.0-beta.26", "@ohif/ui": "3.7.0-beta.26", "dcmjs": "^0.29.6", @@ -52,10 +52,10 @@ }, "dependencies": { "@babel/runtime": "^7.20.13", - "@cornerstonejs/adapters": "^1.2.8", - "@cornerstonejs/core": "^1.2.8", - "@cornerstonejs/streaming-image-volume-loader": "^1.2.8", - "@cornerstonejs/tools": "^1.2.8", + "@cornerstonejs/adapters": "^1.4.1", + "@cornerstonejs/core": "^1.4.1", + "@cornerstonejs/streaming-image-volume-loader": "^1.4.1", + "@cornerstonejs/tools": "^1.4.1", "@kitware/vtk.js": "27.3.1", "html2canvas": "^1.4.1", "lodash.debounce": "4.0.8", diff --git a/extensions/cornerstone/src/commandsModule.ts b/extensions/cornerstone/src/commandsModule.ts index ec5b403d84c..b87fbaf605e 100644 --- a/extensions/cornerstone/src/commandsModule.ts +++ b/extensions/cornerstone/src/commandsModule.ts @@ -457,11 +457,9 @@ function commandsModule({ const { viewport } = enabledElement; - if (viewport instanceof StackViewport) { - const { invert } = viewport.getProperties(); - viewport.setProperties({ invert: !invert }); - viewport.render(); - } + const { invert } = viewport.getProperties(); + viewport.setProperties({ invert: !invert }); + viewport.render(); }, resetViewport: () => { const enabledElement = _getActiveViewportEnabledElement(); diff --git a/extensions/cornerstone/src/init.tsx b/extensions/cornerstone/src/init.tsx index 98f905ab900..bda746947e2 100644 --- a/extensions/cornerstone/src/init.tsx +++ b/extensions/cornerstone/src/init.tsx @@ -26,6 +26,7 @@ import nthLoader from './utils/nthLoader'; import interleaveTopToBottom from './utils/interleaveTopToBottom'; import initContextMenu from './initContextMenu'; import initDoubleClick from './initDoubleClick'; +import { CornerstoneServices } from './types'; // TODO: Cypress tests are currently grabbing this from the window? window.cornerstone = cornerstone; @@ -69,10 +70,7 @@ export default async function init({ const { userAuthenticationService, - measurementService, customizationService, - displaySetService, - uiDialogService, uiModalService, uiNotificationService, cineService, @@ -81,7 +79,7 @@ export default async function init({ toolGroupService, viewportGridService, stateSyncService, - } = servicesManager.services; + } = servicesManager.services as CornerstoneServices; window.services = servicesManager.services; window.extensionManager = extensionManager; diff --git a/extensions/cornerstone/src/services/SyncGroupService/SyncGroupService.ts b/extensions/cornerstone/src/services/SyncGroupService/SyncGroupService.ts index 39e919fc5de..56a760d5fcb 100644 --- a/extensions/cornerstone/src/services/SyncGroupService/SyncGroupService.ts +++ b/extensions/cornerstone/src/services/SyncGroupService/SyncGroupService.ts @@ -15,7 +15,7 @@ const EVENTS = { * sync group declared. */ export type SyncCreator = ( - type: string, + id: string, options?: Record ) => Synchronizer; @@ -83,7 +83,7 @@ export default class SyncGroupService { * @param type is the type of the synchronizer to create * @param creator */ - public setSynchronizer(type: string, creator: SyncCreator): void { + public addSynchronizerType(type: string, creator: SyncCreator): void { this.synchronizerCreators[type.toLowerCase()] = creator; } diff --git a/extensions/cornerstone/src/types/CornerstoneServices.ts b/extensions/cornerstone/src/types/CornerstoneServices.ts index 2f52dc9ff90..b7b791ae6a3 100644 --- a/extensions/cornerstone/src/types/CornerstoneServices.ts +++ b/extensions/cornerstone/src/types/CornerstoneServices.ts @@ -1,9 +1,9 @@ import { Types } from '@ohif/core'; -import ToolGroupService from './services/ToolGroupService'; -import SyncGroupService from './services/SyncGroupService'; -import SegmentationService from './services/SegmentationService'; -import CornerstoneCacheService from './services/CornerstoneCacheService'; -import CornerstoneViewportService from './services/ViewportService/CornerstoneViewportService'; +import ToolGroupService from '../services/ToolGroupService'; +import SyncGroupService from '../services/SyncGroupService'; +import SegmentationService from '../services/SegmentationService'; +import CornerstoneCacheService from '../services/CornerstoneCacheService'; +import CornerstoneViewportService from '../services/ViewportService/CornerstoneViewportService'; interface CornerstoneServices extends Types.Services { cornerstoneViewportService: CornerstoneViewportService; diff --git a/extensions/measurement-tracking/package.json b/extensions/measurement-tracking/package.json index 7763d736c15..07677c7018a 100644 --- a/extensions/measurement-tracking/package.json +++ b/extensions/measurement-tracking/package.json @@ -30,8 +30,8 @@ "start": "yarn run dev" }, "peerDependencies": { - "@cornerstonejs/core": "^1.2.8", - "@cornerstonejs/tools": "^1.2.8", + "@cornerstonejs/core": "^1.4.1", + "@cornerstonejs/tools": "^1.4.1", "@ohif/core": "3.7.0-beta.26", "@ohif/extension-cornerstone-dicom-sr": "3.7.0-beta.26", "@ohif/ui": "3.7.0-beta.26", diff --git a/package.json b/package.json index 009d33bf04c..5e905e074d1 100644 --- a/package.json +++ b/package.json @@ -149,7 +149,6 @@ ] }, "resolutions": { - "@cornerstonejs/core": "^1.2.8", "**/@babel/runtime": "^7.20.13", "commander": "8.3.0", "nth-check": "^2.1.1", diff --git a/platform/app/package.json b/platform/app/package.json index 8783d977e60..38d41c73dc8 100644 --- a/platform/app/package.json +++ b/platform/app/package.json @@ -51,7 +51,7 @@ "@cornerstonejs/codec-libjpeg-turbo-8bit": "^1.2.2", "@cornerstonejs/codec-openjpeg": "^1.2.2", "@cornerstonejs/codec-openjph": "^2.4.2", - "@cornerstonejs/dicom-image-loader": "^1.2.8", + "@cornerstonejs/dicom-image-loader": "^1.4.1", "@ohif/core": "3.7.0-beta.26", "@ohif/extension-cornerstone": "3.7.0-beta.26", "@ohif/extension-cornerstone-dicom-rt": "3.7.0-beta.26", diff --git a/platform/core/package.json b/platform/core/package.json index efeca09bc4a..fdfe16cf713 100644 --- a/platform/core/package.json +++ b/platform/core/package.json @@ -35,7 +35,7 @@ "@cornerstonejs/codec-libjpeg-turbo-8bit": "^1.2.2", "@cornerstonejs/codec-openjpeg": "^1.2.2", "@cornerstonejs/codec-openjph": "^2.4.2", - "@cornerstonejs/dicom-image-loader": "^1.2.8", + "@cornerstonejs/dicom-image-loader": "^1.4.1", "@ohif/ui": "3.7.0-beta.26", "cornerstone-math": "0.1.9", "dicom-parser": "^1.8.21" diff --git a/platform/core/src/types/Services.ts b/platform/core/src/types/Services.ts index abc6b09beaf..ece05c32a95 100644 --- a/platform/core/src/types/Services.ts +++ b/platform/core/src/types/Services.ts @@ -14,23 +14,23 @@ import { * The interface for the services object */ export default interface Services { - userAuthenticationService?: Record; hangingProtocolService?: HangingProtocolService; customizationService?: CustomizationService; measurementService?: MeasurementService; displaySetService?: DisplaySetService; - cineService?: Record; toolbarService?: ToolbarService; - cornerstoneViewportService?: Record; - uiDialogService?: Record; - toolGroupService?: Record; - uiNotificationService?: UINotificationService; - uiModalService?: UIModalService; - uiViewportDialogService?: Record; viewportGridService?: ViewportGridService; - syncGroupService?: Record; - cornerstoneCacheService?: Record; - segmentationService?: Record; + uiModalService?: UIModalService; + uiNotificationService?: UINotificationService; stateSyncService?: StateSyncService; - panelService?: Record; + cineService?: unknown; + userAuthenticationService?: unknown; + cornerstoneViewportService?: unknown; + uiDialogService?: unknown; + toolGroupService?: unknown; + uiViewportDialogService?: unknown; + syncGroupService?: unknown; + cornerstoneCacheService?: unknown; + segmentationService?: unknown; + panelService?: unknown; } diff --git a/yarn.lock b/yarn.lock index badafe94231..1724c732db9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1589,10 +1589,10 @@ resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ== -"@cornerstonejs/adapters@^1.2.8": - version "1.2.8" - resolved "https://registry.yarnpkg.com/@cornerstonejs/adapters/-/adapters-1.2.8.tgz#26e584971b917dd099a73511abde32f236655915" - integrity sha512-W1PD+XJ69nUEM5D1wZMyJxRNsKTxWSwtJ6gZ1LH19f7uLSIt1OdKq3PoUZ0KyUiDeP585+NPChquGO14vn8eQA== +"@cornerstonejs/adapters@^1.4.1": + version "1.4.1" + resolved "https://registry.yarnpkg.com/@cornerstonejs/adapters/-/adapters-1.4.1.tgz#48ca911cb76c2c6dfaab3c7c1119bf0fb400bb71" + integrity sha512-w/5c8/m7GKTGFw33vJh5IK3aJNOq9gBeQu0BSAczCBh6DfVY4JWw+ZNUZk2qRYsIcs5rIWSY0/Ykwsq3ziAblA== dependencies: "@babel/runtime-corejs2" "^7.17.8" dcmjs "^0.29.5" @@ -1640,43 +1640,43 @@ resolved "https://registry.yarnpkg.com/@cornerstonejs/codec-openjph/-/codec-openjph-2.4.2.tgz#e96721d56f6ec96f7f95c16321d88cc8467d8d81" integrity sha512-lgdvBvvNezleY+4pIe2ceUsJzlZe/0PipdeubQ3vZZOz3xxtHHMR1XFCl4fgd8gosR8COHuD7h6q+MwgrwBsng== -"@cornerstonejs/core@^1.2.8": - version "1.2.8" - resolved "https://registry.yarnpkg.com/@cornerstonejs/core/-/core-1.2.8.tgz#e84ecf74cba66085f342a03965f3d73111bb4948" - integrity sha512-7RPIxXiMt9Ud5PWZ3+fVYJRhCzObbb4emaQvQ3dPo30xLyU7EcNDEyLjIezJfJHAMOHKQo9SnsoUQz+8YmdXSQ== +"@cornerstonejs/core@^1.4.1": + version "1.4.1" + resolved "https://registry.yarnpkg.com/@cornerstonejs/core/-/core-1.4.1.tgz#e7a2de14160545382771a8dbaf64935f9c654904" + integrity sha512-0pDTy4QZdaXISfs1SW04XitUmv5rn874P0M4XiEwNvP05AEr/Ib6yV95yvQD+xaq35JyEjDS0xCSEL4w9W7TmQ== dependencies: "@kitware/vtk.js" "27.3.1" detect-gpu "^5.0.22" gl-matrix "^3.4.3" lodash.clonedeep "4.5.0" -"@cornerstonejs/dicom-image-loader@^1.2.8": - version "1.2.8" - resolved "https://registry.yarnpkg.com/@cornerstonejs/dicom-image-loader/-/dicom-image-loader-1.2.8.tgz#61cd310310f1cd8d0837135240928e18f5d63c0f" - integrity sha512-w/JrforcHUvVPXEmxT015cGb/IT+py2rTKXk5udqyX/dLoI1q8FaqHFq8z/pN+9AXsUrdQ2d7gmXTpDihS8b4Q== +"@cornerstonejs/dicom-image-loader@^1.4.1": + version "1.4.1" + resolved "https://registry.yarnpkg.com/@cornerstonejs/dicom-image-loader/-/dicom-image-loader-1.4.1.tgz#41ba4531e87827b83684e9de939ef5025eb53db2" + integrity sha512-J47sWG8iEISc+mSsn8iw4Fi1GL4mGuHUD+UegcGl7SgTVA6xmtEoVJJJ7lcfmPxsLJfzRv3x3Okc25GdugE8Bw== dependencies: "@cornerstonejs/codec-charls" "^1.2.3" "@cornerstonejs/codec-libjpeg-turbo-8bit" "^1.2.2" "@cornerstonejs/codec-openjpeg" "^1.2.2" "@cornerstonejs/codec-openjph" "^2.4.2" - "@cornerstonejs/core" "^1.2.8" + "@cornerstonejs/core" "^1.4.1" dicom-parser "^1.8.9" pako "^2.0.4" uuid "^9.0.0" -"@cornerstonejs/streaming-image-volume-loader@^1.2.8": - version "1.2.8" - resolved "https://registry.yarnpkg.com/@cornerstonejs/streaming-image-volume-loader/-/streaming-image-volume-loader-1.2.8.tgz#fcbc6de46c45968e7806f8e322f0605cac4a4b85" - integrity sha512-/FWbWglSNIKgV0ZUDQrkCQkg+Dzf85ReH+svqg8sBhCiCKSdKSAQXEaDG471O+nmVdNg7VW8DE8PwA/yVe/3yA== +"@cornerstonejs/streaming-image-volume-loader@^1.4.1": + version "1.4.1" + resolved "https://registry.yarnpkg.com/@cornerstonejs/streaming-image-volume-loader/-/streaming-image-volume-loader-1.4.1.tgz#7377add2ee2567793dadc4cce74012b95a201eed" + integrity sha512-dwW1IrunYoSo+UM55zpY+KIcC573YOKgCJrcy/AL6kwIJnuglmFMSzeJLM+xxdprbod2QP3LMWwpz0ikfGy67w== dependencies: - "@cornerstonejs/core" "^1.2.8" + "@cornerstonejs/core" "^1.4.1" -"@cornerstonejs/tools@^1.2.8": - version "1.2.8" - resolved "https://registry.yarnpkg.com/@cornerstonejs/tools/-/tools-1.2.8.tgz#8979a40cf53a4a2a648ef8c0fc24ef15603a0f9a" - integrity sha512-E3+UOgl/DRNvvxTJziMoEa6uudKSGr/JFL5k9HvjU2HtGm4kdpYNo9lGnsTqeuUZ2xrPnUZFLYHVwF1WVegoEw== +"@cornerstonejs/tools@^1.4.1": + version "1.4.1" + resolved "https://registry.yarnpkg.com/@cornerstonejs/tools/-/tools-1.4.1.tgz#2ea8ab701ecf93ed9d02dcd5b95ea810bcfa98a8" + integrity sha512-UfwWzmJT3aKu2gvlWQZ3ZLmof8krRYyk0L/HTsTglS2izzbjIPuMAPfh5+FrTIhLE1RQmGwujCp7UZRIEa9s/w== dependencies: - "@cornerstonejs/core" "^1.2.8" + "@cornerstonejs/core" "^1.4.1" lodash.clonedeep "4.5.0" lodash.get "^4.4.2"