@cornerstonejs/tools 1.15.0 → 1.15.1
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/types/CINETypes.d.ts +2 -0
- package/dist/cjs/utilities/cine/playClip.js +11 -2
- package/dist/cjs/utilities/cine/playClip.js.map +1 -1
- package/dist/esm/types/CINETypes.d.ts +2 -0
- package/dist/esm/utilities/cine/playClip.js +11 -3
- package/dist/esm/utilities/cine/playClip.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/src/types/CINETypes.ts +8 -2
- package/src/utilities/cine/playClip.ts +17 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.1",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"main": "dist/umd/index.js",
|
|
6
6
|
"types": "dist/esm/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@cornerstonejs/core": "^1.15.
|
|
32
|
+
"@cornerstonejs/core": "^1.15.1",
|
|
33
33
|
"lodash.clonedeep": "4.5.0",
|
|
34
34
|
"lodash.get": "^4.4.2"
|
|
35
35
|
},
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"type": "individual",
|
|
53
53
|
"url": "https://ohif.org/donate"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "39fc0a489df073eeee5c1c735f78a70f57258a4d"
|
|
56
56
|
}
|
package/src/types/CINETypes.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Types } from '@cornerstonejs/core';
|
|
2
|
-
|
|
3
1
|
type PlayClipOptions = {
|
|
4
2
|
framesPerSecond?: number;
|
|
5
3
|
frameTimeVector?: number[];
|
|
@@ -7,6 +5,11 @@ type PlayClipOptions = {
|
|
|
7
5
|
loop?: boolean;
|
|
8
6
|
dynamicCineEnabled?: boolean;
|
|
9
7
|
frameTimeVectorSpeedMultiplier?: number;
|
|
8
|
+
// How many CINE frames to wait for a rendered event to occur before
|
|
9
|
+
// trying to display the image after the next one
|
|
10
|
+
// A CINE frame is attempted every 1 / fps seconds
|
|
11
|
+
// The default is 30 tries, or 1.25 seconds at 24 fps
|
|
12
|
+
waitForRendered?: number;
|
|
10
13
|
};
|
|
11
14
|
|
|
12
15
|
interface ToolData {
|
|
@@ -26,6 +29,9 @@ type CinePlayContext = {
|
|
|
26
29
|
get numScrollSteps(): number;
|
|
27
30
|
get currentStepIndex(): number;
|
|
28
31
|
get frameTimeVectorEnabled(): boolean;
|
|
32
|
+
// How many times has the wait for rendered been tried without showing
|
|
33
|
+
// the next image.
|
|
34
|
+
waitForRenderedCount?: number;
|
|
29
35
|
scroll(delta: number): void;
|
|
30
36
|
};
|
|
31
37
|
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
VolumeViewport,
|
|
7
7
|
cache,
|
|
8
8
|
BaseVolumeViewport,
|
|
9
|
+
Enums,
|
|
9
10
|
} from '@cornerstonejs/core';
|
|
10
11
|
|
|
11
12
|
import { Types } from '@cornerstonejs/core';
|
|
@@ -14,6 +15,7 @@ import { addToolState, getToolState } from './state';
|
|
|
14
15
|
import { CINETypes } from '../../types';
|
|
15
16
|
import scroll from '../scroll';
|
|
16
17
|
|
|
18
|
+
const { ViewportStatus } = Enums;
|
|
17
19
|
const { triggerEvent } = csUtils;
|
|
18
20
|
|
|
19
21
|
const debounced = true;
|
|
@@ -315,7 +317,8 @@ function _getVolumeFromViewport(viewport): Types.IImageVolume {
|
|
|
315
317
|
}
|
|
316
318
|
|
|
317
319
|
function _createStackViewportCinePlayContext(
|
|
318
|
-
viewport: StackViewport
|
|
320
|
+
viewport: StackViewport,
|
|
321
|
+
waitForRendered: number
|
|
319
322
|
): CINETypes.CinePlayContext {
|
|
320
323
|
const imageIds = viewport.getImageIds();
|
|
321
324
|
|
|
@@ -330,7 +333,16 @@ function _createStackViewportCinePlayContext(
|
|
|
330
333
|
// It is always in acquired orientation
|
|
331
334
|
return true;
|
|
332
335
|
},
|
|
336
|
+
waitForRenderedCount: 0,
|
|
333
337
|
scroll(delta: number): void {
|
|
338
|
+
if (
|
|
339
|
+
this.waitForRenderedCount <= waitForRendered &&
|
|
340
|
+
viewport.viewportStatus !== ViewportStatus.RENDERED
|
|
341
|
+
) {
|
|
342
|
+
this.waitForRenderedCount++;
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
this.waitForRenderedCount = 0;
|
|
334
346
|
scroll(viewport, { delta, debounceLoading: debounced });
|
|
335
347
|
},
|
|
336
348
|
};
|
|
@@ -419,7 +431,10 @@ function _createCinePlayContext(
|
|
|
419
431
|
playClipOptions: CINETypes.PlayClipOptions
|
|
420
432
|
): CINETypes.CinePlayContext {
|
|
421
433
|
if (viewport instanceof StackViewport) {
|
|
422
|
-
return _createStackViewportCinePlayContext(
|
|
434
|
+
return _createStackViewportCinePlayContext(
|
|
435
|
+
viewport,
|
|
436
|
+
playClipOptions.waitForRendered ?? 30
|
|
437
|
+
);
|
|
423
438
|
}
|
|
424
439
|
|
|
425
440
|
if (viewport instanceof VolumeViewport) {
|