@cornerstonejs/core 0.42.0 → 0.42.2
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/RenderingEngine.js +8 -0
- package/dist/cjs/RenderingEngine/RenderingEngine.js.map +1 -1
- package/dist/cjs/RenderingEngine/StackViewport.js +2 -2
- package/dist/cjs/RenderingEngine/StackViewport.js.map +1 -1
- package/dist/esm/RenderingEngine/RenderingEngine.js +8 -0
- package/dist/esm/RenderingEngine/RenderingEngine.js.map +1 -1
- package/dist/esm/RenderingEngine/StackViewport.js +2 -2
- package/dist/esm/RenderingEngine/StackViewport.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +2 -2
- package/src/RenderingEngine/RenderingEngine.ts +14 -0
- package/src/RenderingEngine/StackViewport.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/core",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/umd/index.js",
|
|
6
6
|
"types": "dist/esm/index.d.ts",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"type": "individual",
|
|
52
52
|
"url": "https://ohif.org/donate"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "d0aedd7f51d2f9e8a5cda8411862190b1cbda90f"
|
|
55
55
|
}
|
|
@@ -34,6 +34,9 @@ type ViewportDisplayCoords = {
|
|
|
34
34
|
sHeight: number;
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
// Rendering engines seem to not like rendering things less than 2 pixels per side
|
|
38
|
+
const VIEWPORT_MIN_SIZE = 2;
|
|
39
|
+
|
|
37
40
|
/**
|
|
38
41
|
* A RenderingEngine takes care of the full pipeline of creating viewports and rendering
|
|
39
42
|
* them on a large offscreen canvas and transmitting this data back to the screen. This allows us
|
|
@@ -1116,6 +1119,8 @@ class RenderingEngine implements IRenderingEngine {
|
|
|
1116
1119
|
this._animationFrameHandle = null;
|
|
1117
1120
|
|
|
1118
1121
|
eventDetailArray.forEach((eventDetail) => {
|
|
1122
|
+
// Very small viewports won't have an element
|
|
1123
|
+
if (!eventDetail?.element) return;
|
|
1119
1124
|
triggerEvent(eventDetail.element, Events.IMAGE_RENDERED, eventDetail);
|
|
1120
1125
|
});
|
|
1121
1126
|
};
|
|
@@ -1166,6 +1171,15 @@ class RenderingEngine implements IRenderingEngine {
|
|
|
1166
1171
|
): EventTypes.ImageRenderedEventDetail[] {
|
|
1167
1172
|
let eventDetail;
|
|
1168
1173
|
|
|
1174
|
+
// Rendering engines start having issues without at least two pixels
|
|
1175
|
+
// in each direction
|
|
1176
|
+
if (
|
|
1177
|
+
viewport.sWidth < VIEWPORT_MIN_SIZE ||
|
|
1178
|
+
viewport.sHeight < VIEWPORT_MIN_SIZE
|
|
1179
|
+
) {
|
|
1180
|
+
console.log('Viewport is too small', viewport.sWidth, viewport.sHeight);
|
|
1181
|
+
return;
|
|
1182
|
+
}
|
|
1169
1183
|
if (viewportTypeUsesCustomRenderingPipeline(viewport.type) === true) {
|
|
1170
1184
|
eventDetail =
|
|
1171
1185
|
viewport.customRenderViewportToCanvas() as EventTypes.ImageRenderedEventDetail;
|
|
@@ -1537,8 +1537,8 @@ class StackViewport extends Viewport implements IStackViewport {
|
|
|
1537
1537
|
const dataType = imageData.getPointData().getScalars().getDataType();
|
|
1538
1538
|
|
|
1539
1539
|
// using epsilon comparison for float numbers comparison.
|
|
1540
|
-
const isSameXSpacing = isEqual(xSpacing, image.
|
|
1541
|
-
const isSameYSpacing = isEqual(ySpacing, image.
|
|
1540
|
+
const isSameXSpacing = isEqual(xSpacing, image.columnPixelSpacing);
|
|
1541
|
+
const isSameYSpacing = isEqual(ySpacing, image.rowPixelSpacing);
|
|
1542
1542
|
|
|
1543
1543
|
// using spacing, size, and direction only for now
|
|
1544
1544
|
return (
|