@cornerstonejs/tools 0.26.1 → 0.26.3
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/utilities/index.d.ts +2 -1
- package/dist/cjs/utilities/index.js +3 -1
- package/dist/cjs/utilities/index.js.map +1 -1
- package/dist/cjs/utilities/planar/filterAnnotationsWithinSlice.js +8 -4
- package/dist/cjs/utilities/planar/filterAnnotationsWithinSlice.js.map +1 -1
- package/dist/cjs/utilities/viewportFilters/filterViewportsWithParallelNormals.d.ts +2 -0
- package/dist/cjs/utilities/viewportFilters/filterViewportsWithParallelNormals.js +15 -0
- package/dist/cjs/utilities/viewportFilters/filterViewportsWithParallelNormals.js.map +1 -0
- package/dist/cjs/utilities/viewportFilters/getViewportIdsWithToolToRender.d.ts +1 -1
- package/dist/cjs/utilities/viewportFilters/getViewportIdsWithToolToRender.js +4 -4
- package/dist/cjs/utilities/viewportFilters/index.d.ts +2 -1
- package/dist/cjs/utilities/viewportFilters/index.js +3 -1
- package/dist/cjs/utilities/viewportFilters/index.js.map +1 -1
- package/dist/esm/utilities/index.d.ts +2 -1
- package/dist/esm/utilities/index.js +2 -1
- package/dist/esm/utilities/index.js.map +1 -1
- package/dist/esm/utilities/planar/filterAnnotationsWithinSlice.js +9 -5
- package/dist/esm/utilities/planar/filterAnnotationsWithinSlice.js.map +1 -1
- package/dist/esm/utilities/viewportFilters/filterViewportsWithParallelNormals.d.ts +2 -0
- package/dist/esm/utilities/viewportFilters/filterViewportsWithParallelNormals.js +11 -0
- package/dist/esm/utilities/viewportFilters/filterViewportsWithParallelNormals.js.map +1 -0
- package/dist/esm/utilities/viewportFilters/getViewportIdsWithToolToRender.d.ts +1 -1
- package/dist/esm/utilities/viewportFilters/getViewportIdsWithToolToRender.js +4 -4
- package/dist/esm/utilities/viewportFilters/index.d.ts +2 -1
- package/dist/esm/utilities/viewportFilters/index.js +2 -1
- package/dist/esm/utilities/viewportFilters/index.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -6,6 +6,7 @@ import isObject from './isObject';
|
|
|
6
6
|
import clip from './clip';
|
|
7
7
|
import calibrateImageSpacing from './calibrateImageSpacing';
|
|
8
8
|
import triggerAnnotationRenderForViewportIds from './triggerAnnotationRenderForViewportIds';
|
|
9
|
+
import triggerAnnotationRender from './triggerAnnotationRender';
|
|
9
10
|
import jumpToSlice from './viewport/jumpToSlice';
|
|
10
11
|
import pointInShapeCallback from './pointInShapeCallback';
|
|
11
12
|
import pointInSurroundingSphereCallback from './pointInSurroundingSphereCallback';
|
|
@@ -22,4 +23,4 @@ import * as planarFreehandROITool from './planarFreehandROITool';
|
|
|
22
23
|
import * as rectangleROITool from './rectangleROITool';
|
|
23
24
|
import * as stackPrefetch from './stackPrefetch';
|
|
24
25
|
import { triggerEvent } from '@cornerstonejs/core';
|
|
25
|
-
export { math, planar, viewportFilters, drawing, debounce, deepMerge, throttle, orientation, isObject, triggerEvent, calibrateImageSpacing, segmentation, triggerAnnotationRenderForViewportIds, pointInShapeCallback, pointInSurroundingSphereCallback, getAnnotationNearPoint, getAnnotationNearPointOnEnabledElement, jumpToSlice, cine, clip, boundingBox, rectangleROITool, planarFreehandROITool, stackPrefetch, scroll, };
|
|
26
|
+
export { math, planar, viewportFilters, drawing, debounce, deepMerge, throttle, orientation, isObject, triggerEvent, calibrateImageSpacing, segmentation, triggerAnnotationRenderForViewportIds, triggerAnnotationRender, pointInShapeCallback, pointInSurroundingSphereCallback, getAnnotationNearPoint, getAnnotationNearPointOnEnabledElement, jumpToSlice, cine, clip, boundingBox, rectangleROITool, planarFreehandROITool, stackPrefetch, scroll, };
|
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.scroll = exports.stackPrefetch = exports.planarFreehandROITool = exports.rectangleROITool = exports.boundingBox = exports.clip = exports.cine = exports.jumpToSlice = exports.getAnnotationNearPointOnEnabledElement = exports.getAnnotationNearPoint = exports.pointInSurroundingSphereCallback = exports.pointInShapeCallback = exports.triggerAnnotationRenderForViewportIds = exports.segmentation = exports.calibrateImageSpacing = exports.triggerEvent = exports.isObject = exports.orientation = exports.throttle = exports.deepMerge = exports.debounce = exports.drawing = exports.viewportFilters = exports.planar = exports.math = void 0;
|
|
29
|
+
exports.scroll = exports.stackPrefetch = exports.planarFreehandROITool = exports.rectangleROITool = exports.boundingBox = exports.clip = exports.cine = exports.jumpToSlice = exports.getAnnotationNearPointOnEnabledElement = exports.getAnnotationNearPoint = exports.pointInSurroundingSphereCallback = exports.pointInShapeCallback = exports.triggerAnnotationRender = exports.triggerAnnotationRenderForViewportIds = exports.segmentation = exports.calibrateImageSpacing = exports.triggerEvent = exports.isObject = exports.orientation = exports.throttle = exports.deepMerge = exports.debounce = exports.drawing = exports.viewportFilters = exports.planar = exports.math = void 0;
|
|
30
30
|
const getAnnotationNearPoint_1 = require("./getAnnotationNearPoint");
|
|
31
31
|
Object.defineProperty(exports, "getAnnotationNearPoint", { enumerable: true, get: function () { return getAnnotationNearPoint_1.getAnnotationNearPoint; } });
|
|
32
32
|
Object.defineProperty(exports, "getAnnotationNearPointOnEnabledElement", { enumerable: true, get: function () { return getAnnotationNearPoint_1.getAnnotationNearPointOnEnabledElement; } });
|
|
@@ -44,6 +44,8 @@ const calibrateImageSpacing_1 = __importDefault(require("./calibrateImageSpacing
|
|
|
44
44
|
exports.calibrateImageSpacing = calibrateImageSpacing_1.default;
|
|
45
45
|
const triggerAnnotationRenderForViewportIds_1 = __importDefault(require("./triggerAnnotationRenderForViewportIds"));
|
|
46
46
|
exports.triggerAnnotationRenderForViewportIds = triggerAnnotationRenderForViewportIds_1.default;
|
|
47
|
+
const triggerAnnotationRender_1 = __importDefault(require("./triggerAnnotationRender"));
|
|
48
|
+
exports.triggerAnnotationRender = triggerAnnotationRender_1.default;
|
|
47
49
|
const jumpToSlice_1 = __importDefault(require("./viewport/jumpToSlice"));
|
|
48
50
|
exports.jumpToSlice = jumpToSlice_1.default;
|
|
49
51
|
const pointInShapeCallback_1 = __importDefault(require("./pointInShapeCallback"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qEAGkC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qEAGkC;AAkDhC,uGApDA,+CAAsB,OAoDA;AACtB,uHApDA,+DAAsC,OAoDA;AAhDxC,0DAAkC;AAmChC,mBAnCK,kBAAQ,CAmCL;AAlCV,4DAAoC;AAmClC,oBAnCK,mBAAS,CAmCL;AAlCX,0DAAkC;AAmChC,mBAnCK,kBAAQ,CAmCL;AAlCV,0DAAkC;AAoChC,mBApCK,kBAAQ,CAoCL;AAnCV,kDAA0B;AA+CxB,eA/CK,cAAI,CA+CL;AA9CN,oFAA4D;AAoC1D,gCApCK,+BAAqB,CAoCL;AAnCvB,oHAA4F;AAqC1F,gDArCK,+CAAqC,CAqCL;AApCvC,wFAAgE;AAqC9D,kCArCK,iCAAuB,CAqCL;AApCzB,yEAAiD;AAyC/C,sBAzCK,qBAAW,CAyCL;AAvCb,kFAA0D;AAmCxD,+BAnCK,8BAAoB,CAmCL;AAlCtB,0GAAkF;AAmChF,2CAnCK,0CAAgC,CAmCL;AAlClC,sDAA8B;AA4C5B,iBA5CK,gBAAM,CA4CL;AAzCR,6DAA+C;AA2B7C,oCAAY;AA1Bd,mDAAqC;AAkBnC,0BAAO;AAjBT,6CAA+B;AAc7B,oBAAI;AAbN,iDAAmC;AAcjC,wBAAM;AAbR,mEAAqD;AAcnD,0CAAe;AAbjB,2DAA6C;AAkB3C,kCAAW;AAjBb,6CAA+B;AA6B7B,oBAAI;AA5BN,2DAA6C;AA8B3C,kCAAW;AA7Bb,+EAAiE;AA+B/D,sDAAqB;AA9BvB,qEAAuD;AA6BrD,4CAAgB;AA5BlB,+DAAiD;AA8B/C,sCAAa;AA3Bf,8CAAmD;AAYjD,6FAZO,mBAAY,OAYP"}
|
|
@@ -2,19 +2,23 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const gl_matrix_1 = require("gl-matrix");
|
|
4
4
|
const core_1 = require("@cornerstonejs/core");
|
|
5
|
+
const { EPSILON } = core_1.CONSTANTS;
|
|
6
|
+
const PARALLEL_THRESHOLD = 1 - EPSILON;
|
|
5
7
|
function filterAnnotationsWithinSlice(annotations, camera, spacingInNormalDirection) {
|
|
6
8
|
const { viewPlaneNormal } = camera;
|
|
7
|
-
const
|
|
9
|
+
const annotationsWithParallelNormals = annotations.filter((td) => {
|
|
8
10
|
const annotationViewPlaneNormal = td.metadata.viewPlaneNormal;
|
|
9
|
-
|
|
11
|
+
const isParallel = Math.abs(gl_matrix_1.vec3.dot(viewPlaneNormal, annotationViewPlaneNormal)) >
|
|
12
|
+
PARALLEL_THRESHOLD;
|
|
13
|
+
return annotationViewPlaneNormal && isParallel;
|
|
10
14
|
});
|
|
11
|
-
if (!
|
|
15
|
+
if (!annotationsWithParallelNormals.length) {
|
|
12
16
|
return [];
|
|
13
17
|
}
|
|
14
18
|
const halfSpacingInNormalDirection = spacingInNormalDirection / 2;
|
|
15
19
|
const { focalPoint } = camera;
|
|
16
20
|
const annotationsWithinSlice = [];
|
|
17
|
-
for (const annotation of
|
|
21
|
+
for (const annotation of annotationsWithParallelNormals) {
|
|
18
22
|
const data = annotation.data;
|
|
19
23
|
const point = data.handles.points[0];
|
|
20
24
|
if (!annotation.isVisible) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filterAnnotationsWithinSlice.js","sourceRoot":"","sources":["../../../../src/utilities/planar/filterAnnotationsWithinSlice.ts"],"names":[],"mappings":";;AAAA,yCAAiC;AACjC,
|
|
1
|
+
{"version":3,"file":"filterAnnotationsWithinSlice.js","sourceRoot":"","sources":["../../../../src/utilities/planar/filterAnnotationsWithinSlice.ts"],"names":[],"mappings":";;AAAA,yCAAiC;AACjC,8CAAgD;AAIhD,MAAM,EAAE,OAAO,EAAE,GAAG,gBAAS,CAAC;AAE9B,MAAM,kBAAkB,GAAG,CAAC,GAAG,OAAO,CAAC;AAYvC,SAAwB,4BAA4B,CAClD,WAAwB,EACxB,MAAqB,EACrB,wBAAgC;IAEhC,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;IASnC,MAAM,8BAA8B,GAAG,WAAW,CAAC,MAAM,CACvD,CAAC,EAAc,EAAE,EAAE;QACjB,MAAM,yBAAyB,GAAG,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;QAE9D,MAAM,UAAU,GACd,IAAI,CAAC,GAAG,CAAC,gBAAI,CAAC,GAAG,CAAC,eAAe,EAAE,yBAAyB,CAAC,CAAC;YAC9D,kBAAkB,CAAC;QAErB,OAAO,yBAAyB,IAAI,UAAU,CAAC;IACjD,CAAC,CACF,CAAC;IAGF,IAAI,CAAC,8BAA8B,CAAC,MAAM,EAAE;QAC1C,OAAO,EAAE,CAAC;KACX;IAKD,MAAM,4BAA4B,GAAG,wBAAwB,GAAG,CAAC,CAAC;IAClE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAE9B,MAAM,sBAAsB,GAAG,EAAE,CAAC;IAElC,KAAK,MAAM,UAAU,IAAI,8BAA8B,EAAE;QACvD,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAErC,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE;YACzB,SAAS;SACV;QAQD,MAAM,GAAG,GAAG,gBAAI,CAAC,MAAM,EAAE,CAAC;QAE1B,gBAAI,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QAEjC,MAAM,GAAG,GAAG,gBAAI,CAAC,GAAG,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;QAE3C,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,4BAA4B,EAAE;YAChD,sBAAsB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SACzC;KACF;IAED,OAAO,sBAAsB,CAAC;AAChC,CAAC;AAjED,+CAiEC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.filterViewportsWithParallelNormals = void 0;
|
|
4
|
+
const gl_matrix_1 = require("gl-matrix");
|
|
5
|
+
function filterViewportsWithParallelNormals(viewports, camera, EPS = 0.999) {
|
|
6
|
+
return viewports.filter((viewport) => {
|
|
7
|
+
const vpCamera = viewport.getCamera();
|
|
8
|
+
const isParallel = Math.abs(gl_matrix_1.vec3.dot(vpCamera.viewPlaneNormal, camera.viewPlaneNormal)) >
|
|
9
|
+
EPS;
|
|
10
|
+
return isParallel;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
exports.filterViewportsWithParallelNormals = filterViewportsWithParallelNormals;
|
|
14
|
+
exports.default = filterViewportsWithParallelNormals;
|
|
15
|
+
//# sourceMappingURL=filterViewportsWithParallelNormals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterViewportsWithParallelNormals.js","sourceRoot":"","sources":["../../../../src/utilities/viewportFilters/filterViewportsWithParallelNormals.ts"],"names":[],"mappings":";;;AAAA,yCAAiC;AASjC,SAAgB,kCAAkC,CAChD,SAAS,EACT,MAAM,EACN,GAAG,GAAG,KAAK;IAEX,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE;QACnC,MAAM,QAAQ,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;QAEtC,MAAM,UAAU,GACd,IAAI,CAAC,GAAG,CAAC,gBAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;YACpE,GAAG,CAAC;QAEN,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC,CAAC;AACL,CAAC;AAdD,gFAcC;AAED,kBAAe,kCAAkC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function getViewportIdsWithToolToRender(element: HTMLDivElement, toolName: string,
|
|
1
|
+
export default function getViewportIdsWithToolToRender(element: HTMLDivElement, toolName: string, requireParallelNormals?: boolean): string[];
|
|
@@ -6,16 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const core_1 = require("@cornerstonejs/core");
|
|
7
7
|
const filterViewportsWithFrameOfReferenceUID_1 = __importDefault(require("./filterViewportsWithFrameOfReferenceUID"));
|
|
8
8
|
const filterViewportsWithToolEnabled_1 = __importDefault(require("./filterViewportsWithToolEnabled"));
|
|
9
|
-
const
|
|
10
|
-
function getViewportIdsWithToolToRender(element, toolName,
|
|
9
|
+
const filterViewportsWithParallelNormals_1 = __importDefault(require("./filterViewportsWithParallelNormals"));
|
|
10
|
+
function getViewportIdsWithToolToRender(element, toolName, requireParallelNormals = true) {
|
|
11
11
|
const enabledElement = (0, core_1.getEnabledElement)(element);
|
|
12
12
|
const { renderingEngine, FrameOfReferenceUID } = enabledElement;
|
|
13
13
|
let viewports = renderingEngine.getViewports();
|
|
14
14
|
viewports = (0, filterViewportsWithFrameOfReferenceUID_1.default)(viewports, FrameOfReferenceUID);
|
|
15
15
|
viewports = (0, filterViewportsWithToolEnabled_1.default)(viewports, toolName);
|
|
16
16
|
const viewport = renderingEngine.getViewport(enabledElement.viewportId);
|
|
17
|
-
if (
|
|
18
|
-
viewports = (0,
|
|
17
|
+
if (requireParallelNormals) {
|
|
18
|
+
viewports = (0, filterViewportsWithParallelNormals_1.default)(viewports, viewport.getCamera());
|
|
19
19
|
}
|
|
20
20
|
const viewportIds = viewports.map((vp) => vp.id);
|
|
21
21
|
return viewportIds;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import filterViewportsWithFrameOfReferenceUID from './filterViewportsWithFrameOfReferenceUID';
|
|
2
2
|
import filterViewportsWithToolEnabled from './filterViewportsWithToolEnabled';
|
|
3
3
|
import getViewportIdsWithToolToRender from './getViewportIdsWithToolToRender';
|
|
4
|
-
|
|
4
|
+
import filterViewportsWithParallelNormals from './filterViewportsWithParallelNormals';
|
|
5
|
+
export { filterViewportsWithToolEnabled, filterViewportsWithFrameOfReferenceUID, getViewportIdsWithToolToRender, filterViewportsWithParallelNormals, };
|
|
@@ -3,11 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getViewportIdsWithToolToRender = exports.filterViewportsWithFrameOfReferenceUID = exports.filterViewportsWithToolEnabled = void 0;
|
|
6
|
+
exports.filterViewportsWithParallelNormals = exports.getViewportIdsWithToolToRender = exports.filterViewportsWithFrameOfReferenceUID = exports.filterViewportsWithToolEnabled = void 0;
|
|
7
7
|
const filterViewportsWithFrameOfReferenceUID_1 = __importDefault(require("./filterViewportsWithFrameOfReferenceUID"));
|
|
8
8
|
exports.filterViewportsWithFrameOfReferenceUID = filterViewportsWithFrameOfReferenceUID_1.default;
|
|
9
9
|
const filterViewportsWithToolEnabled_1 = __importDefault(require("./filterViewportsWithToolEnabled"));
|
|
10
10
|
exports.filterViewportsWithToolEnabled = filterViewportsWithToolEnabled_1.default;
|
|
11
11
|
const getViewportIdsWithToolToRender_1 = __importDefault(require("./getViewportIdsWithToolToRender"));
|
|
12
12
|
exports.getViewportIdsWithToolToRender = getViewportIdsWithToolToRender_1.default;
|
|
13
|
+
const filterViewportsWithParallelNormals_1 = __importDefault(require("./filterViewportsWithParallelNormals"));
|
|
14
|
+
exports.filterViewportsWithParallelNormals = filterViewportsWithParallelNormals_1.default;
|
|
13
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utilities/viewportFilters/index.ts"],"names":[],"mappings":";;;;;;AAAA,sHAA8F;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utilities/viewportFilters/index.ts"],"names":[],"mappings":";;;;;;AAAA,sHAA8F;AAO5F,iDAPK,gDAAsC,CAOL;AANxC,sGAA8E;AAK5E,yCALK,wCAA8B,CAKL;AAJhC,sGAA8E;AAM5E,yCANK,wCAA8B,CAML;AALhC,8GAAsF;AAMpF,6CANK,4CAAkC,CAML"}
|
|
@@ -6,6 +6,7 @@ import isObject from './isObject';
|
|
|
6
6
|
import clip from './clip';
|
|
7
7
|
import calibrateImageSpacing from './calibrateImageSpacing';
|
|
8
8
|
import triggerAnnotationRenderForViewportIds from './triggerAnnotationRenderForViewportIds';
|
|
9
|
+
import triggerAnnotationRender from './triggerAnnotationRender';
|
|
9
10
|
import jumpToSlice from './viewport/jumpToSlice';
|
|
10
11
|
import pointInShapeCallback from './pointInShapeCallback';
|
|
11
12
|
import pointInSurroundingSphereCallback from './pointInSurroundingSphereCallback';
|
|
@@ -22,4 +23,4 @@ import * as planarFreehandROITool from './planarFreehandROITool';
|
|
|
22
23
|
import * as rectangleROITool from './rectangleROITool';
|
|
23
24
|
import * as stackPrefetch from './stackPrefetch';
|
|
24
25
|
import { triggerEvent } from '@cornerstonejs/core';
|
|
25
|
-
export { math, planar, viewportFilters, drawing, debounce, deepMerge, throttle, orientation, isObject, triggerEvent, calibrateImageSpacing, segmentation, triggerAnnotationRenderForViewportIds, pointInShapeCallback, pointInSurroundingSphereCallback, getAnnotationNearPoint, getAnnotationNearPointOnEnabledElement, jumpToSlice, cine, clip, boundingBox, rectangleROITool, planarFreehandROITool, stackPrefetch, scroll, };
|
|
26
|
+
export { math, planar, viewportFilters, drawing, debounce, deepMerge, throttle, orientation, isObject, triggerEvent, calibrateImageSpacing, segmentation, triggerAnnotationRenderForViewportIds, triggerAnnotationRender, pointInShapeCallback, pointInSurroundingSphereCallback, getAnnotationNearPoint, getAnnotationNearPointOnEnabledElement, jumpToSlice, cine, clip, boundingBox, rectangleROITool, planarFreehandROITool, stackPrefetch, scroll, };
|
|
@@ -6,6 +6,7 @@ import isObject from './isObject';
|
|
|
6
6
|
import clip from './clip';
|
|
7
7
|
import calibrateImageSpacing from './calibrateImageSpacing';
|
|
8
8
|
import triggerAnnotationRenderForViewportIds from './triggerAnnotationRenderForViewportIds';
|
|
9
|
+
import triggerAnnotationRender from './triggerAnnotationRender';
|
|
9
10
|
import jumpToSlice from './viewport/jumpToSlice';
|
|
10
11
|
import pointInShapeCallback from './pointInShapeCallback';
|
|
11
12
|
import pointInSurroundingSphereCallback from './pointInSurroundingSphereCallback';
|
|
@@ -22,5 +23,5 @@ import * as planarFreehandROITool from './planarFreehandROITool';
|
|
|
22
23
|
import * as rectangleROITool from './rectangleROITool';
|
|
23
24
|
import * as stackPrefetch from './stackPrefetch';
|
|
24
25
|
import { triggerEvent } from '@cornerstonejs/core';
|
|
25
|
-
export { math, planar, viewportFilters, drawing, debounce, deepMerge, throttle, orientation, isObject, triggerEvent, calibrateImageSpacing, segmentation, triggerAnnotationRenderForViewportIds, pointInShapeCallback, pointInSurroundingSphereCallback, getAnnotationNearPoint, getAnnotationNearPointOnEnabledElement, jumpToSlice, cine, clip, boundingBox, rectangleROITool, planarFreehandROITool, stackPrefetch, scroll, };
|
|
26
|
+
export { math, planar, viewportFilters, drawing, debounce, deepMerge, throttle, orientation, isObject, triggerEvent, calibrateImageSpacing, segmentation, triggerAnnotationRenderForViewportIds, triggerAnnotationRender, pointInShapeCallback, pointInSurroundingSphereCallback, getAnnotationNearPoint, getAnnotationNearPointOnEnabledElement, jumpToSlice, cine, clip, boundingBox, rectangleROITool, planarFreehandROITool, stackPrefetch, scroll, };
|
|
26
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,sCAAsC,GACvC,MAAM,0BAA0B,CAAC;AAGlC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,qCAAqC,MAAM,yCAAyC,CAAC;AAC5F,OAAO,WAAW,MAAM,wBAAwB,CAAC;AAEjD,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,gCAAgC,MAAM,oCAAoC,CAAC;AAClF,OAAO,MAAM,MAAM,UAAU,CAAC;AAG9B,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,eAAe,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,qBAAqB,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,gBAAgB,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AAGjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EACL,IAAI,EACJ,MAAM,EACN,eAAe,EACf,OAAO,EACP,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,qBAAqB,EACrB,YAAY,EACZ,qCAAqC,EACrC,oBAAoB,EACpB,gCAAgC,EAChC,sBAAsB,EACtB,sCAAsC,EACtC,WAAW,EACX,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACb,MAAM,GACP,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,sCAAsC,GACvC,MAAM,0BAA0B,CAAC;AAGlC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,qCAAqC,MAAM,yCAAyC,CAAC;AAC5F,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,WAAW,MAAM,wBAAwB,CAAC;AAEjD,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,gCAAgC,MAAM,oCAAoC,CAAC;AAClF,OAAO,MAAM,MAAM,UAAU,CAAC;AAG9B,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,eAAe,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,qBAAqB,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,gBAAgB,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AAGjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EACL,IAAI,EACJ,MAAM,EACN,eAAe,EACf,OAAO,EACP,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,qBAAqB,EACrB,YAAY,EACZ,qCAAqC,EACrC,uBAAuB,EACvB,oBAAoB,EACpB,gCAAgC,EAChC,sBAAsB,EACtB,sCAAsC,EACtC,WAAW,EACX,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACb,MAAM,GACP,CAAC"}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { vec3 } from 'gl-matrix';
|
|
2
|
-
import {
|
|
2
|
+
import { CONSTANTS } from '@cornerstonejs/core';
|
|
3
|
+
const { EPSILON } = CONSTANTS;
|
|
4
|
+
const PARALLEL_THRESHOLD = 1 - EPSILON;
|
|
3
5
|
export default function filterAnnotationsWithinSlice(annotations, camera, spacingInNormalDirection) {
|
|
4
6
|
const { viewPlaneNormal } = camera;
|
|
5
|
-
const
|
|
7
|
+
const annotationsWithParallelNormals = annotations.filter((td) => {
|
|
6
8
|
const annotationViewPlaneNormal = td.metadata.viewPlaneNormal;
|
|
7
|
-
|
|
9
|
+
const isParallel = Math.abs(vec3.dot(viewPlaneNormal, annotationViewPlaneNormal)) >
|
|
10
|
+
PARALLEL_THRESHOLD;
|
|
11
|
+
return annotationViewPlaneNormal && isParallel;
|
|
8
12
|
});
|
|
9
|
-
if (!
|
|
13
|
+
if (!annotationsWithParallelNormals.length) {
|
|
10
14
|
return [];
|
|
11
15
|
}
|
|
12
16
|
const halfSpacingInNormalDirection = spacingInNormalDirection / 2;
|
|
13
17
|
const { focalPoint } = camera;
|
|
14
18
|
const annotationsWithinSlice = [];
|
|
15
|
-
for (const annotation of
|
|
19
|
+
for (const annotation of annotationsWithParallelNormals) {
|
|
16
20
|
const data = annotation.data;
|
|
17
21
|
const point = data.handles.points[0];
|
|
18
22
|
if (!annotation.isVisible) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filterAnnotationsWithinSlice.js","sourceRoot":"","sources":["../../../../src/utilities/planar/filterAnnotationsWithinSlice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"filterAnnotationsWithinSlice.js","sourceRoot":"","sources":["../../../../src/utilities/planar/filterAnnotationsWithinSlice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIhD,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,CAAC;AAE9B,MAAM,kBAAkB,GAAG,CAAC,GAAG,OAAO,CAAC;AAYvC,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAClD,WAAwB,EACxB,MAAqB,EACrB,wBAAgC;IAEhC,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;IASnC,MAAM,8BAA8B,GAAG,WAAW,CAAC,MAAM,CACvD,CAAC,EAAc,EAAE,EAAE;QACjB,MAAM,yBAAyB,GAAG,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;QAE9D,MAAM,UAAU,GACd,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,yBAAyB,CAAC,CAAC;YAC9D,kBAAkB,CAAC;QAErB,OAAO,yBAAyB,IAAI,UAAU,CAAC;IACjD,CAAC,CACF,CAAC;IAGF,IAAI,CAAC,8BAA8B,CAAC,MAAM,EAAE;QAC1C,OAAO,EAAE,CAAC;KACX;IAKD,MAAM,4BAA4B,GAAG,wBAAwB,GAAG,CAAC,CAAC;IAClE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAE9B,MAAM,sBAAsB,GAAG,EAAE,CAAC;IAElC,KAAK,MAAM,UAAU,IAAI,8BAA8B,EAAE;QACvD,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAErC,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE;YACzB,SAAS;SACV;QAQD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAE1B,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QAEjC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;QAE3C,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,4BAA4B,EAAE;YAChD,sBAAsB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SACzC;KACF;IAED,OAAO,sBAAsB,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { vec3 } from 'gl-matrix';
|
|
2
|
+
export function filterViewportsWithParallelNormals(viewports, camera, EPS = 0.999) {
|
|
3
|
+
return viewports.filter((viewport) => {
|
|
4
|
+
const vpCamera = viewport.getCamera();
|
|
5
|
+
const isParallel = Math.abs(vec3.dot(vpCamera.viewPlaneNormal, camera.viewPlaneNormal)) >
|
|
6
|
+
EPS;
|
|
7
|
+
return isParallel;
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
export default filterViewportsWithParallelNormals;
|
|
11
|
+
//# sourceMappingURL=filterViewportsWithParallelNormals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterViewportsWithParallelNormals.js","sourceRoot":"","sources":["../../../../src/utilities/viewportFilters/filterViewportsWithParallelNormals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AASjC,MAAM,UAAU,kCAAkC,CAChD,SAAS,EACT,MAAM,EACN,GAAG,GAAG,KAAK;IAEX,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE;QACnC,MAAM,QAAQ,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;QAEtC,MAAM,UAAU,GACd,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;YACpE,GAAG,CAAC;QAEN,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,eAAe,kCAAkC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function getViewportIdsWithToolToRender(element: HTMLDivElement, toolName: string,
|
|
1
|
+
export default function getViewportIdsWithToolToRender(element: HTMLDivElement, toolName: string, requireParallelNormals?: boolean): string[];
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { getEnabledElement } from '@cornerstonejs/core';
|
|
2
2
|
import filterViewportsWithFrameOfReferenceUID from './filterViewportsWithFrameOfReferenceUID';
|
|
3
3
|
import filterViewportsWithToolEnabled from './filterViewportsWithToolEnabled';
|
|
4
|
-
import
|
|
5
|
-
export default function getViewportIdsWithToolToRender(element, toolName,
|
|
4
|
+
import filterViewportsWithParallelNormals from './filterViewportsWithParallelNormals';
|
|
5
|
+
export default function getViewportIdsWithToolToRender(element, toolName, requireParallelNormals = true) {
|
|
6
6
|
const enabledElement = getEnabledElement(element);
|
|
7
7
|
const { renderingEngine, FrameOfReferenceUID } = enabledElement;
|
|
8
8
|
let viewports = renderingEngine.getViewports();
|
|
9
9
|
viewports = filterViewportsWithFrameOfReferenceUID(viewports, FrameOfReferenceUID);
|
|
10
10
|
viewports = filterViewportsWithToolEnabled(viewports, toolName);
|
|
11
11
|
const viewport = renderingEngine.getViewport(enabledElement.viewportId);
|
|
12
|
-
if (
|
|
13
|
-
viewports =
|
|
12
|
+
if (requireParallelNormals) {
|
|
13
|
+
viewports = filterViewportsWithParallelNormals(viewports, viewport.getCamera());
|
|
14
14
|
}
|
|
15
15
|
const viewportIds = viewports.map((vp) => vp.id);
|
|
16
16
|
return viewportIds;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import filterViewportsWithFrameOfReferenceUID from './filterViewportsWithFrameOfReferenceUID';
|
|
2
2
|
import filterViewportsWithToolEnabled from './filterViewportsWithToolEnabled';
|
|
3
3
|
import getViewportIdsWithToolToRender from './getViewportIdsWithToolToRender';
|
|
4
|
-
|
|
4
|
+
import filterViewportsWithParallelNormals from './filterViewportsWithParallelNormals';
|
|
5
|
+
export { filterViewportsWithToolEnabled, filterViewportsWithFrameOfReferenceUID, getViewportIdsWithToolToRender, filterViewportsWithParallelNormals, };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import filterViewportsWithFrameOfReferenceUID from './filterViewportsWithFrameOfReferenceUID';
|
|
2
2
|
import filterViewportsWithToolEnabled from './filterViewportsWithToolEnabled';
|
|
3
3
|
import getViewportIdsWithToolToRender from './getViewportIdsWithToolToRender';
|
|
4
|
-
|
|
4
|
+
import filterViewportsWithParallelNormals from './filterViewportsWithParallelNormals';
|
|
5
|
+
export { filterViewportsWithToolEnabled, filterViewportsWithFrameOfReferenceUID, getViewportIdsWithToolToRender, filterViewportsWithParallelNormals, };
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utilities/viewportFilters/index.ts"],"names":[],"mappings":"AAAA,OAAO,sCAAsC,MAAM,0CAA0C,CAAC;AAC9F,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAC9E,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utilities/viewportFilters/index.ts"],"names":[],"mappings":"AAAA,OAAO,sCAAsC,MAAM,0CAA0C,CAAC;AAC9F,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAC9E,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAC9E,OAAO,kCAAkC,MAAM,sCAAsC,CAAC;AAEtF,OAAO,EACL,8BAA8B,EAC9B,sCAAsC,EACtC,8BAA8B,EAC9B,kCAAkC,GACnC,CAAC"}
|