@cornerstonejs/tools 2.5.0 → 2.5.2

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.
@@ -1,6 +1,6 @@
1
1
  import { eventTarget, triggerEvent } from '@cornerstonejs/core';
2
2
  import { Events } from '../../enums';
3
- import { getAnnotation } from './getAnnotation';
3
+ import { getAnnotation } from './annotationState';
4
4
  const globalLockedAnnotationUIDsSet = new Set();
5
5
  function setAnnotationLocked(annotationUID, locked = true) {
6
6
  const detail = makeEventDetail();
@@ -1,6 +1,6 @@
1
1
  import { eventTarget, triggerEvent } from '@cornerstonejs/core';
2
2
  import { Events } from '../../enums';
3
- import { getAnnotation } from './getAnnotation';
3
+ import { getAnnotation } from './annotationState';
4
4
  const selectedAnnotationUIDs = new Set();
5
5
  function setAnnotationSelected(annotationUID, selected = true, preserveSelected = false) {
6
6
  if (selected) {
@@ -1,10 +1,9 @@
1
1
  import type { Annotations, Annotation } from '../../types/AnnotationTypes';
2
- import type { AnnotationGroupSelector } from '../../types';
3
- import { getAnnotation } from './getAnnotation';
4
- declare function getAnnotationManager(): import("./FrameOfReferenceSpecificAnnotationManager").default;
5
- declare function setAnnotationManager(annotationManager: any): void;
6
- declare function resetAnnotationManager(): void;
2
+ import type { AnnotationGroupSelector, IAnnotationManager } from '../../types';
3
+ declare function getAnnotationManager(): any;
4
+ declare function setAnnotationManager(annotationManager: IAnnotationManager): void;
7
5
  declare function getAnnotations(toolName: string, annotationGroupSelector: AnnotationGroupSelector): Annotations;
6
+ declare function getAnnotation(annotationUID: string): Annotation;
8
7
  declare function getAllAnnotations(): Annotations;
9
8
  declare function clearParentAnnotation(annotation: Annotation): void;
10
9
  declare function addChildAnnotation(parentAnnotation: Annotation, childAnnotation: Annotation): void;
@@ -16,4 +15,4 @@ declare function removeAnnotation(annotationUID: string): void;
16
15
  declare function removeAllAnnotations(): void;
17
16
  declare function removeAnnotations(toolName: string, annotationGroupSelector: AnnotationGroupSelector): void;
18
17
  declare function invalidateAnnotation(annotation: Annotation): void;
19
- export { getAllAnnotations, getAnnotations, getParentAnnotation, getChildAnnotations, clearParentAnnotation, addChildAnnotation, getNumberOfAnnotations, addAnnotation, removeAnnotation, removeAnnotations, removeAllAnnotations, setAnnotationManager, getAnnotationManager, resetAnnotationManager, invalidateAnnotation, getAnnotation, };
18
+ export { getAllAnnotations, getAnnotations, getParentAnnotation, getChildAnnotations, clearParentAnnotation, addChildAnnotation, getNumberOfAnnotations, addAnnotation, removeAnnotation, removeAnnotations, removeAllAnnotations, setAnnotationManager, getAnnotationManager, invalidateAnnotation, getAnnotation, };
@@ -1,36 +1,21 @@
1
1
  import { utilities as csUtils } from '@cornerstonejs/core';
2
- import { defaultFrameOfReferenceSpecificAnnotationManager } from './FrameOfReferenceSpecificAnnotationManager';
3
- import { getAnnotation } from './getAnnotation';
4
2
  import { triggerAnnotationAddedForElement, triggerAnnotationAddedForFOR, triggerAnnotationRemoved, } from './helpers/state';
5
- import { checkAndSetAnnotationLocked } from './annotationLocking';
6
- import { checkAndDefineCachedStatsProperty, checkAndDefineTextBoxProperty, } from './utilities/defineProperties';
7
- import { checkAndSetAnnotationVisibility } from './annotationVisibility';
8
- let defaultManager = defaultFrameOfReferenceSpecificAnnotationManager;
9
- const preprocessingFn = (annotation) => {
10
- annotation = checkAndDefineTextBoxProperty(annotation);
11
- annotation = checkAndDefineCachedStatsProperty(annotation);
12
- const uid = annotation.annotationUID;
13
- const isLocked = checkAndSetAnnotationLocked(uid);
14
- annotation.isLocked = isLocked;
15
- const isVisible = checkAndSetAnnotationVisibility(uid);
16
- annotation.isVisible = isVisible;
17
- return annotation;
18
- };
19
- defaultManager.setPreprocessingFn(preprocessingFn);
3
+ let defaultManager;
20
4
  function getAnnotationManager() {
21
5
  return defaultManager;
22
6
  }
23
7
  function setAnnotationManager(annotationManager) {
24
8
  defaultManager = annotationManager;
25
9
  }
26
- function resetAnnotationManager() {
27
- defaultManager = defaultFrameOfReferenceSpecificAnnotationManager;
28
- }
29
10
  function getAnnotations(toolName, annotationGroupSelector) {
30
11
  const manager = getAnnotationManager();
31
12
  const groupKey = manager.getGroupKey(annotationGroupSelector);
32
13
  return manager.getAnnotations(groupKey, toolName);
33
14
  }
15
+ function getAnnotation(annotationUID) {
16
+ const manager = getAnnotationManager();
17
+ return manager.getAnnotation(annotationUID);
18
+ }
34
19
  function getAllAnnotations() {
35
20
  const manager = getAnnotationManager();
36
21
  return manager.getAllAnnotations();
@@ -130,4 +115,4 @@ function invalidateAnnotation(annotation) {
130
115
  : undefined;
131
116
  }
132
117
  }
133
- export { getAllAnnotations, getAnnotations, getParentAnnotation, getChildAnnotations, clearParentAnnotation, addChildAnnotation, getNumberOfAnnotations, addAnnotation, removeAnnotation, removeAnnotations, removeAllAnnotations, setAnnotationManager, getAnnotationManager, resetAnnotationManager, invalidateAnnotation, getAnnotation, };
118
+ export { getAllAnnotations, getAnnotations, getParentAnnotation, getChildAnnotations, clearParentAnnotation, addChildAnnotation, getNumberOfAnnotations, addAnnotation, removeAnnotation, removeAnnotations, removeAllAnnotations, setAnnotationManager, getAnnotationManager, invalidateAnnotation, getAnnotation, };
@@ -1,7 +1,7 @@
1
1
  import { eventTarget, triggerEvent } from '@cornerstonejs/core';
2
2
  import { Events } from '../../enums';
3
3
  import { isAnnotationSelected, deselectAnnotation, } from './annotationSelection';
4
- import { getAnnotation } from './getAnnotation';
4
+ import { getAnnotation } from './annotationState';
5
5
  const globalHiddenAnnotationUIDsSet = new Set();
6
6
  function setAnnotationVisibility(annotationUID, visible = true) {
7
7
  const detail = makeEventDetail();
@@ -1,8 +1,27 @@
1
1
  import * as config from './config';
2
2
  import * as locking from './annotationLocking';
3
3
  import * as selection from './annotationSelection';
4
- import * as state from './annotationState';
4
+ import * as annotationState from './annotationState';
5
5
  import * as visibility from './annotationVisibility';
6
6
  import FrameOfReferenceSpecificAnnotationManager from './FrameOfReferenceSpecificAnnotationManager';
7
7
  import AnnotationGroup from './AnnotationGroup';
8
+ import { resetAnnotationManager } from './resetAnnotationManager';
9
+ declare const state: {
10
+ resetAnnotationManager: typeof resetAnnotationManager;
11
+ getAllAnnotations: typeof annotationState.getAllAnnotations;
12
+ getAnnotations: typeof annotationState.getAnnotations;
13
+ getParentAnnotation: typeof annotationState.getParentAnnotation;
14
+ getChildAnnotations: typeof annotationState.getChildAnnotations;
15
+ clearParentAnnotation: typeof annotationState.clearParentAnnotation;
16
+ addChildAnnotation: typeof annotationState.addChildAnnotation;
17
+ getNumberOfAnnotations: typeof annotationState.getNumberOfAnnotations;
18
+ addAnnotation: typeof annotationState.addAnnotation;
19
+ removeAnnotation: typeof annotationState.removeAnnotation;
20
+ removeAnnotations: typeof annotationState.removeAnnotations;
21
+ removeAllAnnotations: typeof annotationState.removeAllAnnotations;
22
+ setAnnotationManager: typeof annotationState.setAnnotationManager;
23
+ getAnnotationManager: typeof annotationState.getAnnotationManager;
24
+ invalidateAnnotation: typeof annotationState.invalidateAnnotation;
25
+ getAnnotation: typeof annotationState.getAnnotation;
26
+ };
8
27
  export { config, locking, selection, state, visibility, FrameOfReferenceSpecificAnnotationManager, AnnotationGroup, };
@@ -1,8 +1,13 @@
1
1
  import * as config from './config';
2
2
  import * as locking from './annotationLocking';
3
3
  import * as selection from './annotationSelection';
4
- import * as state from './annotationState';
4
+ import * as annotationState from './annotationState';
5
5
  import * as visibility from './annotationVisibility';
6
6
  import FrameOfReferenceSpecificAnnotationManager from './FrameOfReferenceSpecificAnnotationManager';
7
7
  import AnnotationGroup from './AnnotationGroup';
8
+ import { resetAnnotationManager } from './resetAnnotationManager';
9
+ const state = {
10
+ ...annotationState,
11
+ resetAnnotationManager,
12
+ };
8
13
  export { config, locking, selection, state, visibility, FrameOfReferenceSpecificAnnotationManager, AnnotationGroup, };
@@ -0,0 +1 @@
1
+ export declare function resetAnnotationManager(): void;
@@ -0,0 +1,21 @@
1
+ import { checkAndDefineCachedStatsProperty, checkAndDefineTextBoxProperty, } from './utilities/defineProperties';
2
+ import { checkAndSetAnnotationLocked } from './annotationLocking';
3
+ import { checkAndSetAnnotationVisibility } from './annotationVisibility';
4
+ import { defaultFrameOfReferenceSpecificAnnotationManager } from './FrameOfReferenceSpecificAnnotationManager';
5
+ import { setAnnotationManager } from './annotationState';
6
+ const defaultManager = defaultFrameOfReferenceSpecificAnnotationManager;
7
+ const preprocessingFn = (annotation) => {
8
+ annotation = checkAndDefineTextBoxProperty(annotation);
9
+ annotation = checkAndDefineCachedStatsProperty(annotation);
10
+ const uid = annotation.annotationUID;
11
+ const isLocked = checkAndSetAnnotationLocked(uid);
12
+ annotation.isLocked = isLocked;
13
+ const isVisible = checkAndSetAnnotationVisibility(uid);
14
+ annotation.isVisible = isVisible;
15
+ return annotation;
16
+ };
17
+ defaultManager.setPreprocessingFn(preprocessingFn);
18
+ setAnnotationManager(defaultManager);
19
+ export function resetAnnotationManager() {
20
+ setAnnotationManager(defaultManager);
21
+ }
@@ -13,6 +13,6 @@ import { clearParentAnnotation } from './annotation/annotationState';
13
13
  import { addChildAnnotation } from './annotation/annotationState';
14
14
  import { setAnnotationManager } from './annotation/annotationState';
15
15
  import { getAnnotationManager } from './annotation/annotationState';
16
- import { resetAnnotationManager } from './annotation/annotationState';
16
+ import { resetAnnotationManager } from './annotation/resetAnnotationManager';
17
17
  import { invalidateAnnotation } from './annotation/annotationState';
18
18
  export { FrameOfReferenceSpecificAnnotationManager, defaultFrameOfReferenceSpecificAnnotationManager, annotationLocking, annotationSelection, getAnnotations, addAnnotation, getNumberOfAnnotations, removeAnnotation, getAnnotation, getParentAnnotation, getChildAnnotations, clearParentAnnotation, addChildAnnotation, setAnnotationManager, getAnnotationManager, resetAnnotationManager, invalidateAnnotation };
@@ -1,5 +1,6 @@
1
1
  import FrameOfReferenceSpecificAnnotationManager, { defaultFrameOfReferenceSpecificAnnotationManager, } from './annotation/FrameOfReferenceSpecificAnnotationManager';
2
2
  import * as annotationLocking from './annotation/annotationLocking';
3
3
  import * as annotationSelection from './annotation/annotationSelection';
4
- import { getAnnotations, addAnnotation, removeAnnotation, getAnnotation, getParentAnnotation, getChildAnnotations, clearParentAnnotation, addChildAnnotation, getNumberOfAnnotations, setAnnotationManager, getAnnotationManager, resetAnnotationManager, invalidateAnnotation, } from './annotation/annotationState';
4
+ import { getAnnotations, addAnnotation, removeAnnotation, getAnnotation, getParentAnnotation, getChildAnnotations, clearParentAnnotation, addChildAnnotation, getNumberOfAnnotations, setAnnotationManager, getAnnotationManager, invalidateAnnotation, } from './annotation/annotationState';
5
+ import { resetAnnotationManager } from './annotation/resetAnnotationManager';
5
6
  export { FrameOfReferenceSpecificAnnotationManager, defaultFrameOfReferenceSpecificAnnotationManager, annotationLocking, annotationSelection, getAnnotations, addAnnotation, getNumberOfAnnotations, removeAnnotation, getAnnotation, getParentAnnotation, getChildAnnotations, clearParentAnnotation, addChildAnnotation, setAnnotationManager, getAnnotationManager, resetAnnotationManager, invalidateAnnotation, };
@@ -6,5 +6,5 @@ export function triggerSegmentationRepresentationModified(viewportId, segmentati
6
6
  type,
7
7
  viewportId,
8
8
  };
9
- triggerEvent(eventTarget, Events.SEGMENTATION_REPRESENTATION_ADDED, eventDetail);
9
+ triggerEvent(eventTarget, Events.SEGMENTATION_REPRESENTATION_MODIFIED, eventDetail);
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "types": "./dist/esm/index.d.ts",
6
6
  "module": "./dist/esm/index.js",
@@ -104,7 +104,7 @@
104
104
  "canvas": "^2.11.2"
105
105
  },
106
106
  "peerDependencies": {
107
- "@cornerstonejs/core": "^2.5.0",
107
+ "@cornerstonejs/core": "^2.5.2",
108
108
  "@kitware/vtk.js": "32.1.1",
109
109
  "@types/d3-array": "^3.0.4",
110
110
  "@types/d3-interpolate": "^3.0.1",
@@ -123,5 +123,5 @@
123
123
  "type": "individual",
124
124
  "url": "https://ohif.org/donate"
125
125
  },
126
- "gitHead": "e93ccb2022cd1e695f551aef666072b0cbb60952"
126
+ "gitHead": "01d0c22a5d558298d531f20595bea3dc1304482a"
127
127
  }
@@ -1,2 +0,0 @@
1
- import type { Annotation } from '../../types';
2
- export declare function getAnnotation(annotationUID: string): Annotation;
@@ -1,6 +0,0 @@
1
- import { defaultFrameOfReferenceSpecificAnnotationManager } from './FrameOfReferenceSpecificAnnotationManager';
2
- export function getAnnotation(annotationUID) {
3
- const manager = defaultFrameOfReferenceSpecificAnnotationManager;
4
- const annotation = manager.getAnnotation(annotationUID);
5
- return annotation;
6
- }