@cornerstonejs/core 0.6.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/RenderingEngine/StackViewport.d.ts +6 -7
- package/dist/cjs/RenderingEngine/StackViewport.js +68 -36
- package/dist/cjs/RenderingEngine/StackViewport.js.map +1 -1
- package/dist/cjs/RenderingEngine/Viewport.d.ts +1 -0
- package/dist/cjs/RenderingEngine/Viewport.js +11 -2
- package/dist/cjs/RenderingEngine/Viewport.js.map +1 -1
- package/dist/cjs/RenderingEngine/VolumeViewport.d.ts +0 -1
- package/dist/cjs/RenderingEngine/VolumeViewport.js +0 -6
- package/dist/cjs/RenderingEngine/VolumeViewport.js.map +1 -1
- package/dist/cjs/RenderingEngine/helpers/cpuFallback/rendering/getDefaultViewport.js +7 -7
- package/dist/cjs/RenderingEngine/helpers/cpuFallback/rendering/getDefaultViewport.js.map +1 -1
- package/dist/cjs/RenderingEngine/helpers/cpuFallback/rendering/renderGrayscaleImage.js +1 -1
- package/dist/cjs/RenderingEngine/helpers/cpuFallback/rendering/renderGrayscaleImage.js.map +1 -1
- package/dist/cjs/enums/Events.d.ts +1 -0
- package/dist/cjs/enums/Events.js +1 -0
- package/dist/cjs/enums/Events.js.map +1 -1
- package/dist/cjs/requestPool/imageLoadPoolManager.js +1 -1
- package/dist/cjs/requestPool/imageLoadPoolManager.js.map +1 -1
- package/dist/cjs/requestPool/imageRetrievalPoolManager.js +1 -1
- package/dist/cjs/requestPool/imageRetrievalPoolManager.js.map +1 -1
- package/dist/cjs/requestPool/requestPoolManager.d.ts +5 -4
- package/dist/cjs/requestPool/requestPoolManager.js +42 -51
- package/dist/cjs/requestPool/requestPoolManager.js.map +1 -1
- package/dist/cjs/types/EventTypes.d.ts +10 -3
- package/dist/cjs/types/ICamera.d.ts +2 -0
- package/dist/cjs/types/IImage.d.ts +1 -0
- package/dist/cjs/types/IStackViewport.d.ts +2 -1
- package/dist/cjs/types/StackViewportProperties.d.ts +0 -2
- package/dist/cjs/utilities/imageToWorldCoords.d.ts +2 -0
- package/dist/cjs/utilities/imageToWorldCoords.js +17 -0
- package/dist/cjs/utilities/imageToWorldCoords.js.map +1 -0
- package/dist/cjs/utilities/index.d.ts +3 -1
- package/dist/cjs/utilities/index.js +5 -1
- package/dist/cjs/utilities/index.js.map +1 -1
- package/dist/cjs/utilities/loadImageToCanvas.js +17 -1
- package/dist/cjs/utilities/loadImageToCanvas.js.map +1 -1
- package/dist/cjs/utilities/prefetchStack.js +1 -0
- package/dist/cjs/utilities/prefetchStack.js.map +1 -1
- package/dist/cjs/utilities/worldToImageCoords.d.ts +3 -0
- package/dist/cjs/utilities/worldToImageCoords.js +31 -0
- package/dist/cjs/utilities/worldToImageCoords.js.map +1 -0
- package/dist/esm/RenderingEngine/StackViewport.d.ts +6 -7
- package/dist/esm/RenderingEngine/StackViewport.js +68 -36
- package/dist/esm/RenderingEngine/StackViewport.js.map +1 -1
- package/dist/esm/RenderingEngine/Viewport.d.ts +1 -0
- package/dist/esm/RenderingEngine/Viewport.js +11 -2
- package/dist/esm/RenderingEngine/Viewport.js.map +1 -1
- package/dist/esm/RenderingEngine/VolumeViewport.d.ts +0 -1
- package/dist/esm/RenderingEngine/VolumeViewport.js +0 -6
- package/dist/esm/RenderingEngine/VolumeViewport.js.map +1 -1
- package/dist/esm/RenderingEngine/helpers/cpuFallback/rendering/getDefaultViewport.js +7 -7
- package/dist/esm/RenderingEngine/helpers/cpuFallback/rendering/getDefaultViewport.js.map +1 -1
- package/dist/esm/RenderingEngine/helpers/cpuFallback/rendering/renderGrayscaleImage.js +1 -1
- package/dist/esm/RenderingEngine/helpers/cpuFallback/rendering/renderGrayscaleImage.js.map +1 -1
- package/dist/esm/enums/Events.d.ts +1 -0
- package/dist/esm/enums/Events.js +1 -0
- package/dist/esm/enums/Events.js.map +1 -1
- package/dist/esm/requestPool/imageLoadPoolManager.js +1 -1
- package/dist/esm/requestPool/imageLoadPoolManager.js.map +1 -1
- package/dist/esm/requestPool/imageRetrievalPoolManager.js +1 -1
- package/dist/esm/requestPool/imageRetrievalPoolManager.js.map +1 -1
- package/dist/esm/requestPool/requestPoolManager.d.ts +5 -4
- package/dist/esm/requestPool/requestPoolManager.js +39 -51
- package/dist/esm/requestPool/requestPoolManager.js.map +1 -1
- package/dist/esm/types/EventTypes.d.ts +10 -3
- package/dist/esm/types/ICamera.d.ts +2 -0
- package/dist/esm/types/IImage.d.ts +1 -0
- package/dist/esm/types/IStackViewport.d.ts +2 -1
- package/dist/esm/types/StackViewportProperties.d.ts +0 -2
- package/dist/esm/utilities/imageToWorldCoords.d.ts +2 -0
- package/dist/esm/utilities/imageToWorldCoords.js +14 -0
- package/dist/esm/utilities/imageToWorldCoords.js.map +1 -0
- package/dist/esm/utilities/index.d.ts +3 -1
- package/dist/esm/utilities/index.js +3 -1
- package/dist/esm/utilities/index.js.map +1 -1
- package/dist/esm/utilities/loadImageToCanvas.js +17 -1
- package/dist/esm/utilities/loadImageToCanvas.js.map +1 -1
- package/dist/esm/utilities/prefetchStack.js +1 -0
- package/dist/esm/utilities/prefetchStack.js.map +1 -1
- package/dist/esm/utilities/worldToImageCoords.d.ts +3 -0
- package/dist/esm/utilities/worldToImageCoords.js +29 -0
- package/dist/esm/utilities/worldToImageCoords.js.map +1 -0
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.renderToCanvas = exports.loadImageToCanvas = exports.prefetchStack = exports.transformWorldToIndex = exports.getVolumeViewportsContainingVolumeId = exports.getVolumeViewportsContainingSameVolumes = exports.indexWithinDimensions = exports.getVolumeActorCorners = exports.getTargetVolumeAndSpacingInNormalDir = exports.getSpacingInNormalDirection = exports.getClosestImageId = exports.windowLevel = exports.createUint8SharedArray = exports.createFloat32SharedArray = exports.isOpposite = exports.isEqual = exports.getRuntimeId = exports.getMinMax = exports.planar = exports.uuidv4 = exports.calibratedPixelSpacingMetadataProvider = exports.imageIdToURI = exports.triggerEvent = exports.scaleRgbTransferFunction = exports.invertRgbTransferFunction = void 0;
|
|
25
|
+
exports.imageToWorldCoords = exports.worldToImageCoords = exports.renderToCanvas = exports.loadImageToCanvas = exports.prefetchStack = exports.transformWorldToIndex = exports.getVolumeViewportsContainingVolumeId = exports.getVolumeViewportsContainingSameVolumes = exports.indexWithinDimensions = exports.getVolumeActorCorners = exports.getTargetVolumeAndSpacingInNormalDir = exports.getSpacingInNormalDirection = exports.getClosestImageId = exports.windowLevel = exports.createUint8SharedArray = exports.createFloat32SharedArray = exports.isOpposite = exports.isEqual = exports.getRuntimeId = exports.getMinMax = exports.planar = exports.uuidv4 = exports.calibratedPixelSpacingMetadataProvider = exports.imageIdToURI = exports.triggerEvent = exports.scaleRgbTransferFunction = exports.invertRgbTransferFunction = void 0;
|
|
26
26
|
const invertRgbTransferFunction_1 = __importDefault(require("./invertRgbTransferFunction"));
|
|
27
27
|
exports.invertRgbTransferFunction = invertRgbTransferFunction_1.default;
|
|
28
28
|
const scaleRgbTransferFunction_1 = __importDefault(require("./scaleRgbTransferFunction"));
|
|
@@ -69,6 +69,10 @@ const loadImageToCanvas_1 = __importDefault(require("./loadImageToCanvas"));
|
|
|
69
69
|
exports.loadImageToCanvas = loadImageToCanvas_1.default;
|
|
70
70
|
const renderToCanvas_1 = __importDefault(require("./renderToCanvas"));
|
|
71
71
|
exports.renderToCanvas = renderToCanvas_1.default;
|
|
72
|
+
const worldToImageCoords_1 = __importDefault(require("./worldToImageCoords"));
|
|
73
|
+
exports.worldToImageCoords = worldToImageCoords_1.default;
|
|
74
|
+
const imageToWorldCoords_1 = __importDefault(require("./imageToWorldCoords"));
|
|
75
|
+
exports.imageToWorldCoords = imageToWorldCoords_1.default;
|
|
72
76
|
const planar = __importStar(require("./planar"));
|
|
73
77
|
exports.planar = planar;
|
|
74
78
|
const windowLevel = __importStar(require("./windowLevel"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4FAAoE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4FAAoE;AA+BlE,oCA/BK,mCAAyB,CA+BL;AA9B3B,0FAAkE;AA+BhE,mCA/BK,kCAAwB,CA+BL;AA9B1B,kEAA0C;AA+BxC,uBA/BK,sBAAY,CA+BL;AA9Bd,sDAA8B;AAiC5B,iBAjCK,gBAAM,CAiCL;AAhCR,4DAAoC;AAkClC,oBAlCK,mBAAS,CAkCL;AAjCX,kEAA0C;AAkCxC,uBAlCK,sBAAY,CAkCL;AAjCd,kEAA0C;AA4BxC,uBA5BK,sBAAY,CA4BL;AA3Bd,sHAA8F;AA4B5F,iDA5BK,gDAAsC,CA4BL;AA3BxC,wDAAgC;AAgC9B,kBAhCK,iBAAO,CAgCL;AA/BT,8DAAsC;AAgCpC,qBAhCK,oBAAU,CAgCL;AA/BZ,sFAA8D;AAiC5D,iCAjCK,gCAAsB,CAiCL;AAhCxB,0FAAkE;AA+BhE,mCA/BK,kCAAwB,CA+BL;AA9B1B,4EAAoD;AAiClD,4BAjCK,2BAAiB,CAiCL;AAhCnB,gGAAwE;AAiCtE,sCAjCK,qCAA2B,CAiCL;AAhC7B,kHAA0F;AAiCxF,+CAjCK,8CAAoC,CAiCL;AAhCtC,oFAA4D;AAiC1D,gCAjCK,+BAAqB,CAiCL;AAhCvB,oFAA4D;AAiC1D,gCAjCK,+BAAqB,CAiCL;AAhCvB,wHAAgG;AAiC9F,kDAjCK,iDAAuC,CAiCL;AAhCzC,kHAA0F;AAiCxF,+CAjCK,8CAAoC,CAiCL;AAhCtC,oFAA4D;AAiC1D,gCAjCK,+BAAqB,CAiCL;AAhCvB,oEAA4C;AAiC1C,wBAjCK,uBAAa,CAiCL;AAhCf,4EAAoD;AAiClD,4BAjCK,2BAAiB,CAiCL;AAhCnB,sEAA8C;AAiC5C,yBAjCK,wBAAc,CAiCL;AAhChB,8EAAsD;AAiCpD,6BAjCK,4BAAkB,CAiCL;AAhCpB,8EAAsD;AAiCpD,6BAjCK,4BAAkB,CAiCL;AA9BpB,iDAAmC;AAUjC,wBAAM;AATR,2DAA6C;AAgB3C,kCAAW"}
|
|
@@ -27,10 +27,11 @@ const metaData = __importStar(require("../metaData"));
|
|
|
27
27
|
const enums_1 = require("../enums");
|
|
28
28
|
const imageLoadPoolManager_1 = __importDefault(require("../requestPool/imageLoadPoolManager"));
|
|
29
29
|
const renderToCanvas_1 = __importDefault(require("./renderToCanvas"));
|
|
30
|
-
function loadImageToCanvas(canvas, imageId, requestType = enums_1.RequestType.
|
|
30
|
+
function loadImageToCanvas(canvas, imageId, requestType = enums_1.RequestType.Thumbnail, priority = -5) {
|
|
31
31
|
return new Promise((resolve, reject) => {
|
|
32
32
|
function successCallback(image, imageId) {
|
|
33
33
|
const { modality } = metaData.get('generalSeriesModule', imageId) || {};
|
|
34
|
+
image.isPreScaled = isImagePreScaled(image);
|
|
34
35
|
(0, renderToCanvas_1.default)(canvas, image, modality);
|
|
35
36
|
resolve(imageId);
|
|
36
37
|
}
|
|
@@ -63,9 +64,24 @@ function loadImageToCanvas(canvas, imageId, requestType = enums_1.RequestType.In
|
|
|
63
64
|
preScale: {
|
|
64
65
|
scalingParameters,
|
|
65
66
|
},
|
|
67
|
+
requestType,
|
|
66
68
|
};
|
|
67
69
|
imageLoadPoolManager_1.default.addRequest(sendRequest.bind(null, imageId, null, options), requestType, { imageId }, priority);
|
|
68
70
|
});
|
|
69
71
|
}
|
|
70
72
|
exports.default = loadImageToCanvas;
|
|
73
|
+
function isImagePreScaled(image) {
|
|
74
|
+
const { imageId } = image;
|
|
75
|
+
const modalityLutModule = metaData.get('modalityLutModule', imageId) || {};
|
|
76
|
+
const suvFactor = metaData.get('scalingModule', imageId) || {};
|
|
77
|
+
const generalSeriesModule = metaData.get('generalSeriesModule', imageId) || {};
|
|
78
|
+
if (modalityLutModule.rescaleSlope !== undefined &&
|
|
79
|
+
modalityLutModule.rescaleIntercept !== undefined) {
|
|
80
|
+
if (generalSeriesModule.modality === 'PT') {
|
|
81
|
+
return suvFactor.suvbw !== undefined;
|
|
82
|
+
}
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
71
87
|
//# sourceMappingURL=loadImageToCanvas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadImageToCanvas.js","sourceRoot":"","sources":["../../../src/utilities/loadImageToCanvas.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEA,gDAAmD;AACnD,sDAAwC;AACxC,oCAAuC;AACvC,+FAAuE;AACvE,sEAA8C;AAoB9C,SAAwB,iBAAiB,CACvC,MAAyB,EACzB,OAAe,EACf,WAAW,GAAG,mBAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"loadImageToCanvas.js","sourceRoot":"","sources":["../../../src/utilities/loadImageToCanvas.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEA,gDAAmD;AACnD,sDAAwC;AACxC,oCAAuC;AACvC,+FAAuE;AACvE,sEAA8C;AAoB9C,SAAwB,iBAAiB,CACvC,MAAyB,EACzB,OAAe,EACf,WAAW,GAAG,mBAAW,CAAC,SAAS,EACnC,QAAQ,GAAG,CAAC,CAAC;IAEb,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,SAAS,eAAe,CAAC,KAAa,EAAE,OAAe;YACrD,MAAM,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,qBAAqB,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;YAExE,KAAK,CAAC,WAAW,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;YAC5C,IAAA,wBAAc,EAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;YACxC,OAAO,CAAC,OAAO,CAAC,CAAC;QACnB,CAAC;QAED,SAAS,aAAa,CAAC,KAAY,EAAE,OAAe;YAClD,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAC9B,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC;QAED,SAAS,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO;YACjD,OAAO,IAAA,+BAAiB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAC7C,CAAC,KAAK,EAAE,EAAE;gBACR,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;YAC3D,CAAC,EACD,CAAC,KAAK,EAAE,EAAE;gBACR,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;YAC3C,CAAC,CACF,CAAC;QACJ,CAAC;QAED,MAAM,iBAAiB,GAAG,QAAQ,CAAC,GAAG,CAAC,mBAAmB,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;QAC3E,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;QAE/D,MAAM,mBAAmB,GACvB,QAAQ,CAAC,GAAG,CAAC,qBAAqB,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;QAErD,MAAM,iBAAiB,GAAG;YACxB,YAAY,EAAE,iBAAiB,CAAC,YAAY;YAC5C,gBAAgB,EAAE,iBAAiB,CAAC,gBAAgB;YACpD,QAAQ,EAAE,mBAAmB,CAAC,QAAQ;YACtC,KAAK,EAAE,SAAS,CAAC,KAAK;SACvB,CAAC;QAIF,MAAM,OAAO,GAAG;YACd,YAAY,EAAE;gBACZ,IAAI,EAAE,cAAc;gBACpB,MAAM,EAAE,IAAI;gBACZ,MAAM,EAAE,IAAI;aACb;YACD,QAAQ,EAAE;gBACR,iBAAiB;aAClB;YACD,WAAW;SACZ,CAAC;QAEF,8BAAoB,CAAC,UAAU,CAC7B,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,EAC9C,WAAW,EACX,EAAE,OAAO,EAAE,EACX,QAAQ,CACT,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAjED,oCAiEC;AAMD,SAAS,gBAAgB,CAAC,KAAK;IAC7B,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAE1B,MAAM,iBAAiB,GAAG,QAAQ,CAAC,GAAG,CAAC,mBAAmB,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;IAC3E,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;IAE/D,MAAM,mBAAmB,GACvB,QAAQ,CAAC,GAAG,CAAC,qBAAqB,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;IAErD,IACE,iBAAiB,CAAC,YAAY,KAAK,SAAS;QAC5C,iBAAiB,CAAC,gBAAgB,KAAK,SAAS,EAChD;QACA,IAAI,mBAAmB,CAAC,QAAQ,KAAK,IAAI,EAAE;YACzC,OAAO,SAAS,CAAC,KAAK,KAAK,SAAS,CAAC;SACtC;QAED,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -22,6 +22,7 @@ function prefetchStack(imageIds, requestType = enums_1.RequestType.Prefetch, pri
|
|
|
22
22
|
offset: null,
|
|
23
23
|
length: null,
|
|
24
24
|
},
|
|
25
|
+
requestType,
|
|
25
26
|
};
|
|
26
27
|
imageIds.forEach((imageId, imageIdIndex) => {
|
|
27
28
|
const modalityLutModule = __1.metaData.get('modalityLutModule', imageId) || {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefetchStack.js","sourceRoot":"","sources":["../../../src/utilities/prefetchStack.ts"],"names":[],"mappings":";;;;;AAAA,+FAAuE;AACvE,gDAAmD;AACnD,oCAAuC;AACvC,0BAA8B;AAW9B,SAAS,aAAa,CACpB,QAAkB,EAClB,WAAW,GAAG,mBAAW,CAAC,QAAQ,EAClC,QAAQ,GAAG,CAAC;IAEZ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QACzB,OAAO;KACR;IAED,SAAS,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO;QACjD,OAAO,IAAA,+BAAiB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAE7C,CAAC,KAAK,EAAE,EAAE,GAAE,CAAC,EACb,CAAC,KAAK,EAAE,EAAE;YACR,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CACF,CAAC;IACJ,CAAC;
|
|
1
|
+
{"version":3,"file":"prefetchStack.js","sourceRoot":"","sources":["../../../src/utilities/prefetchStack.ts"],"names":[],"mappings":";;;;;AAAA,+FAAuE;AACvE,gDAAmD;AACnD,oCAAuC;AACvC,0BAA8B;AAW9B,SAAS,aAAa,CACpB,QAAkB,EAClB,WAAW,GAAG,mBAAW,CAAC,QAAQ,EAClC,QAAQ,GAAG,CAAC;IAEZ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QACzB,OAAO;KACR;IAED,SAAS,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO;QACjD,OAAO,IAAA,+BAAiB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAE7C,CAAC,KAAK,EAAE,EAAE,GAAE,CAAC,EACb,CAAC,KAAK,EAAE,EAAE;YACR,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CACF,CAAC;IACJ,CAAC;IAID,MAAM,OAAO,GAAG;QACd,YAAY,EAAE;YACZ,IAAI,EAAE,cAAc;YACpB,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,IAAI;SACb;QACD,WAAW;KACZ,CAAC;IAEF,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE;QACzC,MAAM,iBAAiB,GAAG,YAAQ,CAAC,GAAG,CAAC,mBAAmB,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;QAC3E,MAAM,SAAS,GAAG,YAAQ,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;QAE/D,MAAM,mBAAmB,GACvB,YAAQ,CAAC,GAAG,CAAC,qBAAqB,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;QAErD,MAAM,iBAAiB,GAAG;YACxB,YAAY,EAAE,iBAAiB,CAAC,YAAY;YAC5C,gBAAgB,EAAE,iBAAiB,CAAC,gBAAgB;YACpD,QAAQ,EAAE,mBAAmB,CAAC,QAAQ;YACtC,KAAK,EAAE,SAAS,CAAC,KAAK;SACvB,CAAC;QAEF,MAAM,iBAAiB,GAAG,EAAE,OAAO,EAAE,CAAC;QACtC,MAAM,YAAY,mCACb,OAAO,KACV,QAAQ,EAAE;gBACR,iBAAiB;aAClB,GACF,CAAC;QAEF,8BAAoB,CAAC,UAAU,CAC7B,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,CAAC,EAC3D,WAAW,EACX,iBAAiB,EACjB,QAAQ,CACT,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,kBAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const gl_matrix_1 = require("gl-matrix");
|
|
4
|
+
const __1 = require("..");
|
|
5
|
+
function worldToImageCoords(imageId, worldCoords) {
|
|
6
|
+
const imagePlaneModule = __1.metaData.get('imagePlaneModule', imageId);
|
|
7
|
+
if (!imagePlaneModule) {
|
|
8
|
+
throw new Error(`No imagePlaneModule found for imageId: ${imageId}`);
|
|
9
|
+
}
|
|
10
|
+
const { columnCosines, columnPixelSpacing, rowCosines, rowPixelSpacing, imagePositionPatient: origin, rows, columns, } = imagePlaneModule;
|
|
11
|
+
const newOrigin = gl_matrix_1.vec3.create();
|
|
12
|
+
gl_matrix_1.vec3.scaleAndAdd(newOrigin, origin, columnCosines, -columnPixelSpacing / 2);
|
|
13
|
+
gl_matrix_1.vec3.scaleAndAdd(newOrigin, newOrigin, rowCosines, -rowPixelSpacing / 2);
|
|
14
|
+
const sub = gl_matrix_1.vec3.create();
|
|
15
|
+
gl_matrix_1.vec3.sub(sub, worldCoords, newOrigin);
|
|
16
|
+
const rowDistance = gl_matrix_1.vec3.dot(sub, rowCosines);
|
|
17
|
+
const columnDistance = gl_matrix_1.vec3.dot(sub, columnCosines);
|
|
18
|
+
const imageCoords = [
|
|
19
|
+
rowDistance / rowPixelSpacing,
|
|
20
|
+
columnDistance / columnPixelSpacing,
|
|
21
|
+
];
|
|
22
|
+
if (imageCoords[0] < 0 ||
|
|
23
|
+
imageCoords[0] >= columns ||
|
|
24
|
+
imageCoords[1] < 0 ||
|
|
25
|
+
imageCoords[1] >= rows) {
|
|
26
|
+
throw new Error(`The image coordinates are outside of the image, imageCoords: ${imageCoords}`);
|
|
27
|
+
}
|
|
28
|
+
return imageCoords;
|
|
29
|
+
}
|
|
30
|
+
exports.default = worldToImageCoords;
|
|
31
|
+
//# sourceMappingURL=worldToImageCoords.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worldToImageCoords.js","sourceRoot":"","sources":["../../../src/utilities/worldToImageCoords.ts"],"names":[],"mappings":";;AAAA,yCAAiC;AACjC,0BAA8B;AAa9B,SAAS,kBAAkB,CACzB,OAAe,EACf,WAAmB;IAEnB,MAAM,gBAAgB,GAAG,YAAQ,CAAC,GAAG,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IAEnE,IAAI,CAAC,gBAAgB,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,0CAA0C,OAAO,EAAE,CAAC,CAAC;KACtE;IAKD,MAAM,EACJ,aAAa,EACb,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,oBAAoB,EAAE,MAAM,EAC5B,IAAI,EACJ,OAAO,GACR,GAAG,gBAAgB,CAAC;IAKrB,MAAM,SAAS,GAAG,gBAAI,CAAC,MAAM,EAAE,CAAC;IAEhC,gBAAI,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,kBAAkB,GAAG,CAAC,CAAC,CAAC;IAC5E,gBAAI,CAAC,WAAW,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC;IAGzE,MAAM,GAAG,GAAG,gBAAI,CAAC,MAAM,EAAE,CAAC;IAC1B,gBAAI,CAAC,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IAGtC,MAAM,WAAW,GAAG,gBAAI,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAG9C,MAAM,cAAc,GAAG,gBAAI,CAAC,GAAG,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;IAEpD,MAAM,WAAW,GAAG;QAClB,WAAW,GAAG,eAAe;QAC7B,cAAc,GAAG,kBAAkB;KACpC,CAAC;IAEF,IACE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC;QAClB,WAAW,CAAC,CAAC,CAAC,IAAI,OAAO;QACzB,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC;QAClB,WAAW,CAAC,CAAC,CAAC,IAAI,IAAI,EACtB;QACA,MAAM,IAAI,KAAK,CACb,gEAAgE,WAAW,EAAE,CAC9E,CAAC;KACH;IAED,OAAO,WAAqB,CAAC;AAC/B,CAAC;AAED,kBAAe,kBAAkB,CAAC"}
|
|
@@ -8,12 +8,10 @@ declare class StackViewport extends Viewport implements IStackViewport {
|
|
|
8
8
|
private initialVOIRange;
|
|
9
9
|
private invert;
|
|
10
10
|
private interpolationType;
|
|
11
|
-
private rotation;
|
|
12
11
|
private _imageData;
|
|
13
12
|
private cameraPosOnRender;
|
|
14
13
|
private stackInvalidated;
|
|
15
14
|
private panCache;
|
|
16
|
-
private shouldFlip;
|
|
17
15
|
private voiApplied;
|
|
18
16
|
private rotationCache;
|
|
19
17
|
private _publishCalibratedEvent;
|
|
@@ -24,6 +22,7 @@ declare class StackViewport extends Viewport implements IStackViewport {
|
|
|
24
22
|
private cpuRenderingInvalidated;
|
|
25
23
|
modality: string;
|
|
26
24
|
scaling: Scaling;
|
|
25
|
+
private scalingCache;
|
|
27
26
|
constructor(props: ViewportInput);
|
|
28
27
|
static get useCustomRenderingPipeline(): boolean;
|
|
29
28
|
resize: () => void;
|
|
@@ -35,7 +34,7 @@ declare class StackViewport extends Viewport implements IStackViewport {
|
|
|
35
34
|
private createActorMapper;
|
|
36
35
|
private buildMetadata;
|
|
37
36
|
private calibrateIfNecessary;
|
|
38
|
-
setProperties({ voiRange, invert, interpolationType, rotation,
|
|
37
|
+
setProperties({ voiRange, invert, interpolationType, rotation, }?: StackViewportProperties): void;
|
|
39
38
|
getProperties: () => StackViewportProperties;
|
|
40
39
|
resetProperties(): void;
|
|
41
40
|
getCamera(): ICamera;
|
|
@@ -44,7 +43,6 @@ declare class StackViewport extends Viewport implements IStackViewport {
|
|
|
44
43
|
private _setPropertiesFromCache;
|
|
45
44
|
private getCameraCPU;
|
|
46
45
|
private setCameraCPU;
|
|
47
|
-
private setFlipDirection;
|
|
48
46
|
private setFlipCPU;
|
|
49
47
|
private setVOI;
|
|
50
48
|
private setRotation;
|
|
@@ -66,9 +64,10 @@ declare class StackViewport extends Viewport implements IStackViewport {
|
|
|
66
64
|
setStack(imageIds: Array<string>, currentImageIdIndex?: number): Promise<string>;
|
|
67
65
|
private _checkVTKImageDataMatchesCornerstoneImage;
|
|
68
66
|
private _updateVTKImageDataFromCornerstoneImage;
|
|
69
|
-
private
|
|
70
|
-
private
|
|
71
|
-
private
|
|
67
|
+
private _loadAndDisplayImage;
|
|
68
|
+
private _loadAndDisplayImageCPU;
|
|
69
|
+
private _loadAndDisplayImageGPU;
|
|
70
|
+
isImagePreScaled(imageId: string): boolean;
|
|
72
71
|
private _updateActorToDisplayImageId;
|
|
73
72
|
private _setImageIdIndex;
|
|
74
73
|
resetCamera(resetPan?: boolean, resetZoom?: boolean): boolean;
|
|
@@ -4,7 +4,7 @@ import vtkVolume from '@kitware/vtk.js/Rendering/Core/Volume';
|
|
|
4
4
|
import vtkVolumeMapper from '@kitware/vtk.js/Rendering/Core/VolumeMapper';
|
|
5
5
|
import _cloneDeep from 'lodash.clonedeep';
|
|
6
6
|
import vtkCamera from '@kitware/vtk.js/Rendering/Core/Camera';
|
|
7
|
-
import { vec2, vec3 } from 'gl-matrix';
|
|
7
|
+
import { vec2, vec3, mat4 } from 'gl-matrix';
|
|
8
8
|
import * as metaData from '../metaData';
|
|
9
9
|
import Viewport from './Viewport';
|
|
10
10
|
import eventTarget from '../eventTarget';
|
|
@@ -29,12 +29,11 @@ class StackViewport extends Viewport {
|
|
|
29
29
|
constructor(props) {
|
|
30
30
|
super(props);
|
|
31
31
|
this.invert = false;
|
|
32
|
-
this.rotation = 0;
|
|
33
32
|
this.stackInvalidated = false;
|
|
34
|
-
this.shouldFlip = false;
|
|
35
33
|
this.voiApplied = false;
|
|
36
34
|
this.rotationCache = 0;
|
|
37
35
|
this._publishCalibratedEvent = false;
|
|
36
|
+
this.scalingCache = {};
|
|
38
37
|
this.resize = () => {
|
|
39
38
|
if (this.useCPURendering) {
|
|
40
39
|
this._resizeCPU();
|
|
@@ -80,8 +79,6 @@ class StackViewport extends Viewport {
|
|
|
80
79
|
rotation: this.rotationCache,
|
|
81
80
|
interpolationType: this.interpolationType,
|
|
82
81
|
invert: this.invert,
|
|
83
|
-
flipHorizontal: this.flipHorizontal,
|
|
84
|
-
flipVertical: this.flipVertical,
|
|
85
82
|
};
|
|
86
83
|
};
|
|
87
84
|
this.canvasToWorld = (canvasPos) => {
|
|
@@ -352,7 +349,7 @@ class StackViewport extends Viewport {
|
|
|
352
349
|
};
|
|
353
350
|
return imagePlaneModule;
|
|
354
351
|
}
|
|
355
|
-
setProperties({ voiRange, invert, interpolationType, rotation,
|
|
352
|
+
setProperties({ voiRange, invert, interpolationType, rotation, } = {}) {
|
|
356
353
|
if (typeof voiRange !== 'undefined' || !this.voiApplied) {
|
|
357
354
|
this.setVOI(voiRange);
|
|
358
355
|
}
|
|
@@ -367,10 +364,6 @@ class StackViewport extends Viewport {
|
|
|
367
364
|
this.setRotation(this.rotationCache, rotation);
|
|
368
365
|
}
|
|
369
366
|
}
|
|
370
|
-
if (typeof flipHorizontal !== 'undefined' ||
|
|
371
|
-
typeof flipVertical !== 'undefined') {
|
|
372
|
-
this.setFlipDirection({ flipHorizontal, flipVertical });
|
|
373
|
-
}
|
|
374
367
|
}
|
|
375
368
|
resetProperties() {
|
|
376
369
|
this.cpuRenderingInvalidated = true;
|
|
@@ -404,8 +397,6 @@ class StackViewport extends Viewport {
|
|
|
404
397
|
rotation: 0,
|
|
405
398
|
interpolationType: InterpolationType.LINEAR,
|
|
406
399
|
invert: false,
|
|
407
|
-
flipHorizontal: false,
|
|
408
|
-
flipVertical: false,
|
|
409
400
|
});
|
|
410
401
|
}
|
|
411
402
|
_setPropertiesFromCache() {
|
|
@@ -414,15 +405,17 @@ class StackViewport extends Viewport {
|
|
|
414
405
|
rotation: this.rotation,
|
|
415
406
|
interpolationType: this.interpolationType,
|
|
416
407
|
invert: this.invert,
|
|
417
|
-
flipHorizontal: this.flipHorizontal,
|
|
418
|
-
flipVertical: this.flipVertical,
|
|
419
408
|
});
|
|
420
409
|
}
|
|
421
410
|
getCameraCPU() {
|
|
422
411
|
const { metadata, viewport } = this._cpuFallbackEnabledElement;
|
|
423
412
|
const { direction } = metadata;
|
|
424
413
|
const viewPlaneNormal = direction.slice(6, 9).map((x) => -x);
|
|
425
|
-
|
|
414
|
+
let viewUp = direction.slice(3, 6).map((x) => -x);
|
|
415
|
+
if (this.rotation) {
|
|
416
|
+
const rotationMatrix = mat4.fromRotation(mat4.create(), (this.rotation * Math.PI) / 180, viewPlaneNormal);
|
|
417
|
+
viewUp = vec3.transformMat4(vec3.create(), viewUp, rotationMatrix);
|
|
418
|
+
}
|
|
426
419
|
return {
|
|
427
420
|
parallelProjection: true,
|
|
428
421
|
focalPoint: [0, 0, 0],
|
|
@@ -439,7 +432,7 @@ class StackViewport extends Viewport {
|
|
|
439
432
|
setCameraCPU(cameraInterface) {
|
|
440
433
|
const { viewport } = this._cpuFallbackEnabledElement;
|
|
441
434
|
const previousCamera = this.getCameraCPU();
|
|
442
|
-
const { focalPoint, viewUp, parallelScale } = cameraInterface;
|
|
435
|
+
const { focalPoint, viewUp, parallelScale, flipHorizontal, flipVertical } = cameraInterface;
|
|
443
436
|
if (focalPoint) {
|
|
444
437
|
const focalPointCanvas = this.worldToCanvasCPU(cameraInterface.focalPoint);
|
|
445
438
|
const previousFocalPointCanvas = this.worldToCanvasCPU(previousCamera.focalPoint);
|
|
@@ -452,11 +445,16 @@ class StackViewport extends Viewport {
|
|
|
452
445
|
const diff = previousCamera.parallelScale - parallelScale;
|
|
453
446
|
viewport.scale += diff;
|
|
454
447
|
}
|
|
448
|
+
if (flipHorizontal || flipVertical) {
|
|
449
|
+
this.setFlipCPU({ flipHorizontal, flipVertical });
|
|
450
|
+
}
|
|
455
451
|
const updatedCamera = {
|
|
456
452
|
...previousCamera,
|
|
457
453
|
focalPoint,
|
|
458
454
|
viewUp,
|
|
459
455
|
parallelScale,
|
|
456
|
+
flipHorizontal,
|
|
457
|
+
flipVertical,
|
|
460
458
|
};
|
|
461
459
|
const eventDetail = {
|
|
462
460
|
previousCamera,
|
|
@@ -464,18 +462,10 @@ class StackViewport extends Viewport {
|
|
|
464
462
|
element: this.element,
|
|
465
463
|
viewportId: this.id,
|
|
466
464
|
renderingEngineId: this.renderingEngineId,
|
|
465
|
+
rotation: this.rotation,
|
|
467
466
|
};
|
|
468
467
|
triggerEvent(this.element, Events.CAMERA_MODIFIED, eventDetail);
|
|
469
468
|
}
|
|
470
|
-
setFlipDirection(flipDirection) {
|
|
471
|
-
if (this.useCPURendering) {
|
|
472
|
-
this.setFlipCPU(flipDirection);
|
|
473
|
-
}
|
|
474
|
-
else {
|
|
475
|
-
super.flip(flipDirection);
|
|
476
|
-
}
|
|
477
|
-
this.shouldFlip = false;
|
|
478
|
-
}
|
|
479
469
|
setFlipCPU({ flipHorizontal, flipVertical }) {
|
|
480
470
|
const { viewport } = this._cpuFallbackEnabledElement;
|
|
481
471
|
viewport.hflip = flipHorizontal;
|
|
@@ -491,11 +481,23 @@ class StackViewport extends Viewport {
|
|
|
491
481
|
this.setVOIGPU(voiRange);
|
|
492
482
|
}
|
|
493
483
|
setRotation(rotationCache, rotation) {
|
|
484
|
+
const previousCamera = this.getCamera();
|
|
494
485
|
if (this.useCPURendering) {
|
|
495
486
|
this.setRotationCPU(rotationCache, rotation);
|
|
496
|
-
return;
|
|
497
487
|
}
|
|
498
|
-
|
|
488
|
+
else {
|
|
489
|
+
this.setRotationGPU(rotationCache, rotation);
|
|
490
|
+
}
|
|
491
|
+
const camera = this.getCamera();
|
|
492
|
+
const eventDetail = {
|
|
493
|
+
previousCamera,
|
|
494
|
+
camera,
|
|
495
|
+
element: this.element,
|
|
496
|
+
viewportId: this.id,
|
|
497
|
+
renderingEngineId: this.renderingEngineId,
|
|
498
|
+
rotation: this.rotation,
|
|
499
|
+
};
|
|
500
|
+
triggerEvent(this.element, Events.CAMERA_MODIFIED, eventDetail);
|
|
499
501
|
}
|
|
500
502
|
setInterpolationType(interpolationType) {
|
|
501
503
|
if (this.useCPURendering) {
|
|
@@ -665,7 +667,7 @@ class StackViewport extends Viewport {
|
|
|
665
667
|
const ySpacing = imagePlaneModule.rowPixelSpacing || image.rowPixelSpacing;
|
|
666
668
|
const xVoxels = image.columns;
|
|
667
669
|
const yVoxels = image.rows;
|
|
668
|
-
const zSpacing =
|
|
670
|
+
const zSpacing = EPSILON;
|
|
669
671
|
const zVoxels = 1;
|
|
670
672
|
const numComps = image.numComps ||
|
|
671
673
|
this._getNumCompsFromPhotometricInterpretation(imagePixelModule.photometricInterpretation);
|
|
@@ -728,6 +730,7 @@ class StackViewport extends Viewport {
|
|
|
728
730
|
this.imageIds = imageIds;
|
|
729
731
|
this.currentImageIdIndex = currentImageIdIndex;
|
|
730
732
|
this.stackInvalidated = true;
|
|
733
|
+
this.scalingCache = {};
|
|
731
734
|
this.rotationCache = 0;
|
|
732
735
|
this.flipVertical = false;
|
|
733
736
|
this.flipHorizontal = false;
|
|
@@ -785,16 +788,16 @@ class StackViewport extends Viewport {
|
|
|
785
788
|
}
|
|
786
789
|
this._imageData.modified();
|
|
787
790
|
}
|
|
788
|
-
async
|
|
791
|
+
async _loadAndDisplayImage(imageId, imageIdIndex) {
|
|
789
792
|
if (this.useCPURendering) {
|
|
790
|
-
await this.
|
|
793
|
+
await this._loadAndDisplayImageCPU(imageId, imageIdIndex);
|
|
791
794
|
}
|
|
792
795
|
else {
|
|
793
|
-
await this.
|
|
796
|
+
await this._loadAndDisplayImageGPU(imageId, imageIdIndex);
|
|
794
797
|
}
|
|
795
798
|
return imageId;
|
|
796
799
|
}
|
|
797
|
-
|
|
800
|
+
_loadAndDisplayImageCPU(imageId, imageIdIndex) {
|
|
798
801
|
return new Promise((resolve, reject) => {
|
|
799
802
|
function successCallback(image, imageIdIndex, imageId) {
|
|
800
803
|
if (this.currentImageIdIndex !== imageIdIndex) {
|
|
@@ -808,6 +811,7 @@ class StackViewport extends Viewport {
|
|
|
808
811
|
};
|
|
809
812
|
triggerEvent(this.element, Events.STACK_NEW_IMAGE, eventDetail);
|
|
810
813
|
const metadata = this._getImageDataMetadata(image);
|
|
814
|
+
image.isPreScaled = this.isImagePreScaled(imageId);
|
|
811
815
|
const viewport = getDefaultViewport(this.canvas, image, this.modality, this._cpuFallbackEnabledElement.viewport.colormap);
|
|
812
816
|
this._cpuFallbackEnabledElement.image = image;
|
|
813
817
|
this._cpuFallbackEnabledElement.metadata = {
|
|
@@ -852,6 +856,7 @@ class StackViewport extends Viewport {
|
|
|
852
856
|
modality: generalSeriesModule.modality,
|
|
853
857
|
suvbw: suvFactor.suvbw,
|
|
854
858
|
};
|
|
859
|
+
this.scalingCache[imageId] = scalingParameters;
|
|
855
860
|
const type = 'Float32Array';
|
|
856
861
|
const priority = -5;
|
|
857
862
|
const requestType = RequestType.Interaction;
|
|
@@ -869,7 +874,7 @@ class StackViewport extends Viewport {
|
|
|
869
874
|
imageLoadPoolManager.addRequest(sendRequest.bind(this, imageId, imageIdIndex, options), requestType, additionalDetails, priority);
|
|
870
875
|
});
|
|
871
876
|
}
|
|
872
|
-
|
|
877
|
+
_loadAndDisplayImageGPU(imageId, imageIdIndex) {
|
|
873
878
|
return new Promise((resolve, reject) => {
|
|
874
879
|
function successCallback(image, imageIdIndex, imageId) {
|
|
875
880
|
if (this.currentImageIdIndex !== imageIdIndex) {
|
|
@@ -912,6 +917,7 @@ class StackViewport extends Viewport {
|
|
|
912
917
|
modality: generalSeriesModule.modality,
|
|
913
918
|
suvbw: suvFactor.suvbw,
|
|
914
919
|
};
|
|
920
|
+
this.scalingCache[imageId] = scalingParameters;
|
|
915
921
|
const type = 'Float32Array';
|
|
916
922
|
const priority = -5;
|
|
917
923
|
const requestType = RequestType.Interaction;
|
|
@@ -926,9 +932,29 @@ class StackViewport extends Viewport {
|
|
|
926
932
|
scalingParameters,
|
|
927
933
|
},
|
|
928
934
|
};
|
|
935
|
+
const eventDetail = {
|
|
936
|
+
imageId,
|
|
937
|
+
viewportId: this.id,
|
|
938
|
+
renderingEngineId: this.renderingEngineId,
|
|
939
|
+
};
|
|
940
|
+
triggerEvent(this.element, Events.PRE_STACK_NEW_IMAGE, eventDetail);
|
|
929
941
|
imageLoadPoolManager.addRequest(sendRequest.bind(this, imageId, imageIdIndex, options), requestType, additionalDetails, priority);
|
|
930
942
|
});
|
|
931
943
|
}
|
|
944
|
+
isImagePreScaled(imageId) {
|
|
945
|
+
const scalingParameters = this.scalingCache[imageId];
|
|
946
|
+
if (!scalingParameters) {
|
|
947
|
+
return false;
|
|
948
|
+
}
|
|
949
|
+
const { modality, rescaleIntercept, rescaleSlope, suvbw } = scalingParameters;
|
|
950
|
+
if (rescaleSlope !== undefined && rescaleIntercept !== undefined) {
|
|
951
|
+
if (modality === 'PT') {
|
|
952
|
+
return suvbw !== undefined;
|
|
953
|
+
}
|
|
954
|
+
return true;
|
|
955
|
+
}
|
|
956
|
+
return false;
|
|
957
|
+
}
|
|
932
958
|
_updateActorToDisplayImageId(image) {
|
|
933
959
|
const sameImageData = this._checkVTKImageDataMatchesCornerstoneImage(image, this._imageData);
|
|
934
960
|
const activeCamera = this.getRenderer().getActiveCamera();
|
|
@@ -970,9 +996,13 @@ class StackViewport extends Viewport {
|
|
|
970
996
|
this.triggerCameraEvent(this.getCamera(), previousCameraProps);
|
|
971
997
|
activeCamera.setFreezeFocalPoint(true);
|
|
972
998
|
const { windowCenter, windowWidth } = imagePixelModule;
|
|
973
|
-
|
|
999
|
+
let voiRange = typeof windowCenter === 'number' && typeof windowWidth === 'number'
|
|
974
1000
|
? windowLevelUtil.toLowHighRange(windowWidth, windowCenter)
|
|
975
1001
|
: undefined;
|
|
1002
|
+
const isPreScaled = this.isImagePreScaled(image.imageId);
|
|
1003
|
+
if (imagePixelModule.modality === 'PT' && isPreScaled) {
|
|
1004
|
+
voiRange = { lower: 0, upper: 5 };
|
|
1005
|
+
}
|
|
976
1006
|
this.initialVOIRange = voiRange;
|
|
977
1007
|
this.setProperties({ voiRange });
|
|
978
1008
|
const { position } = this.getCamera();
|
|
@@ -987,7 +1017,7 @@ class StackViewport extends Viewport {
|
|
|
987
1017
|
throw new Error(`ImageIdIndex provided ${imageIdIndex} is invalid, the stack only has ${this.imageIds.length} elements`);
|
|
988
1018
|
}
|
|
989
1019
|
this.currentImageIdIndex = imageIdIndex;
|
|
990
|
-
const imageId = await this.
|
|
1020
|
+
const imageId = await this._loadAndDisplayImage(this.imageIds[imageIdIndex], imageIdIndex);
|
|
991
1021
|
return imageId;
|
|
992
1022
|
}
|
|
993
1023
|
resetCamera(resetPan = true, resetZoom = true) {
|
|
@@ -997,6 +1027,8 @@ class StackViewport extends Viewport {
|
|
|
997
1027
|
else {
|
|
998
1028
|
this.resetCameraGPU(resetPan, resetZoom);
|
|
999
1029
|
}
|
|
1030
|
+
this.rotation = 0;
|
|
1031
|
+
this.rotationCache = 0;
|
|
1000
1032
|
return true;
|
|
1001
1033
|
}
|
|
1002
1034
|
resetCameraCPU(resetPan, resetZoom) {
|
|
@@ -1019,7 +1051,7 @@ class StackViewport extends Viewport {
|
|
|
1019
1051
|
calibrateSpacing(imageId) {
|
|
1020
1052
|
const imageIdIndex = this.getImageIds().indexOf(imageId);
|
|
1021
1053
|
this.stackInvalidated = true;
|
|
1022
|
-
this.
|
|
1054
|
+
this._loadAndDisplayImage(imageId, imageIdIndex);
|
|
1023
1055
|
}
|
|
1024
1056
|
_restoreCameraProps({ parallelScale: prevScale }, previousCamera) {
|
|
1025
1057
|
const renderer = this.getRenderer();
|