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

@@ -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);