Skip to content

Commit

Permalink
Merge pull request #2 from OHIF/v3-stable
Browse files Browse the repository at this point in the history
V3 stable
  • Loading branch information
salimkanoun authored Dec 28, 2022
2 parents d5c347c + ec7cdba commit 799d648
Show file tree
Hide file tree
Showing 71 changed files with 1,364 additions and 953 deletions.
8 changes: 7 additions & 1 deletion .docker/Viewer-v3.x/default.conf.template
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
server {
listen ${PORT};
# listen 3000;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
add_header Cross-Origin-Opener-Policy same-origin;
add_header Cross-Origin-Embedder-Policy require-corp;
add_header Cross-Origin-Resource-Policy same-origin;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
Expand Down
2 changes: 1 addition & 1 deletion .docker/Viewer-v3.x/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

envsubst `${PORT}` < /usr/src/default.conf.template > /etc/nginx/conf.d/default.conf
envsubst '${PORT}' < /usr/src/default.conf.template > /etc/nginx/conf.d/default.conf

if [ -n "$CLIENT_ID" ] || [ -n "$HEALTHCARE_API_ENDPOINT" ]
then
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,10 @@ RUN yarn run build
# which runs Nginx using Alpine Linux
FROM nginxinc/nginx-unprivileged:1.23.1-alpine as final
#RUN apk add --no-cache bash
ENV PORT=3000
ENV PORT=80
RUN rm /etc/nginx/conf.d/default.conf
USER nginx
COPY --chown=nginx:nginx .docker/Viewer-v3.x /usr/src
RUN envsubst `${PORT}` < /usr/src/default.conf.template > /etc/nginx/conf.d/default.conf
RUN chmod 777 /usr/src/entrypoint.sh
COPY --from=builder /usr/src/app/platform/viewer/dist /usr/share/nginx/html
ENTRYPOINT ["/usr/src/entrypoint.sh"]
Expand Down
4 changes: 2 additions & 2 deletions extensions/cornerstone-dicom-sr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"dependencies": {
"@babel/runtime": "7.16.3",
"classnames": "^2.2.6",
"@cornerstonejs/core": "^0.21.5",
"@cornerstonejs/tools": "^0.29.8"
"@cornerstonejs/core": "^0.22.3",
"@cornerstonejs/tools": "^0.30.6"
}
}
6 changes: 3 additions & 3 deletions extensions/cornerstone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
},
"dependencies": {
"@babel/runtime": "7.17.9",
"@cornerstonejs/core": "^0.21.5",
"@cornerstonejs/streaming-image-volume-loader": "^0.6.5",
"@cornerstonejs/tools": "^0.29.8",
"@cornerstonejs/core": "^0.22.3",
"@cornerstonejs/streaming-image-volume-loader": "^0.6.11",
"@cornerstonejs/tools": "^0.30.6",
"@kitware/vtk.js": "25.9.0",
"html2canvas": "^1.4.1",
"lodash.debounce": "4.0.8",
Expand Down
10 changes: 10 additions & 0 deletions extensions/cornerstone/src/init.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export default async function init({
DisplaySetService,
UIDialogService,
UIModalService,
UINotificationService,
CineService,
CornerstoneViewportService,
HangingProtocolService,
Expand All @@ -79,6 +80,15 @@ export default async function init({

window.services = servicesManager.services;

if (!window.crossOriginIsolated) {
UINotificationService.show({
title: 'Cross Origin Isolation',
message:
'Cross Origin Isolation is not enabled, volume rendering will not work (e.g., MPR)',
type: 'warning',
});
}

if (cornerstone.getShouldUseCPURendering()) {
_showCPURenderingModal(UIModalService, HangingProtocolService);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1332,9 +1332,7 @@ class SegmentationService {
segDisplaySetInstanceUID
);

const {
FrameOfReferenceUID: segFrameOfReferenceUID,
} = segDisplaySet.instance;
const segFrameOfReferenceUID = segDisplaySet.instance?.FrameOfReferenceUID;

viewportDisplaySetInstanceUIDs.forEach(displaySetInstanceUID => {
// check if the displaySet is sharing the same frameOfReferenceUID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class CornerstoneViewportService implements IViewportService {
public destroy() {
this._removeResizeObserver();
this.viewportGridResizeObserver = null;
this.renderingEngine.destroy();
this.renderingEngine?.destroy?.();
this.viewportsDisplaySets.clear();
this.renderingEngine = null;
cache.purgeCache();
Expand Down
1 change: 1 addition & 0 deletions extensions/default/src/DicomTagBrowser/DicomTagBrowser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const DicomTagBrowser = ({ displaySets, displaySetInstanceUID }) => {
<div className="w-1/2">
<InputRange
value={instanceNumber}
key={selectedDisplaySetInstanceUID}
onChange={value => {
setInstanceNumber(parseInt(value));
}}
Expand Down
1 change: 1 addition & 0 deletions extensions/default/src/Panels/PanelStudyBrowser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ function PanelStudyBrowser({
return (
<StudyBrowser
tabs={tabs}
servicesManager={servicesManager}
activeTabName={activeTabName}
onDoubleClickThumbnail={onDoubleClickThumbnailHandler}
activeDisplaySetInstanceUIDs={activeDisplaySetInstanceUIDs}
Expand Down
1 change: 1 addition & 0 deletions extensions/default/src/ViewerLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ function ViewerLayout({
<div>
<Header
menuOptions={menuOptions}
isReturnEnabled={!!appConfig.showStudyList}
onClickReturnButton={onClickReturnButton}
WhiteLabeling={appConfig.whiteLabeling}
>
Expand Down
29 changes: 29 additions & 0 deletions extensions/default/src/getCustomizationModule.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'react';

/**
*
* Note: this is an example of how the customization module can be used
* using the customization module. Below, we are adding a new custom route
* to the application at the path /custom and rendering a custom component
* Real world use cases of the having a custom route would be to add a
* custom page for the user to view their profile, or to add a custom
* page for login etc.
*/
export default function getCustomizationModule() {
return [
{
name: 'helloPage',
value: {
id: 'customRoutes',
routes: [
{
path: '/custom',
children: () => (
<h1 style={{ color: 'white' }}>Hello Custom Route</h1>
),
},
],
},
},
];
}
3 changes: 3 additions & 0 deletions extensions/default/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import getToolbarModule from './getToolbarModule';
import commandsModule from './commandsModule';
import getHangingProtocolModule from './getHangingProtocolModule';
import getStudiesForPatientByStudyInstanceUID from './Panels/getStudiesForPatientByStudyInstanceUID';
import getCustomizationModule from './getCustomizationModule';
import { id } from './id.js';
import init from './init';

Expand Down Expand Up @@ -36,6 +37,8 @@ const defaultExtension = {
},
];
},

getCustomizationModule,
};

export default defaultExtension;
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.2.6",
"@cornerstonejs/core": "^0.21.5",
"@cornerstonejs/tools": "^0.29.8",
"@cornerstonejs/core": "^0.22.3",
"@cornerstonejs/tools": "^0.30.6",
"@ohif/extension-cornerstone-dicom-sr": "^3.0.0",
"dcmjs": "^0.28.3",
"prop-types": "^15.6.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ function PanelStudyBrowserTracking({
return (
<StudyBrowser
tabs={tabs}
servicesManager={servicesManager}
activeTabName={activeTabName}
expandedStudyInstanceUIDs={expandedStudyInstanceUIDs}
onClickStudy={_handleStudyClick}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ function TrackedCornerstoneViewport(props) {
cineService.playClip(element, {
framesPerSecond: validFrameRate,
});
} else {
cineService.stopClip(element);
}
};

Expand Down
1 change: 0 additions & 1 deletion modes/basic-dev-mode/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ function modeFactory({ modeConfiguration }) {
} = servicesManager.services;

ToolBarService.reset();
MeasurementService.clearMeasurements();
ToolGroupService.destroy();
},
validationTags: {
Expand Down
12 changes: 7 additions & 5 deletions modes/longitudinal/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ function modeFactory() {
* Lifecycle hooks
*/
onModeEnter: ({ servicesManager, extensionManager, commandsManager }) => {
const { ToolBarService, ToolGroupService } = servicesManager.services;
const {
MeasurementService,
ToolBarService,
ToolGroupService,
} = servicesManager.services;

MeasurementService.clearMeasurements();

// Init Default and SR ToolGroups
initToolGroups(extensionManager, ToolGroupService, commandsManager);
Expand Down Expand Up @@ -120,20 +126,16 @@ function modeFactory() {
const {
ToolGroupService,
SyncGroupService,
MeasurementService,
ToolBarService,
SegmentationService,
CornerstoneViewportService,
HangingProtocolService,
} = servicesManager.services;

ToolBarService.reset();
MeasurementService.clearMeasurements();
ToolGroupService.destroy();
SyncGroupService.destroy();
SegmentationService.destroy();
CornerstoneViewportService.destroy();
HangingProtocolService.reset();
},
validationTags: {
study: [],
Expand Down
4 changes: 0 additions & 4 deletions modes/tmtv/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,21 +136,17 @@ function modeFactory({ modeConfiguration }) {
const {
ToolGroupService,
SyncGroupService,
MeasurementService,
ToolBarService,
SegmentationService,
CornerstoneViewportService,
HangingProtocolService,
} = servicesManager.services;

unsubscriptions.forEach(unsubscribe => unsubscribe());
ToolBarService.reset();
MeasurementService.clearMeasurements();
ToolGroupService.destroy();
SyncGroupService.destroy();
SegmentationService.destroy();
CornerstoneViewportService.destroy();
HangingProtocolService.reset();
},
validationTags: {
study: [],
Expand Down
7 changes: 5 additions & 2 deletions modes/tmtv/src/utils/setFusionActiveVolume.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,17 @@ export default function setFusionActiveVolume(
toolNames.EllipticalROI
);

// Todo: this should not take into account the loader id
const volumeId = `cornerstoneStreamingImageVolume:${displaySets[0].displaySetInstanceUID}`;

const windowLevelConfig = {
...wlToolConfig,
volumeId: displaySets[0].displaySetInstanceUID,
volumeId,
};

const ellipticalROIConfig = {
...ellipticalToolConfig,
volumeId: displaySets[0].displaySetInstanceUID,
volumeId,
};

ToolGroupService.setToolConfiguration(
Expand Down
32 changes: 17 additions & 15 deletions platform/core/src/extensions/ExtensionManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,12 @@ export default class ExtensionManager {
_extensionLifeCycleHooks,
} = this;

const {
MeasurementService,
ViewportGridService,
} = _servicesManager.services;

MeasurementService.clearMeasurements();
ViewportGridService.reset();
// The onModeEnter of the service must occur BEFORE the extension
// onModeEnter in order to reset the state to a standard state
// before the extension restores and cached data.
for (const service of Object.values(_servicesManager.services)) {
service?.onModeEnter?.();
}

registeredExtensionIds.forEach(extensionId => {
const onModeEnter = _extensionLifeCycleHooks.onModeEnter[extensionId];
Expand All @@ -69,14 +68,6 @@ export default class ExtensionManager {
_extensionLifeCycleHooks,
} = this;

const {
MeasurementService,
ViewportGridService,
} = _servicesManager.services;

MeasurementService.clearMeasurements();
ViewportGridService.reset();

registeredExtensionIds.forEach(extensionId => {
const onModeExit = _extensionLifeCycleHooks.onModeExit[extensionId];

Expand All @@ -87,6 +78,16 @@ export default class ExtensionManager {
});
}
});

// The service onModeExit calls must occur after the extension ones
// so that extension ones can store/restore data.
for (const service of Object.values(_servicesManager.services)) {
try {
service?.onModeExit?.();
} catch (e) {
console.warn('onModeExit caught', e);
}
}
}

/**
Expand Down Expand Up @@ -200,6 +201,7 @@ export default class ExtensionManager {
case MODULE_TYPES.SOP_CLASS_HANDLER:
case MODULE_TYPES.CONTEXT:
case MODULE_TYPES.LAYOUT_TEMPLATE:
case MODULE_TYPES.CUSTOMIZATION:
case MODULE_TYPES.UTILITY:
// Default for most extension points,
// Just adds each entry ready for consumption by mode.
Expand Down
3 changes: 3 additions & 0 deletions platform/core/src/extensions/ExtensionManager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ describe('ExtensionManager.js', () => {
getUtilityModule: () => {
return [{}];
},
getCustomizationModule: () => {
return [{}];
},
};

await extensionManager.registerExtension(extension);
Expand Down
1 change: 1 addition & 0 deletions platform/core/src/extensions/MODULE_TYPES.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default {
COMMANDS: 'commandsModule',
CUSTOMIZATION: 'customizationModule',
DATA_SOURCE: 'dataSourcesModule',
PANEL: 'panelModule',
SOP_CLASS_HANDLER: 'sopClassHandlerModule',
Expand Down
1 change: 1 addition & 0 deletions platform/core/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ describe('Top level exports', () => {
'OHIF',
//
'CineService',
'CustomizationServiceRegistration',
'UIDialogService',
'UIModalService',
'UINotificationService',
Expand Down
3 changes: 3 additions & 0 deletions platform/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
HangingProtocolService,
pubSubServiceInterface,
UserAuthenticationService,
CustomizationServiceRegistration,
} from './services';

import IWebApiDataSource from './DataSources/IWebApiDataSource';
Expand Down Expand Up @@ -57,6 +58,7 @@ const OHIF = {
viewer: {},
//
CineService,
CustomizationServiceRegistration,
UIDialogService,
UIModalService,
UINotificationService,
Expand Down Expand Up @@ -92,6 +94,7 @@ export {
DICOMWeb,
//
CineService,
CustomizationServiceRegistration,
UIDialogService,
UIModalService,
UINotificationService,
Expand Down
Loading

0 comments on commit 799d648

Please sign in to comment.