Skip to content

Commit

Permalink
perf: Update to latest WADO Image Loader version (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
swederik authored Sep 16, 2021
1 parent 158d869 commit 0a3cb79
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 102 deletions.
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-vtkjs-viewport",
"version": "0.0.12",
"version": "0.0.0-semantically-released",
"description": "VTK.js image viewport component for React",
"author": "OHIF Contributors",
"license": "MIT",
Expand All @@ -25,7 +25,8 @@
"react": "^16.8.6",
"react-dom": "^16.8.6",
"vtk.js": "^11.14.0",
"cornerstone-tools": "^4.20.1"
"cornerstone-core": "^2.5.0",
"cornerstone-tools": "^6.0.0"
},
"dependencies": {
"date-fns": "^2.2.1",
Expand All @@ -46,13 +47,13 @@
"babel-loader": "8.0.6",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^5.0.4",
"cornerstone-core": "^2.3.0",
"cornerstone-math": "^0.1.8",
"cornerstone-tools": "^4.20.1",
"cornerstone-wado-image-loader": "^3.0.5",
"cornerstone-core": "^2.5.0",
"cornerstone-math": "^0.1.9",
"cornerstone-tools": "^6.0.0",
"cornerstone-wado-image-loader": "^4.0.0",
"cross-env": "^5.2.0",
"css-loader": "^3.0.0",
"dicom-parser": "^1.8.3",
"dicom-parser": "^1.8.8",
"dicomweb-client": "^0.5.2",
"eslint": "5.16.0",
"eslint-config-prettier": "^6.3.0",
Expand All @@ -74,7 +75,7 @@
"prettier": "^1.18.2",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-cornerstone-viewport": "^1.0.0",
"react-cornerstone-viewport": "^4.1.1",
"react-dom": "^16.8.6",
"react-resize-detector": "^4.2.0",
"react-router-dom": "^5.0.1",
Expand Down
25 changes: 13 additions & 12 deletions src/lib/loadImageData.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import cornerstone from 'cornerstone-core';
import { requestPoolManager } from 'cornerstone-tools';
import insertSlice from './data/insertSlice.js';
import getPatientWeightAndCorrectedDose from './data/getPatientWeightAndCorrectedDose.js';

Expand Down Expand Up @@ -110,24 +109,26 @@ export default function loadImageDataProgressively(imageDataObject) {
prefetchImageIds(imageIds, insertPixelData, insertPixelDataErrorHandler);
}

const requestType = 'prefetch';
const preventCache = false;

function prefetchImageIds(
imageIds,
insertPixelData,
insertPixelDataErrorHandler
) {
const imageLoadPoolManager = cornerstone.imageLoadPoolManager;
const requestType = 'prefetch';

const requestFn = id =>
cornerstone
.loadAndCacheImage(id)
.then(insertPixelData, insertPixelDataErrorHandler);

imageIds.forEach(imageId => {
requestPoolManager.addRequest(
{},
imageId,
imageLoadPoolManager.addRequest(
requestFn.bind(this, imageId),
requestType,
preventCache,
insertPixelData,
insertPixelDataErrorHandler
{
imageId,
}
);
});

requestPoolManager.startGrabbing();
}
Loading

0 comments on commit 0a3cb79

Please sign in to comment.