fix: Allow the mode setup/creation to be async, and provide a few more values to extension/app config/mode setup. (#4016)

This commit is contained in:
Bill Wallace authored and GitHub committed 2024-06-19 09:32:00 -04:00
1 parent 01e200986c
commit 88575c6c09
55 files changed
+2618 -3421

No files matched your search

@@ -43,7 +43,6 @@ module.exports = (env, argv) => {
externals: [
/\b(vtk.js)/,
/\b(dcmjs)/,
/\b(dicom-microscopy-viewer)/,
/\b(gl-matrix)/,
/^@ohif/,
/^@cornerstonejs/,
+1 -1
View File
@@ -37,7 +37,7 @@ module.exports = {
'@babel/preset-react',
'@babel/preset-typescript',
],
plugins: ['react-hot-loader/babel'],
plugins: ['react-refresh/babel'],
ignore: ['**/*.test.jsx', '**/*.test.js', '__snapshots__', '__tests__'],
},
},
+3 -4
View File
@@ -38,8 +38,8 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-i18next": "^10.11.0",
"react-router": "^6.8.1",
"react-router-dom": "^6.8.1"
"react-router": "^6.23.1",
"react-router-dom": "^6.23.1"
},
"dependencies": {
"@babel/runtime": "^7.20.13",
@@ -47,7 +47,6 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "^1.2.2",
"@cornerstonejs/codec-openjpeg": "^1.2.2",
"colormap": "^2.3",
"dicom-microscopy-viewer": "^0.44.0",
"dicomicc": "^0.1"
"mathjs": "^12.4.2"
}
}
@@ -49,6 +49,14 @@ class DicomMicroscopyViewport extends Component {
resizeRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]),
};
/**
* Need to return this as a function to prevent webpack from munging it.
*/
public static getImportPath() {
return '/dicom-microscopy-viewer/dicomMicroscopyViewer.min.js';
}
/**
* Get the nearest ROI from the mouse click point
*
@@ -86,9 +94,10 @@ class DicomMicroscopyViewport extends Component {
// you should only do this once.
async installOpenLayersRenderer(container, displaySet) {
const loadViewer = async metadata => {
const { viewer: DicomMicroscopyViewer, metadata: metadataUtils } = await import(
/* webpackChunkName: "dicom-microscopy-viewer" */ 'dicom-microscopy-viewer'
);
await import(
/* webpackIgnore: true */ DicomMicroscopyViewport.getImportPath());
const { viewer: DicomMicroscopyViewer, metadata: metadataUtils } = (window as any).dicomMicroscopyViewer;
const microscopyViewer = DicomMicroscopyViewer.VolumeImageViewer;
const client = getDicomWebClient({
@@ -2,6 +2,7 @@ import dcmjs from 'dcmjs';
import DCM_CODE_VALUES from './dcmCodeValues';
import toArray from './toArray';
import DicomMicroscopyViewport from '../DicomMicroscopyViewport';
const MeasurementReport = dcmjs.adapters.DICOMMicroscopyViewer.MeasurementReport;
@@ -47,10 +48,9 @@ export default async function loadSR(
async function _getROIsFromToolState(naturalizedDataset, FrameOfReferenceUID) {
const toolState = MeasurementReport.generateToolState(naturalizedDataset);
const tools = Object.getOwnPropertyNames(toolState);
const DICOMMicroscopyViewer = await import(
/* webpackChunkName: "dicom-microscopy-viewer" */ 'dicom-microscopy-viewer'
);
// Does a dynamic import to prevent webpack from rebuilding the library
await import(/* webpackIgnore: true */ DicomMicroscopyViewport.getImportPath());
const DICOMMicroscopyViewer = (window as any).dicomMicroscopyViewer;
const measurementGroupContentItems = _getMeasurementGroups(naturalizedDataset);