@cornerstonejs/core 1.37.0 → 1.38.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.js +3 -0
- package/dist/cjs/RenderingEngine/StackViewport.js.map +1 -1
- package/dist/cjs/RenderingEngine/Viewport.d.ts +1 -0
- package/dist/cjs/RenderingEngine/Viewport.js +14 -8
- package/dist/cjs/RenderingEngine/Viewport.js.map +1 -1
- package/dist/esm/RenderingEngine/StackViewport.js +3 -0
- package/dist/esm/RenderingEngine/StackViewport.js.map +1 -1
- package/dist/esm/RenderingEngine/Viewport.js +14 -8
- package/dist/esm/RenderingEngine/Viewport.js.map +1 -1
- package/dist/types/RenderingEngine/StackViewport.d.ts.map +1 -1
- package/dist/types/RenderingEngine/Viewport.d.ts +1 -0
- package/dist/types/RenderingEngine/Viewport.d.ts.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/StackViewport.ts +3 -0
- package/src/RenderingEngine/Viewport.ts +19 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.38.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"type": "individual",
|
|
48
48
|
"url": "https://ohif.org/donate"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "0d0fc07429f1802570946b015a1f2e913be7ac98"
|
|
51
51
|
}
|
|
@@ -1193,6 +1193,8 @@ class StackViewport extends Viewport implements IStackViewport, IImagesLoader {
|
|
|
1193
1193
|
}
|
|
1194
1194
|
|
|
1195
1195
|
private setRotationGPU(rotation: number): void {
|
|
1196
|
+
const pan = this.getPan();
|
|
1197
|
+
this.setPan([0, 0]);
|
|
1196
1198
|
const { flipVertical } = this.getCamera();
|
|
1197
1199
|
|
|
1198
1200
|
// Moving back to zero rotation, for new scrolled slice rotation is 0 after camera reset
|
|
@@ -1206,6 +1208,7 @@ class StackViewport extends Viewport implements IStackViewport, IImagesLoader {
|
|
|
1206
1208
|
|
|
1207
1209
|
// rotating camera to the new value
|
|
1208
1210
|
this.getVtkActiveCamera().roll(-rotation);
|
|
1211
|
+
this.setPan(pan);
|
|
1209
1212
|
}
|
|
1210
1213
|
|
|
1211
1214
|
private setInterpolationTypeGPU(interpolationType: InterpolationType): void {
|
|
@@ -55,6 +55,11 @@ class Viewport implements IViewport {
|
|
|
55
55
|
readonly renderingEngineId: string;
|
|
56
56
|
/** Type of viewport */
|
|
57
57
|
readonly type: ViewportType;
|
|
58
|
+
/**
|
|
59
|
+
* The amount by which the images are inset in a viewport by default.
|
|
60
|
+
*/
|
|
61
|
+
protected insetImageMultiplier = 1.1;
|
|
62
|
+
|
|
58
63
|
protected flipHorizontal = false;
|
|
59
64
|
protected flipVertical = false;
|
|
60
65
|
public isDisabled: boolean;
|
|
@@ -584,14 +589,15 @@ class Viewport implements IViewport {
|
|
|
584
589
|
const { storeAsInitialCamera } = displayArea;
|
|
585
590
|
|
|
586
591
|
// make calculations relative to the fitToCanvasCamera view
|
|
587
|
-
this.setCamera(this.fitToCanvasCamera,
|
|
592
|
+
this.setCamera(this.fitToCanvasCamera, storeAsInitialCamera);
|
|
588
593
|
|
|
589
594
|
const { imageArea, imageCanvasPoint } = displayArea;
|
|
590
595
|
|
|
596
|
+
let zoom = 1;
|
|
591
597
|
if (imageArea) {
|
|
592
598
|
const [areaX, areaY] = imageArea;
|
|
593
|
-
|
|
594
|
-
this.setZoom(zoom, storeAsInitialCamera);
|
|
599
|
+
zoom = Math.min(this.getZoom() / areaX, this.getZoom() / areaY);
|
|
600
|
+
this.setZoom(this.insetImageMultiplier * zoom, storeAsInitialCamera);
|
|
595
601
|
}
|
|
596
602
|
|
|
597
603
|
// getting the image info
|
|
@@ -604,18 +610,22 @@ class Viewport implements IViewport {
|
|
|
604
610
|
const validateCanvasPanY = this.sHeight / devicePixelRatio;
|
|
605
611
|
const canvasPanX = validateCanvasPanX * (canvasX - 0.5);
|
|
606
612
|
const canvasPanY = validateCanvasPanY * (canvasY - 0.5);
|
|
607
|
-
|
|
608
613
|
const dimensions = imageData.getDimensions();
|
|
609
614
|
const canvasZero = this.worldToCanvas([0, 0, 0]);
|
|
610
|
-
const canvasEdge = this.worldToCanvas(
|
|
615
|
+
const canvasEdge = this.worldToCanvas([
|
|
616
|
+
dimensions[0] - 1,
|
|
617
|
+
dimensions[1] - 1,
|
|
618
|
+
dimensions[2],
|
|
619
|
+
]);
|
|
611
620
|
const canvasImage = [
|
|
612
621
|
canvasEdge[0] - canvasZero[0],
|
|
613
622
|
canvasEdge[1] - canvasZero[1],
|
|
614
623
|
];
|
|
615
624
|
const [imgWidth, imgHeight] = canvasImage;
|
|
616
625
|
const [imageX, imageY] = imagePoint;
|
|
617
|
-
const imagePanX =
|
|
618
|
-
|
|
626
|
+
const imagePanX =
|
|
627
|
+
(zoom * imgWidth * (0.5 - imageX) * validateCanvasPanY) / imgHeight;
|
|
628
|
+
const imagePanY = zoom * validateCanvasPanY * (0.5 - imageY);
|
|
619
629
|
|
|
620
630
|
const newPositionX = imagePanX + canvasPanX;
|
|
621
631
|
const newPositionY = imagePanY + canvasPanY;
|
|
@@ -727,7 +737,7 @@ class Viewport implements IViewport {
|
|
|
727
737
|
}
|
|
728
738
|
|
|
729
739
|
//const angle = vtkMath.radiansFromDegrees(activeCamera.getViewAngle())
|
|
730
|
-
const parallelScale =
|
|
740
|
+
const parallelScale = this.insetImageMultiplier * radius;
|
|
731
741
|
|
|
732
742
|
let w1 = bounds[1] - bounds[0];
|
|
733
743
|
let w2 = bounds[3] - bounds[2];
|
|
@@ -743,7 +753,7 @@ class Viewport implements IViewport {
|
|
|
743
753
|
// compute the radius of the enclosing sphere
|
|
744
754
|
radius = Math.sqrt(radius) * 0.5;
|
|
745
755
|
|
|
746
|
-
const distance =
|
|
756
|
+
const distance = this.insetImageMultiplier * radius;
|
|
747
757
|
|
|
748
758
|
const viewUpToSet: Point3 =
|
|
749
759
|
Math.abs(vtkMath.dot(viewUp, viewPlaneNormal)) > 0.999
|