Skip to content

Commit

Permalink
fix(demo): Deploy issue (OHIF#3951)
Browse files Browse the repository at this point in the history
  • Loading branch information
wayfarer3130 authored and thanh-nguyen-dang committed Apr 30, 2024
1 parent cfd6d2f commit 9171860
Show file tree
Hide file tree
Showing 20 changed files with 234 additions and 103 deletions.
6 changes: 3 additions & 3 deletions extensions/cornerstone-dicom-seg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^1.44.1",
"@cornerstonejs/tools": "^1.44.1",
"@kitware/vtk.js": "29.3.0",
"@cornerstonejs/adapters": "^1.63.4",
"@cornerstonejs/core": "^1.63.4",
"@kitware/vtk.js": "29.7.0",
"react-color": "^2.19.3"
}
}
6 changes: 3 additions & 3 deletions extensions/cornerstone-dicom-sr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^1.44.1",
"@cornerstonejs/core": "^1.44.1",
"@cornerstonejs/tools": "^1.44.1",
"@cornerstonejs/adapters": "^1.63.4",
"@cornerstonejs/core": "^1.63.4",
"@cornerstonejs/tools": "^1.63.4",
"classnames": "^2.3.2"
}
}
12 changes: 6 additions & 6 deletions extensions/cornerstone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,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.44.1",
"@cornerstonejs/dicom-image-loader": "^1.63.4",
"@ohif/core": "3.8.0-beta.55",
"@ohif/ui": "3.8.0-beta.55",
"dcmjs": "^0.29.12",
Expand All @@ -54,11 +54,11 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^1.44.1",
"@cornerstonejs/core": "^1.44.1",
"@cornerstonejs/streaming-image-volume-loader": "^1.44.1",
"@cornerstonejs/tools": "^1.44.1",
"@kitware/vtk.js": "29.3.01",
"@cornerstonejs/adapters": "^1.63.4",
"@cornerstonejs/core": "^1.63.4",
"@cornerstonejs/streaming-image-volume-loader": "^1.63.4",
"@cornerstonejs/tools": "^1.63.4",
"@kitware/vtk.js": "29.7.0",
"html2canvas": "^1.4.1",
"lodash.debounce": "4.0.8",
"lodash.merge": "^4.6.2",
Expand Down
23 changes: 15 additions & 8 deletions extensions/cornerstone/src/utils/initViewTiming.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import { log, Types } from '@ohif/core';
import { log, Enums } from '@ohif/core';
import { EVENTS } from '@cornerstonejs/core';

const { TimingEnum } = Types;

const IMAGE_TIMING_KEYS = [
TimingEnum.DISPLAY_SETS_TO_ALL_IMAGES,
TimingEnum.DISPLAY_SETS_TO_FIRST_IMAGE,
TimingEnum.STUDY_TO_FIRST_IMAGE,
];
const IMAGE_TIMING_KEYS = [];

const imageTiming = {
viewportsWaiting: 0,
Expand All @@ -23,6 +17,18 @@ const imageTiming = {
*/

export default function initViewTiming({ element }) {
if (!IMAGE_TIMING_KEYS.length) {
// Work around a bug in WebPack that doesn't getting the enums initialized
// quite fast enough to be declared statically.
const { TimingEnum } = Enums;

IMAGE_TIMING_KEYS.push(
TimingEnum.DISPLAY_SETS_TO_ALL_IMAGES,
TimingEnum.DISPLAY_SETS_TO_FIRST_IMAGE,
TimingEnum.STUDY_TO_FIRST_IMAGE,
);
}

if (!IMAGE_TIMING_KEYS.find(key => log.timingKeys[key])) {
return;
}
Expand All @@ -34,6 +40,7 @@ function imageRenderedListener(evt) {
if (evt.detail.viewportStatus === 'preRender') {
return;
}
const { TimingEnum } = Enums;
log.timeEnd(TimingEnum.DISPLAY_SETS_TO_FIRST_IMAGE);
log.timeEnd(TimingEnum.STUDY_TO_FIRST_IMAGE);
log.timeEnd(TimingEnum.SCRIPT_TO_VIEW);
Expand Down
10 changes: 7 additions & 3 deletions extensions/default/src/MergeDataSource/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export const callForAllDataSourcesAsync = async ({
const defs = Object.values(extensionManager.dataSourceDefs);
const defaultDataSourceDef = defs.find(def => def.sourceName === defaultDataSourceName);
const dataSourceDefs = defs.filter(def => def.sourceName !== defaultDataSourceName);
dataSourceDefs.unshift(defaultDataSourceDef);
if (defaultDataSourceDef) {
dataSourceDefs.unshift(defaultDataSourceDef);
}

const promises = [];
const sourceNames = [];
Expand Down Expand Up @@ -100,7 +102,9 @@ export const callForAllDataSources = ({
const defs = Object.values(extensionManager.dataSourceDefs);
const defaultDataSourceDef = defs.find(def => def.sourceName === defaultDataSourceName);
const dataSourceDefs = defs.filter(def => def.sourceName !== defaultDataSourceName);
dataSourceDefs.unshift(defaultDataSourceDef);
if (defaultDataSourceDef) {
dataSourceDefs.unshift(defaultDataSourceDef);
}

const mergedData = [];
for (const dataSourceDef of dataSourceDefs) {
Expand Down Expand Up @@ -140,7 +144,7 @@ export const callForDefaultDataSource = ({
* Calls the data source specified by the RetrieveAETitle of the given display set.
* @typedef {Object} CallByRetrieveAETitleOptions
* @property {string} path - The path of the method to call on the data source.
* @property {unknown[]} args - The arguments to pass to the method.
* @property {any[]} args - The arguments to pass to the method.
* @property {string} defaultDataSourceName - The name of the default data source.
* @property {ExtensionManager} extensionManager - The extension manager.
*/
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 @@
"start": "yarn run dev"
},
"peerDependencies": {
"@cornerstonejs/core": "^1.44.1",
"@cornerstonejs/tools": "^1.44.1",
"@cornerstonejs/core": "^1.63.4",
"@cornerstonejs/tools": "^1.63.4",
"@ohif/core": "3.8.0-beta.55",
"@ohif/extension-cornerstone-dicom-sr": "3.8.0-beta.55",
"@ohif/ui": "3.8.0-beta.55",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@kitware/vtk.js": "29.3.0",
"@kitware/vtk.js": "29.7.0",
"core-js": "^3.2.1"
},
"peerDependencies": {
Expand Down Expand Up @@ -138,7 +138,7 @@
"terser-webpack-plugin": "^5.1.4",
"typescript": "4.6.4",
"unused-webpack-plugin": "2.4.0",
"webpack": "^5.50.0",
"webpack": "^5.90.3",
"webpack-cli": "^4.7.2",
"webpack-dev-server": "4.7.3",
"webpack-hot-middleware": "^2.25.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe('OHIF Cornerstone Toolbar', () => {
// The exact text is slightly dependent on the viewport resolution, so leave a range
cy.get('@viewportInfoTopLeft').should($txt => {
const text = $txt.text();
expect(text).to.include('W:1185').include('L:479');
expect(text).to.include('W:118').include('L:479');
});
});

Expand Down
2 changes: 1 addition & 1 deletion platform/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "^1.2.2",
"@cornerstonejs/codec-openjpeg": "^1.2.2",
"@cornerstonejs/codec-openjph": "^2.4.5",
"@cornerstonejs/dicom-image-loader": "^1.44.1",
"@cornerstonejs/dicom-image-loader": "^1.63.4",
"@emotion/serialize": "^1.1.3",
"@ohif/core": "3.8.0-beta.55",
"@ohif/extension-cornerstone": "3.8.0-beta.55",
Expand Down
106 changes: 103 additions & 3 deletions platform/app/public/config/local_static.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,121 @@ window.config = {
dataSources: [
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
sourceName: 'dicomweb',
sourceName: 'e2e',
configuration: {
friendlyName: 'StaticWado test data',
// The most important field to set for static WADO
staticWado: true,
name: 'StaticWADO',
wadoUriRoot: '/viewer-testdata',
qidoRoot: '/viewer-testdata',
wadoRoot: '/viewer-testdata',
qidoSupportsIncludeField: false,
imageRendering: 'wadors',
thumbnailRendering: 'wadors',
enableStudyLazyLoad: true,
supportsFuzzyMatching: false,
supportsWildcard: true,
singlepart: 'video,thumbnail,pdf',
omitQuotationForMultipartRequest: true,
bulkDataURI: {
enabled: true,
relativeResolution: 'studies',
},
},
},
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
sourceName: 'local',
configuration: {
friendlyName: 'Static WADO Local Data',
name: 'DCM4CHEE',
qidoRoot: 'http://localhost:5000/dicomweb',
wadoRoot: 'http://localhost:5000/dicomweb',
qidoSupportsIncludeField: false,
supportsReject: true,
supportsStow: true,
imageRendering: 'wadors',
thumbnailRendering: 'wadors',
enableStudyLazyLoad: true,
supportsFuzzyMatching: false,
supportsWildcard: true,
staticWado: true,
singlepart: 'video',
bulkDataURI: {
enabled: true,
relativeResolution: 'studies',
},
},
},
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
sourceName: 'docker',
configuration: {
friendlyName: 'Static WADO Docker Data',
name: 'DCM4CHEE',
qidoRoot: 'http://localhost:25080/dicomweb',
wadoRoot: 'http://localhost:25080/dicomweb',
qidoSupportsIncludeField: false,
supportsReject: true,
supportsStow: true,
imageRendering: 'wadors',
thumbnailRendering: 'wadors',
enableStudyLazyLoad: true,
supportsFuzzyMatching: false,
supportsWildcard: true,
staticWado: true,
singlepart: 'bulkdata,video,pdf',
bulkDataURI: {
enabled: true,
relativeResolution: 'studies',
},
},
},
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
sourceName: 'ohif',
configuration: {
friendlyName: 'AWS S3 Static wado server',
name: 'aws',
wadoUriRoot: 'https://d33do7qe4w26qo.cloudfront.net/dicomweb',
qidoRoot: 'https://d33do7qe4w26qo.cloudfront.net/dicomweb',
wadoRoot: 'https://d33do7qe4w26qo.cloudfront.net/dicomweb',
qidoSupportsIncludeField: false,
imageRendering: 'wadors',
thumbnailRendering: 'wadors',
enableStudyLazyLoad: true,
supportsFuzzyMatching: false,
supportsWildcard: true,
staticWado: true,
singlepart: 'bulkdata,video,pdf',
bulkDataURI: {
enabled: true,
relativeResolution: 'studies',
},
},
},
{
friendlyName: 'StaticWado default data',
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
sourceName: 'dicomweb',
configuration: {
name: 'DCM4CHEE',
wadoUriRoot: '/dicomweb',
qidoRoot: '/dicomweb',
wadoRoot: '/dicomweb',
qidoSupportsIncludeField: false,
supportsReject: false,
imageRendering: 'wadors',
thumbnailRendering: 'wadors',
enableStudyLazyLoad: true,
supportsFuzzyMatching: false,
supportsWildcard: true,
staticWado: true,
singlepart: 'bulkdata,video,pdf',
omitQuotationForMultipartRequest: true,
bulkDataURI: {
enabled: true,
relativeResolution: 'studies',
},
},
},
{
Expand Down
10 changes: 4 additions & 6 deletions platform/app/src/routes/DataSourceWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
/* eslint-disable react/jsx-props-no-spreading */
import React, { useCallback, useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { ExtensionManager, MODULE_TYPES, Types, log } from '@ohif/core';
import { Enums, ExtensionManager, MODULE_TYPES, log } from '@ohif/core';
//
import { extensionManager } from '../App.tsx';
import { useParams, useLocation } from 'react-router';
import { useNavigate } from 'react-router-dom';
import useSearchParams from '../hooks/useSearchParams.ts';

const { TimingEnum } = Types;

/**
* Determines if two React Router location objects are the same.
*/
Expand Down Expand Up @@ -151,7 +149,7 @@ function DataSourceWrapper(props) {
// 204: no content
async function getData() {
setIsLoading(true);
log.time(TimingEnum.SEARCH_TO_LIST);
log.time(Enums.TimingEnum.SEARCH_TO_LIST);
const studies = await dataSource.query.studies.search(queryFilterValues);

setData({
Expand All @@ -161,8 +159,8 @@ function DataSourceWrapper(props) {
pageNumber: queryFilterValues.pageNumber,
location,
});
log.timeEnd(TimingEnum.SCRIPT_TO_VIEW);
log.timeEnd(TimingEnum.SEARCH_TO_LIST);
log.timeEnd(Enums.TimingEnum.SCRIPT_TO_VIEW);
log.timeEnd(Enums.TimingEnum.SEARCH_TO_LIST);

setIsLoading(false);
}
Expand Down
13 changes: 6 additions & 7 deletions platform/app/src/routes/Mode/Mode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect, useState, useRef } from 'react';
import { useParams, useLocation, useNavigate } from 'react-router';
import PropTypes from 'prop-types';
// TODO: DicomMetadataStore should be injected?
import { DicomMetadataStore, ServicesManager, utils, Types, log } from '@ohif/core';
import { DicomMetadataStore, ServicesManager, utils, log, Enums } from '@ohif/core';
import { DragAndDropProvider, ImageViewerProvider } from '@ohif/ui';
import { useSearchParams } from '@hooks';
import { useAppConfig } from '@state';
Expand All @@ -14,7 +14,6 @@ import loadModules from '../../pluginImports';
import isSeriesFilterUsed from '../../utils/isSeriesFilterUsed';

const { getSplitParam, sortingCriteria } = utils;
const { TimingEnum } = Types;

/**
* Initialize the route.
Expand Down Expand Up @@ -84,8 +83,8 @@ function defaultRouteInit(

unsubscriptions.push(instanceAddedUnsubscribe);

log.time(TimingEnum.STUDY_TO_DISPLAY_SETS);
log.time(TimingEnum.STUDY_TO_FIRST_IMAGE);
log.time(Enums.TimingEnum.STUDY_TO_DISPLAY_SETS);
log.time(Enums.TimingEnum.STUDY_TO_FIRST_IMAGE);

const allRetrieves = studyInstanceUIDs.map(StudyInstanceUID =>
dataSource.retrieve.series.metadata({
Expand All @@ -106,9 +105,9 @@ function defaultRouteInit(
});

Promise.allSettled(allRetrieves).then(promises => {
log.timeEnd(TimingEnum.STUDY_TO_DISPLAY_SETS);
log.time(TimingEnum.DISPLAY_SETS_TO_FIRST_IMAGE);
log.time(TimingEnum.DISPLAY_SETS_TO_ALL_IMAGES);
log.timeEnd(Enums.TimingEnum.STUDY_TO_DISPLAY_SETS);
log.time(Enums.TimingEnum.DISPLAY_SETS_TO_FIRST_IMAGE);
log.time(Enums.TimingEnum.DISPLAY_SETS_TO_ALL_IMAGES);

const allPromises = [];
const remainingPromises = [];
Expand Down
2 changes: 1 addition & 1 deletion platform/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,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.44.1",
"@cornerstonejs/dicom-image-loader": "^1.63.4",
"@ohif/ui": "3.8.0-beta.55",
"cornerstone-math": "0.1.9",
"dicom-parser": "^1.8.21"
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions platform/core/src/enums/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { TimingEnum } from './TimingEnum';

export { TimingEnum };
1 change: 1 addition & 0 deletions platform/core/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe('Top level exports', () => {
//
'CineService',
'CustomizationService',
'Enums',
'StateSyncService',
'UIDialogService',
'UIModalService',
Expand Down
Loading

0 comments on commit 9171860

Please sign in to comment.