@cornerstonejs/tools 0.26.2 → 0.26.4

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.
Files changed (23) hide show
  1. package/dist/cjs/utilities/planar/filterAnnotationsWithinSlice.js +8 -4
  2. package/dist/cjs/utilities/planar/filterAnnotationsWithinSlice.js.map +1 -1
  3. package/dist/cjs/utilities/viewportFilters/filterViewportsWithParallelNormals.d.ts +2 -0
  4. package/dist/cjs/utilities/viewportFilters/filterViewportsWithParallelNormals.js +15 -0
  5. package/dist/cjs/utilities/viewportFilters/filterViewportsWithParallelNormals.js.map +1 -0
  6. package/dist/cjs/utilities/viewportFilters/getViewportIdsWithToolToRender.d.ts +1 -1
  7. package/dist/cjs/utilities/viewportFilters/getViewportIdsWithToolToRender.js +4 -4
  8. package/dist/cjs/utilities/viewportFilters/index.d.ts +2 -1
  9. package/dist/cjs/utilities/viewportFilters/index.js +3 -1
  10. package/dist/cjs/utilities/viewportFilters/index.js.map +1 -1
  11. package/dist/esm/utilities/planar/filterAnnotationsWithinSlice.js +9 -5
  12. package/dist/esm/utilities/planar/filterAnnotationsWithinSlice.js.map +1 -1
  13. package/dist/esm/utilities/viewportFilters/filterViewportsWithParallelNormals.d.ts +2 -0
  14. package/dist/esm/utilities/viewportFilters/filterViewportsWithParallelNormals.js +11 -0
  15. package/dist/esm/utilities/viewportFilters/filterViewportsWithParallelNormals.js.map +1 -0
  16. package/dist/esm/utilities/viewportFilters/getViewportIdsWithToolToRender.d.ts +1 -1
  17. package/dist/esm/utilities/viewportFilters/getViewportIdsWithToolToRender.js +4 -4
  18. package/dist/esm/utilities/viewportFilters/index.d.ts +2 -1
  19. package/dist/esm/utilities/viewportFilters/index.js +2 -1
  20. package/dist/esm/utilities/viewportFilters/index.js.map +1 -1
  21. package/dist/umd/index.js +1 -1
  22. package/dist/umd/index.js.map +1 -1
  23. package/package.json +3 -3
@@ -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 annotationsWithSameNormal = annotations.filter((td) => {
9
+ const annotationsWithParallelNormals = annotations.filter((td) => {
8
10
  const annotationViewPlaneNormal = td.metadata.viewPlaneNormal;
9
- return core_1.utilities.isEqual(annotationViewPlaneNormal, viewPlaneNormal);
11
+ const isParallel = Math.abs(gl_matrix_1.vec3.dot(viewPlaneNormal, annotationViewPlaneNormal)) >
12
+ PARALLEL_THRESHOLD;
13
+ return annotationViewPlaneNormal && isParallel;
10
14
  });
11
- if (!annotationsWithSameNormal.length) {
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 annotationsWithSameNormal) {
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,8CAA2D;AAc3D,SAAwB,4BAA4B,CAClD,WAAwB,EACxB,MAAqB,EACrB,wBAAgC;IAEhC,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;IACnC,MAAM,yBAAyB,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,EAAc,EAAE,EAAE;QACtE,MAAM,yBAAyB,GAAG,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;QAC9D,OAAO,gBAAO,CAAC,OAAO,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAGH,IAAI,CAAC,yBAAyB,CAAC,MAAM,EAAE;QACrC,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,yBAAyB,EAAE;QAClD,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;AAlDD,+CAkDC"}
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,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als(viewports: any, camera: any, EPS?: number): any;
2
+ export default filterViewportsWithParallelNormals;
@@ -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, requireSameOrientation?: boolean): 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 filterViewportsWithSameOrientation_1 = __importDefault(require("./filterViewportsWithSameOrientation"));
10
- function getViewportIdsWithToolToRender(element, toolName, requireSameOrientation = true) {
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 (requireSameOrientation) {
18
- viewports = (0, filterViewportsWithSameOrientation_1.default)(viewports, viewport.getCamera());
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
- export { filterViewportsWithToolEnabled, filterViewportsWithFrameOfReferenceUID, getViewportIdsWithToolToRender, };
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;AAM5F,iDANK,gDAAsC,CAML;AALxC,sGAA8E;AAI5E,yCAJK,wCAA8B,CAIL;AAHhC,sGAA8E;AAK5E,yCALK,wCAA8B,CAKL"}
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"}
@@ -1,18 +1,22 @@
1
1
  import { vec3 } from 'gl-matrix';
2
- import { utilities as csUtils } from '@cornerstonejs/core';
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 annotationsWithSameNormal = annotations.filter((td) => {
7
+ const annotationsWithParallelNormals = annotations.filter((td) => {
6
8
  const annotationViewPlaneNormal = td.metadata.viewPlaneNormal;
7
- return csUtils.isEqual(annotationViewPlaneNormal, viewPlaneNormal);
9
+ const isParallel = Math.abs(vec3.dot(viewPlaneNormal, annotationViewPlaneNormal)) >
10
+ PARALLEL_THRESHOLD;
11
+ return annotationViewPlaneNormal && isParallel;
8
12
  });
9
- if (!annotationsWithSameNormal.length) {
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 annotationsWithSameNormal) {
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,IAAI,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAc3D,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAClD,WAAwB,EACxB,MAAqB,EACrB,wBAAgC;IAEhC,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;IACnC,MAAM,yBAAyB,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,EAAc,EAAE,EAAE;QACtE,MAAM,yBAAyB,GAAG,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;QAC9D,OAAO,OAAO,CAAC,OAAO,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAGH,IAAI,CAAC,yBAAyB,CAAC,MAAM,EAAE;QACrC,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,yBAAyB,EAAE;QAClD,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"}
1
+ {"version":3,"file":"filterAnnotationsWithinSlice.js","sourceRoot":"","sources":["../../../../src/utilities/planar/filterAnnotationsWithinSlice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WA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G,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,2 @@
1
+ export declare function filterViewportsWithParallelNormals(viewports: any, camera: any, EPS?: number): any;
2
+ export default filterViewportsWithParallelNormals;
@@ -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, requireSameOrientation?: boolean): 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 filterViewportsWithSameOrientation from './filterViewportsWithSameOrientation';
5
- export default function getViewportIdsWithToolToRender(element, toolName, requireSameOrientation = true) {
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 (requireSameOrientation) {
13
- viewports = filterViewportsWithSameOrientation(viewports, viewport.getCamera());
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
- export { filterViewportsWithToolEnabled, filterViewportsWithFrameOfReferenceUID, getViewportIdsWithToolToRender, };
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
- export { filterViewportsWithToolEnabled, filterViewportsWithFrameOfReferenceUID, getViewportIdsWithToolToRender, };
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;AAE9E,OAAO,EACL,8BAA8B,EAC9B,sCAAsC,EACtC,8BAA8B,GAC/B,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"}