@cornerstonejs/core 1.45.1 → 1.47.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/BaseVolumeViewport.d.ts +2 -2
- package/dist/cjs/RenderingEngine/BaseVolumeViewport.js +14 -0
- package/dist/cjs/RenderingEngine/BaseVolumeViewport.js.map +1 -1
- package/dist/cjs/RenderingEngine/StackViewport.d.ts +2 -1
- package/dist/cjs/RenderingEngine/StackViewport.js +4 -0
- package/dist/cjs/RenderingEngine/StackViewport.js.map +1 -1
- package/dist/cjs/RenderingEngine/VideoViewport.d.ts +3 -1
- package/dist/cjs/RenderingEngine/VideoViewport.js +13 -2
- package/dist/cjs/RenderingEngine/VideoViewport.js.map +1 -1
- package/dist/cjs/RenderingEngine/Viewport.d.ts +3 -1
- package/dist/cjs/RenderingEngine/Viewport.js +6 -0
- package/dist/cjs/RenderingEngine/Viewport.js.map +1 -1
- package/dist/cjs/types/IViewport.d.ts +8 -0
- package/dist/cjs/types/index.d.ts +2 -2
- package/dist/esm/RenderingEngine/BaseVolumeViewport.js +13 -0
- package/dist/esm/RenderingEngine/BaseVolumeViewport.js.map +1 -1
- package/dist/esm/RenderingEngine/StackViewport.js +4 -0
- package/dist/esm/RenderingEngine/StackViewport.js.map +1 -1
- package/dist/esm/RenderingEngine/VideoViewport.js +13 -2
- package/dist/esm/RenderingEngine/VideoViewport.js.map +1 -1
- package/dist/esm/RenderingEngine/Viewport.js +6 -0
- package/dist/esm/RenderingEngine/Viewport.js.map +1 -1
- package/dist/types/RenderingEngine/BaseVolumeViewport.d.ts +2 -2
- package/dist/types/RenderingEngine/BaseVolumeViewport.d.ts.map +1 -1
- package/dist/types/RenderingEngine/StackViewport.d.ts +2 -1
- package/dist/types/RenderingEngine/StackViewport.d.ts.map +1 -1
- package/dist/types/RenderingEngine/VideoViewport.d.ts +3 -1
- package/dist/types/RenderingEngine/VideoViewport.d.ts.map +1 -1
- package/dist/types/RenderingEngine/Viewport.d.ts +3 -1
- package/dist/types/RenderingEngine/Viewport.d.ts.map +1 -1
- package/dist/types/types/IViewport.d.ts +8 -0
- package/dist/types/types/IViewport.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +2 -2
- package/dist/types/types/index.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/BaseVolumeViewport.ts +21 -2
- package/src/RenderingEngine/StackViewport.ts +6 -1
- package/src/RenderingEngine/VideoViewport.ts +23 -3
- package/src/RenderingEngine/Viewport.ts +13 -1
- package/src/types/IViewport.ts +18 -0
- package/src/types/index.ts +6 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.47.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": "b1235a2e36cda555341dfbd164ef45e519c4efd5"
|
|
51
51
|
}
|
|
@@ -35,6 +35,7 @@ import type {
|
|
|
35
35
|
VOIRange,
|
|
36
36
|
EventTypes,
|
|
37
37
|
VolumeViewportProperties,
|
|
38
|
+
TargetSpecifier,
|
|
38
39
|
} from '../types';
|
|
39
40
|
import { VoiModifiedEventDetail } from '../types/EventTypes';
|
|
40
41
|
import type { ViewportInput } from '../types/IViewport';
|
|
@@ -1382,10 +1383,28 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
|
|
|
1382
1383
|
return imageVolume.imageIds;
|
|
1383
1384
|
};
|
|
1384
1385
|
|
|
1385
|
-
abstract getCurrentImageIdIndex(): number;
|
|
1386
|
-
|
|
1387
1386
|
abstract getCurrentImageId(): string;
|
|
1388
1387
|
|
|
1388
|
+
public getTargetId(specifier: TargetSpecifier = {}): string {
|
|
1389
|
+
let { volumeId, sliceIndex } = specifier;
|
|
1390
|
+
if (!volumeId) {
|
|
1391
|
+
const actorEntries = this.getActors();
|
|
1392
|
+
if (!actorEntries) {
|
|
1393
|
+
return;
|
|
1394
|
+
}
|
|
1395
|
+
// find the first image actor of instance type vtkVolume
|
|
1396
|
+
volumeId = actorEntries.find(
|
|
1397
|
+
(actorEntry) => actorEntry.actor.getClassName() === 'vtkVolume'
|
|
1398
|
+
)?.uid;
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
sliceIndex ??= this.getCurrentImageIdIndex();
|
|
1402
|
+
const { viewPlaneNormal, focalPoint } = this.getCamera();
|
|
1403
|
+
return `volumeId:${volumeId}?sliceIndex=${sliceIndex}&viewPlaneNormal=${viewPlaneNormal.join(
|
|
1404
|
+
','
|
|
1405
|
+
)}&focalPoint=${focalPoint.join(',')}`;
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1389
1408
|
abstract setBlendMode(
|
|
1390
1409
|
blendMode: BlendModes,
|
|
1391
1410
|
filterActorUIDs?: Array<string>,
|
|
@@ -35,7 +35,7 @@ import type {
|
|
|
35
35
|
VOIRange,
|
|
36
36
|
VolumeActor,
|
|
37
37
|
} from '../types';
|
|
38
|
-
import { ViewportInput } from '../types/IViewport';
|
|
38
|
+
import { TargetSpecifier, ViewportInput } from '../types/IViewport';
|
|
39
39
|
import {
|
|
40
40
|
actorIsA,
|
|
41
41
|
colormap as colormapUtils,
|
|
@@ -2812,6 +2812,11 @@ class StackViewport extends Viewport implements IStackViewport, IImagesLoader {
|
|
|
2812
2812
|
return this.currentImageIdIndex;
|
|
2813
2813
|
};
|
|
2814
2814
|
|
|
2815
|
+
public getTargetId(specifier: TargetSpecifier = {}): string {
|
|
2816
|
+
const { sliceIndex: imageIdIndex = this.currentImageIdIndex } = specifier;
|
|
2817
|
+
return `imageId:${this.imageIds[imageIdIndex]}`;
|
|
2818
|
+
}
|
|
2819
|
+
|
|
2815
2820
|
/**
|
|
2816
2821
|
*
|
|
2817
2822
|
* Returns the imageIdIndex that is targeted to be loaded, in case of debounced
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
VideoViewport as VideoViewportEnum,
|
|
5
5
|
MetadataModules,
|
|
6
6
|
} from '../enums';
|
|
7
|
-
import {
|
|
7
|
+
import type {
|
|
8
8
|
IVideoViewport,
|
|
9
9
|
VideoViewportProperties,
|
|
10
10
|
Point3,
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
InternalVideoCamera,
|
|
14
14
|
VideoViewportInput,
|
|
15
15
|
VOIRange,
|
|
16
|
+
TargetSpecifier,
|
|
16
17
|
} from '../types';
|
|
17
18
|
import * as metaData from '../metaData';
|
|
18
19
|
import { Transform } from './helpers/cpuFallback/rendering/transform';
|
|
@@ -633,15 +634,34 @@ class VideoViewport extends Viewport implements IVideoViewport {
|
|
|
633
634
|
const current = this.imageId.replace(
|
|
634
635
|
'/frames/1',
|
|
635
636
|
this.isPlaying
|
|
636
|
-
? `/frames
|
|
637
|
+
? `/frames/${this.frameRange[0]}-${this.frameRange[1]}`
|
|
637
638
|
: `/frames/${this.getFrameNumber()}`
|
|
638
639
|
);
|
|
639
640
|
return current;
|
|
640
641
|
}
|
|
641
642
|
|
|
643
|
+
public getTargetId(specifier: TargetSpecifier = {}): string {
|
|
644
|
+
const { sliceIndex } = specifier;
|
|
645
|
+
if (sliceIndex === undefined) {
|
|
646
|
+
return `videoId:${this.getCurrentImageId()}`;
|
|
647
|
+
}
|
|
648
|
+
const baseTarget = this.imageId.replace(
|
|
649
|
+
'/frames/1',
|
|
650
|
+
`/frames/${1 + sliceIndex}`
|
|
651
|
+
);
|
|
652
|
+
return `videoId:${baseTarget}`;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* Gets the 1 based frame number (ala DICOM value), eg `1+ currentImageIdIndex`
|
|
657
|
+
*/
|
|
642
658
|
public getFrameNumber() {
|
|
643
659
|
// Need to round this as the fps/time isn't exact
|
|
644
|
-
return 1 +
|
|
660
|
+
return 1 + this.getCurrentImageIdIndex();
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
public getCurrentImageIdIndex() {
|
|
664
|
+
return Math.round(this.videoElement.currentTime * this.fps);
|
|
645
665
|
}
|
|
646
666
|
|
|
647
667
|
public getCamera(): ICamera {
|
|
@@ -30,7 +30,11 @@ import type {
|
|
|
30
30
|
EventTypes,
|
|
31
31
|
DisplayArea,
|
|
32
32
|
} from '../types';
|
|
33
|
-
import type {
|
|
33
|
+
import type {
|
|
34
|
+
ViewportInput,
|
|
35
|
+
IViewport,
|
|
36
|
+
TargetSpecifier,
|
|
37
|
+
} from '../types/IViewport';
|
|
34
38
|
import type { vtkSlabCamera } from './vtkClasses/vtkSlabCamera';
|
|
35
39
|
import { getConfiguration } from '../init';
|
|
36
40
|
import IImageCalibration from '../types/IImageCalibration';
|
|
@@ -884,6 +888,14 @@ class Viewport implements IViewport {
|
|
|
884
888
|
return result;
|
|
885
889
|
}
|
|
886
890
|
|
|
891
|
+
public getCurrentImageIdIndex(): number {
|
|
892
|
+
throw new Error('Not implemented');
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
public getTargetId(specifier?: TargetSpecifier): string {
|
|
896
|
+
return null;
|
|
897
|
+
}
|
|
898
|
+
|
|
887
899
|
/**
|
|
888
900
|
* Sets the canvas pan value relative to the initial view position of 0,0
|
|
889
901
|
* Modifies the camera to perform the pan.
|
package/src/types/IViewport.ts
CHANGED
|
@@ -7,6 +7,20 @@ import ViewportType from '../enums/ViewportType';
|
|
|
7
7
|
import ViewportStatus from '../enums/ViewportStatus';
|
|
8
8
|
import DisplayArea from './displayArea';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Specifies what image to get a reference for.
|
|
12
|
+
*/
|
|
13
|
+
export type TargetSpecifier = {
|
|
14
|
+
/** The slice index within the current viewport camera to get a reference for */
|
|
15
|
+
sliceIndex?: number;
|
|
16
|
+
/** True to get a frame of reference UID reference instead of a regular image one */
|
|
17
|
+
forFrameOfReference?: boolean;
|
|
18
|
+
/** Set of points to get a reference for, in world space */
|
|
19
|
+
points?: Point3[];
|
|
20
|
+
/** The volumeId to reference */
|
|
21
|
+
volumeId?: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
10
24
|
/**
|
|
11
25
|
* Viewport interface for cornerstone viewports
|
|
12
26
|
*/
|
|
@@ -107,6 +121,10 @@ interface IViewport {
|
|
|
107
121
|
setCamera(cameraInterface: ICamera, storeAsInitialCamera?: boolean): void;
|
|
108
122
|
/** Gets the number of slices in the current camera orientation */
|
|
109
123
|
getNumberOfSlices(): number;
|
|
124
|
+
/** Gets the current slice in the current camera orientation */
|
|
125
|
+
getCurrentImageIdIndex(): number;
|
|
126
|
+
/** Gets a referenced image url of some sort - could be a real image id, or could be a URL with parameters */
|
|
127
|
+
getTargetId(forTarget?: TargetSpecifier): string;
|
|
110
128
|
/** whether the viewport has custom rendering */
|
|
111
129
|
customRenderViewportToCanvas: () => unknown;
|
|
112
130
|
_getCorners(bounds: Array<number>): Array<number>[];
|
package/src/types/index.ts
CHANGED
|
@@ -13,7 +13,11 @@ import type VolumeLoaderFn from './VolumeLoaderFn';
|
|
|
13
13
|
import type IRegisterImageLoader from './IRegisterImageLoader';
|
|
14
14
|
import type IStreamingVolumeProperties from './IStreamingVolumeProperties';
|
|
15
15
|
import type CustomEventType from './CustomEventType';
|
|
16
|
-
import type {
|
|
16
|
+
import type {
|
|
17
|
+
IViewport,
|
|
18
|
+
PublicViewportInput,
|
|
19
|
+
TargetSpecifier,
|
|
20
|
+
} from './IViewport';
|
|
17
21
|
import type { VolumeActor, Actor, ActorEntry, ImageActor } from './IActor';
|
|
18
22
|
import type {
|
|
19
23
|
IImageLoadObject,
|
|
@@ -141,6 +145,7 @@ export type {
|
|
|
141
145
|
IRegisterImageLoader,
|
|
142
146
|
IStreamingVolumeProperties,
|
|
143
147
|
IViewport,
|
|
148
|
+
TargetSpecifier,
|
|
144
149
|
StackViewportProperties,
|
|
145
150
|
VolumeViewportProperties,
|
|
146
151
|
ViewportProperties,
|