@cornerstonejs/core 3.7.16 → 3.7.17
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/esm/RenderingEngine/BaseVolumeViewport.d.ts +1 -0
- package/dist/esm/RenderingEngine/BaseVolumeViewport.js +15 -2
- package/dist/esm/RenderingEngine/StackViewport.d.ts +1 -0
- package/dist/esm/RenderingEngine/StackViewport.js +3 -0
- package/dist/esm/RenderingEngine/VolumeViewport.d.ts +1 -0
- package/dist/esm/RenderingEngine/VolumeViewport.js +11 -0
- package/dist/esm/RenderingEngine/VolumeViewport3D.d.ts +1 -0
- package/dist/esm/RenderingEngine/VolumeViewport3D.js +3 -0
- package/package.json +2 -2
|
@@ -41,6 +41,7 @@ declare abstract class BaseVolumeViewport extends Viewport {
|
|
|
41
41
|
getViewReference(viewRefSpecifier?: ViewReferenceSpecifier): ViewReference;
|
|
42
42
|
isReferenceViewable(viewRef: ViewReference, options?: ReferenceCompatibleOptions): boolean;
|
|
43
43
|
scroll(delta?: number): void;
|
|
44
|
+
abstract isInAcquisitionPlane(): boolean;
|
|
44
45
|
setViewReference(viewRef: ViewReference): void;
|
|
45
46
|
setProperties({ voiRange, VOILUTFunction, invert, colormap, preset, interpolationType, slabThickness, }?: VolumeViewportProperties, volumeId?: string, suppressEvents?: boolean): void;
|
|
46
47
|
resetToDefaultProperties(volumeId: string): void;
|
|
@@ -4,7 +4,7 @@ import vtkPiecewiseFunction from '@kitware/vtk.js/Common/DataModel/PiecewiseFunc
|
|
|
4
4
|
import { vec2, vec3 } from 'gl-matrix';
|
|
5
5
|
import cache from '../cache/cache';
|
|
6
6
|
import { MPR_CAMERA_VALUES, RENDERING_DEFAULTS, VIEWPORT_PRESETS, } from '../constants';
|
|
7
|
-
import { Events, ViewportStatus, VOILUTFunctionType } from '../enums';
|
|
7
|
+
import { Events, MetadataModules, ViewportStatus, VOILUTFunctionType, } from '../enums';
|
|
8
8
|
import ViewportType from '../enums/ViewportType';
|
|
9
9
|
import eventTarget from '../eventTarget';
|
|
10
10
|
import { getShouldUseCPURendering } from '../init';
|
|
@@ -27,6 +27,7 @@ import isEqual, { isEqualNegative } from '../utilities/isEqual';
|
|
|
27
27
|
import applyPreset from '../utilities/applyPreset';
|
|
28
28
|
import imageIdToURI from '../utilities/imageIdToURI';
|
|
29
29
|
import uuidv4 from '../utilities/uuidv4';
|
|
30
|
+
import * as metaData from '../metaData';
|
|
30
31
|
class BaseVolumeViewport extends Viewport {
|
|
31
32
|
constructor(props) {
|
|
32
33
|
super(props);
|
|
@@ -526,7 +527,7 @@ class BaseVolumeViewport extends Viewport {
|
|
|
526
527
|
return;
|
|
527
528
|
}
|
|
528
529
|
const volumeId = this.getVolumeId();
|
|
529
|
-
const { viewPlaneNormal: refViewPlaneNormal, FrameOfReferenceUID: refFrameOfReference, cameraFocalPoint, viewUp, } = viewRef;
|
|
530
|
+
const { viewPlaneNormal: refViewPlaneNormal, FrameOfReferenceUID: refFrameOfReference, cameraFocalPoint, referencedImageId, viewUp, } = viewRef;
|
|
530
531
|
let { sliceIndex } = viewRef;
|
|
531
532
|
const { focalPoint, viewPlaneNormal, position } = this.getCamera();
|
|
532
533
|
const isNegativeNormal = isEqualNegative(viewPlaneNormal, refViewPlaneNormal);
|
|
@@ -560,6 +561,18 @@ class BaseVolumeViewport extends Viewport {
|
|
|
560
561
|
const newPosition = vec3.add([0, 0, 0], position, focalDelta);
|
|
561
562
|
this.setCamera({ focalPoint: newFocal, position: newPosition });
|
|
562
563
|
}
|
|
564
|
+
if (referencedImageId && this.isInAcquisitionPlane()) {
|
|
565
|
+
const imagePlaneModule = metaData.get(MetadataModules.IMAGE_PLANE, referencedImageId);
|
|
566
|
+
const { imagePositionPatient } = imagePlaneModule;
|
|
567
|
+
const { focalPoint } = this.getCamera();
|
|
568
|
+
const diffVector = vec3.subtract(vec3.create(), focalPoint, imagePositionPatient);
|
|
569
|
+
const projectedDistance = vec3.dot(diffVector, viewPlaneNormal);
|
|
570
|
+
const newImagePositionPatient = vec3.scaleAndAdd(vec3.create(), focalPoint, [-viewPlaneNormal[0], -viewPlaneNormal[1], -viewPlaneNormal[2]], projectedDistance);
|
|
571
|
+
this.setCamera({
|
|
572
|
+
focalPoint: newImagePositionPatient,
|
|
573
|
+
});
|
|
574
|
+
this.render();
|
|
575
|
+
}
|
|
563
576
|
}
|
|
564
577
|
else {
|
|
565
578
|
throw new Error(`Incompatible view refs: ${refFrameOfReference}!==${this.getFrameOfReferenceUID()}`);
|
|
@@ -217,6 +217,7 @@ declare class StackViewport extends Viewport {
|
|
|
217
217
|
private setColormapGPU;
|
|
218
218
|
private unsetColormapGPU;
|
|
219
219
|
private _getImagePlaneModule;
|
|
220
|
+
isInAcquisitionPlane(): boolean;
|
|
220
221
|
private renderingPipelineFunctions;
|
|
221
222
|
}
|
|
222
223
|
export default StackViewport;
|
|
@@ -21,6 +21,7 @@ declare class VolumeViewport extends BaseVolumeViewport {
|
|
|
21
21
|
resetCamera(options?: any): boolean;
|
|
22
22
|
setSlabThickness(slabThickness: number, filterActorUIDs?: any[]): void;
|
|
23
23
|
resetSlabThickness(): void;
|
|
24
|
+
isInAcquisitionPlane(): boolean;
|
|
24
25
|
getCurrentImageIdIndex: (volumeId?: string, useSlabThickness?: boolean) => number;
|
|
25
26
|
getSliceIndex: () => number;
|
|
26
27
|
getSliceViewInfo(): {
|
|
@@ -309,6 +309,17 @@ class VolumeViewport extends BaseVolumeViewport {
|
|
|
309
309
|
this.triggerCameraModifiedEventIfNecessary(currentCamera, currentCamera);
|
|
310
310
|
this.viewportProperties.slabThickness = undefined;
|
|
311
311
|
}
|
|
312
|
+
isInAcquisitionPlane() {
|
|
313
|
+
const imageData = this.getImageData();
|
|
314
|
+
if (!imageData) {
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
const { direction } = imageData;
|
|
318
|
+
const { viewPlaneNormal } = this.getCamera();
|
|
319
|
+
const normalDirection = [direction[6], direction[7], direction[8]];
|
|
320
|
+
const TOLERANCE = 0.99;
|
|
321
|
+
return (Math.abs(vec3.dot(viewPlaneNormal, normalDirection)) > TOLERANCE);
|
|
322
|
+
}
|
|
312
323
|
getSliceViewInfo() {
|
|
313
324
|
const { width: canvasWidth, height: canvasHeight } = this.getCanvas();
|
|
314
325
|
const ijkOriginPoint = transformCanvasToIJK(this, [0, 0]);
|
|
@@ -4,6 +4,7 @@ import BaseVolumeViewport from './BaseVolumeViewport';
|
|
|
4
4
|
declare class VolumeViewport3D extends BaseVolumeViewport {
|
|
5
5
|
constructor(props: ViewportInput);
|
|
6
6
|
getNumberOfSlices: () => number;
|
|
7
|
+
isInAcquisitionPlane(): boolean;
|
|
7
8
|
resetCamera({ resetPan, resetZoom, resetToCenter, }?: {
|
|
8
9
|
resetPan?: boolean;
|
|
9
10
|
resetZoom?: boolean;
|
|
@@ -35,6 +35,9 @@ class VolumeViewport3D extends BaseVolumeViewport {
|
|
|
35
35
|
this.applyViewOrientation(orientation);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
+
isInAcquisitionPlane() {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
38
41
|
resetCamera({ resetPan = true, resetZoom = true, resetToCenter = true, } = {}) {
|
|
39
42
|
super.resetCamera({ resetPan, resetZoom, resetToCenter });
|
|
40
43
|
const activeCamera = this.getVtkActiveCamera();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/core",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.17",
|
|
4
4
|
"description": "Cornerstone3D Core",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"types": "./dist/esm/index.d.ts",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"type": "individual",
|
|
92
92
|
"url": "https://ohif.org/donate"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "9a5dc66176f5172fd3bb11ebcf37f9b8667ab3c4"
|
|
95
95
|
}
|