refactor: Reduce bundle size (#1575)
* async load cornerstoneWADOImageLoader chunk * Lazy initializing of CornerstoneWADIImageLoader - delayed till Viewer creation * Async loading of react-vtkjs-viewport * withCornerstone HOC to wrap routes requiring CornerstoneWADOImageLoader initiazation * removed dead code in comments * initWeWorkers is no more. Remove al its references. Co-authored-by: kedar.netelixir <kedar.choudhary@netelixir.com> Co-authored-by: Danny Brown <danny.ri.brown@gmail.com>
This commit is contained in:
20 files changed
+174
-136
No files matched your search
@@ -1,13 +1,14 @@
|
||||
import * as dcmjs from 'dcmjs';
|
||||
import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader';
|
||||
import FileLoader from './fileLoader';
|
||||
import OHIF from '@ohif/core';
|
||||
import { getCornerstoneWADOImageLoader } from '../../utils/cornerstoneWADOImageLoader';
|
||||
|
||||
const metadataProvider = OHIF.cornerstone.metadataProvider;
|
||||
|
||||
const DICOMFileLoader = new (class extends FileLoader {
|
||||
fileType = 'application/dicom';
|
||||
loadFile(file, imageId) {
|
||||
async loadFile(file, imageId) {
|
||||
const cornerstoneWADOImageLoader = await getCornerstoneWADOImageLoader();
|
||||
return cornerstoneWADOImageLoader.wadouri.loadFileRequest(imageId);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader';
|
||||
import FileLoader from './fileLoader';
|
||||
import PDFFileLoader from './pdfFileLoader';
|
||||
import DICOMFileLoader from './dicomFileLoader';
|
||||
import { getCornerstoneWADOImageLoader } from '../../utils/cornerstoneWADOImageLoader';
|
||||
|
||||
class FileLoaderService extends FileLoader {
|
||||
fileType;
|
||||
@@ -53,7 +53,8 @@ class FileLoaderService extends FileLoader {
|
||||
return result;
|
||||
}
|
||||
|
||||
addFile(file) {
|
||||
async addFile(file) {
|
||||
const cornerstoneWADOImageLoader = await getCornerstoneWADOImageLoader();
|
||||
return cornerstoneWADOImageLoader.wadouri.fileManager.add(file);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader';
|
||||
import FileLoader from './fileLoader';
|
||||
import { getCornerstoneWADOImageLoader } from '../../utils/cornerstoneWADOImageLoader';
|
||||
|
||||
const PDFFileLoader = new (class extends FileLoader {
|
||||
fileType = 'application/pdf';
|
||||
loadFile(file, imageId) {
|
||||
async loadFile(file, imageId) {
|
||||
const cornerstoneWADOImageLoader = await getCornerstoneWADOImageLoader();
|
||||
return cornerstoneWADOImageLoader.wadouri.loadFileRequest(imageId);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user