Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/v3-stable' into feat/double-cl…
Browse files Browse the repository at this point in the history
…ick-to-toggle-one-up
  • Loading branch information
jbocce committed Mar 29, 2023
2 parents 6f94c7f + 4734b3b commit f98eb20
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 68 deletions.
6 changes: 3 additions & 3 deletions extensions/cornerstone-dicom-sr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
"dependencies": {
"@babel/runtime": "^7.20.13",
"classnames": "^2.3.2",
"@cornerstonejs/adapters": "^0.4.1",
"@cornerstonejs/core": "^0.37.0",
"@cornerstonejs/tools": "^0.57.1"
"@cornerstonejs/adapters": "^0.6.0",
"@cornerstonejs/core": "^0.38.0",
"@cornerstonejs/tools": "^0.58.0"
}
}
8 changes: 4 additions & 4 deletions extensions/cornerstone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^0.4.1",
"@cornerstonejs/core": "^0.37.0",
"@cornerstonejs/streaming-image-volume-loader": "^0.15.1",
"@cornerstonejs/tools": "^0.57.1",
"@cornerstonejs/adapters": "^0.6.0",
"@cornerstonejs/core": "^0.38.0",
"@cornerstonejs/streaming-image-volume-loader": "^0.15.13",
"@cornerstonejs/tools": "^0.58.0",
"@kitware/vtk.js": "26.5.6",
"html2canvas": "^1.4.1",
"lodash.debounce": "4.0.8",
Expand Down
13 changes: 11 additions & 2 deletions extensions/cornerstone/src/getHangingProtocolModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const mpr: Types.HangingProtocol.Protocol = {
// Unknown number of priors referenced - so just match any study
numberOfPriorsReferenced: 0,
protocolMatchingRules: [],
// imageLoadStrategy: 'nth',
imageLoadStrategy: 'interleaveTopToBottom',
callbacks: {
// Switches out of MPR mode when the layout change button is used
onLayoutChange: [
Expand Down Expand Up @@ -170,7 +170,7 @@ const mprAnd3DVolumeViewport = {
availableTo: {},
editableBy: {},
protocolMatchingRules: [],
imageLoadStrategy: 'interleaveTopToBottom',
imageLoadStrategy: 'interleaveCenter',
displaySetSelectors: {
mprDisplaySet: {
seriesMatchingRules: [
Expand All @@ -184,6 +184,15 @@ const mprAnd3DVolumeViewport = {
},
required: true,
},
{
attribute: 'Modality',
constraint: {
equals: {
value: 'CT',
},
},
required: true,
},
],
},
},
Expand Down
19 changes: 18 additions & 1 deletion extensions/cornerstone/src/init.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,26 @@ export default async function init({
viewportId
);

const ohifViewport = cornerstoneViewportService.getViewportInfo(
viewportId
);

const {
lutPresentationStore,
positionPresentationStore,
} = stateSyncService.getState();
const { presentationIds } = ohifViewport.getViewportOptions();
const presentations = {
positionPresentation:
positionPresentationStore[presentationIds?.positionPresentationId],
lutPresentation:
lutPresentationStore[presentationIds?.lutPresentationId],
};

cornerstoneViewportService.setVolumesForViewport(
viewport,
volumeInputArray
volumeInputArray,
presentations
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,19 +506,16 @@ class CornerstoneViewportService extends PubSubService
!hangingProtocolService.customImageLoadPerformed
) {
// delegate the volume loading to the hanging protocol service if it has a custom image load strategy
if (
hangingProtocolService.runImageLoadStrategy({
viewportId: viewport.id,
volumeInputArray,
})
) {
// Fallback to the default strategy if the custom one fails
return;
}
return hangingProtocolService.runImageLoadStrategy({
viewportId: viewport.id,
volumeInputArray,
});
}

volumeToLoad.forEach(volume => {
volume.load();
if (!volume.loadStatus.loaded && !volume.loadStatus.loading) {
volume.load();
}
});

// This returns the async continuation only
Expand Down
4 changes: 2 additions & 2 deletions extensions/measurement-tracking/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"peerDependencies": {
"@ohif/core": "^3.0.0",
"classnames": "^2.3.2",
"@cornerstonejs/core": "^0.37.0",
"@cornerstonejs/tools": "^0.57.1",
"@cornerstonejs/core": "^0.38.0",
"@cornerstonejs/tools": "^0.58.0",
"@ohif/extension-cornerstone-dicom-sr": "^3.0.0",
"dcmjs": "^0.29.4",
"lodash.debounce": "^4.17.21",
Expand Down
8 changes: 6 additions & 2 deletions modes/basic-test-mode/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ function modeFactory() {
initToolGroups(extensionManager, toolGroupService, commandsManager);

// init customizations
console.log('* Adding mode customizations');
customizationService.addModeCustomizations([
'@ohif/extension-test.customizationModule.custom-context-menu',
]);
Expand Down Expand Up @@ -211,7 +210,12 @@ function modeFactory() {
dicompdf.sopClassHandler,
dicomsr.sopClassHandler,
],
hotkeys: [...hotkeys.defaults.hotkeyBindings],
hotkeys: {
// Don't store the hotkeys for basic-test-mode under the same key
// because they get customized by tests
name: 'basic-test-hotkeys',
hotkeys: [...hotkeys.defaults.hotkeyBindings],
},
};
}

Expand Down
10 changes: 4 additions & 6 deletions platform/core/src/classes/HotkeysManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,17 @@ export class HotkeysManager {
*
* @param {HotkeyDefinition[] | Object} [hotkeyDefinitions=[]] Contains hotkeys definitions
*/
setHotkeys(hotkeyDefinitions = [], key = 'hotkey-definitions') {
setHotkeys(hotkeyDefinitions = [], name = 'hotkey-definitions') {
try {
const definitions = this.getValidDefinitions(hotkeyDefinitions);
if (isequal(definitions, this.hotkeyDefaults)) {
console.log('hotkeys REMOVING unused definition', key);
localStorage.removeItem(key);
localStorage.removeItem(name);
} else {
console.log('hotkeys setting local storage', key);
localStorage.setItem(key, JSON.stringify(definitions));
localStorage.setItem(name, JSON.stringify(definitions));
}
definitions.forEach(definition => this.registerHotkeys(definition));
} catch (error) {
const { uiNotificationService, } = this._servicesManager.services;
const { uiNotificationService } = this._servicesManager.services;
uiNotificationService.show({
title: 'Hotkeys Manager',
message: 'Error while setting hotkeys',
Expand Down
12 changes: 10 additions & 2 deletions platform/docs/docs/platform/modes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,9 @@ handles creation of the displaySets.
### Hotkeys

`hotkeys` is another property in the configuration of a mode that can be defined
to add the specific hotkeys to the viewer at all routes.
to add the specific hotkeys to the viewer on the mode route. Additionally, the
name under which the hotkeys are stored can be configured as `hotkeyName`.
This allows user customization of the mode specific hotkeys.

```js
// default hotkeys
Expand Down Expand Up @@ -347,7 +349,13 @@ function modeFactory() {
/*
...
*/
hotkeys: [..hotkeys.defaults.hotkeyBindings, ...myHotkeys],
hotkeys: {
// The name in preferences to use for this set of hotkeys
// Allows defining different sets for different modes
name: 'custom-hotkey-name',
// And the actual custom values here.
hotkeys:[..hotkeys.defaults.hotkeyBindings, ...myHotkeys]
},
}
}

Expand Down
4 changes: 3 additions & 1 deletion platform/viewer/public/config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ window.config = {
maxNumRequests: {
interaction: 100,
thumbnail: 75,
prefetch: 10,
// Prefetch number is dependent on the http protocol. For http 2 or
// above, the number of requests can be go a lot higher.
prefetch: 25,
},
// filterQueryParam: false,
dataSources: [
Expand Down
18 changes: 12 additions & 6 deletions platform/viewer/src/routes/Mode/Mode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,15 @@ export default function ModeRoute({
hangingProtocolService,
} = (servicesManager as ServicesManager).services;

const { extensions, sopClassHandlers, hotkeys, hangingProtocol } = mode;
const {
extensions,
sopClassHandlers,
hotkeys: hotkeyObj,
hangingProtocol,
} = mode;
// Preserve the old array interface for hotkeys
const hotkeys = Array.isArray(hotkeyObj) ? hotkeyObj : hotkeyObj?.hotkeys;
const hotkeyName = hotkeyObj?.name || 'hotkey-definitions-v2';

if (dataSourceName === undefined) {
dataSourceName = extensionManager.defaultDataSourceName;
Expand Down Expand Up @@ -204,14 +212,12 @@ export default function ModeRoute({

hotkeysManager.setDefaultHotKeys(hotkeys);

const userPreferredHotkeys = JSON.parse(
localStorage.getItem('hotkey-definitions')
);
const userPreferredHotkeys = JSON.parse(localStorage.getItem(hotkeyName));

if (userPreferredHotkeys?.length) {
hotkeysManager.setHotkeys(userPreferredHotkeys);
hotkeysManager.setHotkeys(userPreferredHotkeys, hotkeyName);
} else {
hotkeysManager.setHotkeys(hotkeys);
hotkeysManager.setHotkeys(hotkeys, hotkeyName);
}

return () => {
Expand Down
62 changes: 33 additions & 29 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1407,13 +1407,13 @@
resolved "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9"
integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==

"@cornerstonejs/adapters@^0.4.1":
version "0.4.1"
resolved "https://registry.yarnpkg.com/@cornerstonejs/adapters/-/adapters-0.4.1.tgz#fedab0d9cfea609f5219950c86e546198ad0f3c8"
integrity sha512-DQabSBdTN/A5tsncnDLdsb6LI5I/FTG3gSmNpDAkc9fAZY6Ljj0lCLt9KHB5OA1Gbvrlcab/DGJ/2YW6Z7ifRg==
"@cornerstonejs/adapters@^0.6.0":
version "0.6.0"
resolved "https://registry.npmjs.org/@cornerstonejs/adapters/-/adapters-0.6.0.tgz#9b2efdabb0d596d53ae4854556956b668cca7535"
integrity sha512-bzOwtOX0EfJ/PufPq1mONPU+HmVQf+pA/78+mbHuV8bvznM1IkSzc2h0WYsLXTdVEkZrGwgWCwrOiYGfsNW1tQ==
dependencies:
"@babel/runtime-corejs2" "^7.17.8"
dcmjs "^0.29.4"
dcmjs "^0.29.5"
gl-matrix "^3.4.3"
lodash.clonedeep "^4.5.0"
ndarray "^1.0.19"
Expand Down Expand Up @@ -1443,36 +1443,28 @@
resolved "https://registry.npmjs.org/@cornerstonejs/codec-openjph/-/codec-openjph-2.4.2.tgz#e96721d56f6ec96f7f95c16321d88cc8467d8d81"
integrity sha512-lgdvBvvNezleY+4pIe2ceUsJzlZe/0PipdeubQ3vZZOz3xxtHHMR1XFCl4fgd8gosR8COHuD7h6q+MwgrwBsng==

"@cornerstonejs/core@^0.35.1":
version "0.35.1"
resolved "https://registry.npmjs.org/@cornerstonejs/core/-/core-0.35.1.tgz#fd5e9f878b51807366d9d0c6659ac91b43efed87"
integrity sha512-n6nFo3XVkMKmhNsF20yPznO3jo3MpOl8X+3k/HyHVlZujIsBT/jz0X4dEg/3fzA0aLPdWdZ/kkVw8TBanVKTGA==
dependencies:
detect-gpu "^4.0.45"
lodash.clonedeep "4.5.0"

"@cornerstonejs/core@^0.37.0":
version "0.37.0"
resolved "https://registry.yarnpkg.com/@cornerstonejs/core/-/core-0.37.0.tgz#d0cc59116d5393c995e01f9cb58b7d96acd46fa8"
integrity sha512-EPKUsEFp9X7ZOhDS5EoNpuJDs4KjlCodDTYYU8ITU9pzW9gJj5j3IivJy5mMI2tDq/rpdxCoL0TSn3KVsJvp5Q==
"@cornerstonejs/core@^0.38.0":
version "0.38.0"
resolved "https://registry.npmjs.org/@cornerstonejs/core/-/core-0.38.0.tgz#6ee3341f38f78e98da85d2511ac16f25e9800f18"
integrity sha512-4/+qDEtGQRwV6AN5Ze4S6oOFiNH48oT5Mp/YQEzJHO+Zn9ceRHZ6ReTwccVUJ5QY2d5d89CoWJ2sKhdsLFZsNw==
dependencies:
detect-gpu "^4.0.45"
lodash.clonedeep "4.5.0"

"@cornerstonejs/streaming-image-volume-loader@^0.15.1":
version "0.15.1"
resolved "https://registry.npmjs.org/@cornerstonejs/streaming-image-volume-loader/-/streaming-image-volume-loader-0.15.1.tgz#b9fd0efbebbd232119ef0ae7b63bf8b3498bf539"
integrity sha512-xtBG2RlhjOX/Cd4qGLYGKXjF7oLhRtksmXpPB5nOa1BBBgrGOQHFjNuyh3uhVHg30e5po9oCfomSPHwovhexzw==
"@cornerstonejs/streaming-image-volume-loader@^0.15.13":
version "0.15.13"
resolved "https://registry.npmjs.org/@cornerstonejs/streaming-image-volume-loader/-/streaming-image-volume-loader-0.15.13.tgz#d4c6651f5edac0adbc2c4059b78945fb70c38eb5"
integrity sha512-o0e+vEr08GmMztjabPs7vHKYhofW0dQvSI8Dy7tb1wKEnf05Tis/5s9sCt6PORNHXweK+Cylja3xy8b469ZuVw==
dependencies:
"@cornerstonejs/core" "^0.35.1"
cornerstone-wado-image-loader "^4.10.0"
"@cornerstonejs/core" "^0.38.0"
cornerstone-wado-image-loader "^4.10.2"

"@cornerstonejs/tools@^0.57.1":
version "0.57.1"
resolved "https://registry.yarnpkg.com/@cornerstonejs/tools/-/tools-0.57.1.tgz#687e097e0ee8884b0e65ec4b0e8a7afed3f1a5de"
integrity sha512-CEBVi+LvYs9vDhItgz1q6KUzQRYb7SX0sPMIXNBMl0Ia5iCx3YOvKnX/ryNVXHZsenNdG3356cGjyexFzPkrSw==
"@cornerstonejs/tools@^0.58.0":
version "0.58.0"
resolved "https://registry.npmjs.org/@cornerstonejs/tools/-/tools-0.58.0.tgz#c9a2ba6a96491a565fe03a2ef1c1403bd70992e4"
integrity sha512-sVsX6WGLmHg5UUg7p9iwvwjb8AswUypO2jARyIVtpa3JM3dP16Y0uh1jTWJFG2xWLZgEXDXcFCIhw5nOSohy7A==
dependencies:
"@cornerstonejs/core" "^0.37.0"
"@cornerstonejs/core" "^0.38.0"
lodash.clonedeep "4.5.0"
lodash.get "^4.4.2"

Expand Down Expand Up @@ -8519,7 +8511,7 @@ cornerstone-math@^0.1.9:
resolved "https://registry.npmjs.org/cornerstone-math/-/cornerstone-math-0.1.10.tgz#a3f99db64d73c5adee61ae0d570128eca1682d07"
integrity sha512-23XSAyP7t70ANvhFyqwvva+zFd1bQ2d5GL7tg9qKE932WmImjA2Y9tiy5n0iTtnf51W/78Png8Lia2o4dCdJaQ==

cornerstone-wado-image-loader@^4.10.0, cornerstone-wado-image-loader@^4.10.2:
cornerstone-wado-image-loader@^4.10.2:
version "4.10.2"
resolved "https://registry.yarnpkg.com/cornerstone-wado-image-loader/-/cornerstone-wado-image-loader-4.10.2.tgz#139956654324fd2b01fe5b4900d0f4ed8c52633d"
integrity sha512-qj9dThELqYCm3jAZfg9qnUl8d76gngOl55kYJabY5lh/dFeVIxno/hYxy3ydE7RtG2c/TUGXb+EMUl0CJSqKBQ==
Expand Down Expand Up @@ -9251,6 +9243,18 @@ dcmjs@^0.29.4:
ndarray "^1.0.19"
pako "^2.0.4"

dcmjs@^0.29.5:
version "0.29.5"
resolved "https://registry.npmjs.org/dcmjs/-/dcmjs-0.29.5.tgz#3e2311fc47aafc70f21e236ad89e2ff9ba6589fd"
integrity sha512-CcLo3pwitf9JhhvW3/icCraxUhaIKJRyOys9XJlBBDn5TQskyJzxgveLKejcryHn4DooqlJPeMuM4ixdPFEERQ==
dependencies:
"@babel/runtime-corejs2" "^7.17.8"
gl-matrix "^3.1.0"
lodash.clonedeep "^4.5.0"
loglevelnext "^3.0.1"
ndarray "^1.0.19"
pako "^2.0.4"

debug-log@^1.0.0:
version "1.0.1"
resolved "https://registry.npmjs.org/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f"
Expand Down

0 comments on commit f98eb20

Please sign in to comment.