larvitar 1.5.14 → 2.0.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.
Files changed (107) hide show
  1. package/.vscode/settings.json +4 -0
  2. package/README.md +78 -48
  3. package/bundler/webpack.common.js +27 -0
  4. package/bundler/webpack.dev.js +23 -0
  5. package/bundler/webpack.prod.js +19 -0
  6. package/decs.d.ts +12 -0
  7. package/dist/imaging/MetaDataReadable.d.ts +40 -0
  8. package/dist/imaging/MetaDataTypes.d.ts +3489 -0
  9. package/dist/imaging/imageAnonymization.d.ts +12 -0
  10. package/dist/imaging/imageColormaps.d.ts +47 -0
  11. package/dist/imaging/imageContours.d.ts +18 -0
  12. package/dist/imaging/imageIo.d.ts +42 -0
  13. package/dist/imaging/imageLayers.d.ts +56 -0
  14. package/dist/imaging/imageLoading.d.ts +65 -0
  15. package/dist/imaging/imageParsing.d.ts +46 -0
  16. package/dist/imaging/imagePresets.d.ts +43 -0
  17. package/dist/imaging/imageRendering.d.ts +238 -0
  18. package/dist/imaging/imageReslice.d.ts +14 -0
  19. package/dist/imaging/imageStore.d.ts +121 -0
  20. package/dist/imaging/imageTags.d.ts +22 -0
  21. package/dist/imaging/imageTools.d.ts +20 -0
  22. package/dist/imaging/imageUtils.d.ts +165 -0
  23. package/dist/imaging/loaders/commonLoader.d.ts +103 -0
  24. package/dist/imaging/loaders/dicomLoader.d.ts +29 -0
  25. package/dist/imaging/loaders/fileLoader.d.ts +33 -0
  26. package/dist/imaging/loaders/multiframeLoader.d.ts +37 -0
  27. package/dist/imaging/loaders/nrrdLoader.d.ts +113 -0
  28. package/dist/imaging/loaders/resliceLoader.d.ts +15 -0
  29. package/dist/imaging/monitors/memory.d.ts +41 -0
  30. package/dist/imaging/monitors/performance.d.ts +23 -0
  31. package/dist/imaging/parsers/ecg.d.ts +15 -0
  32. package/dist/imaging/parsers/nrrd.d.ts +3 -0
  33. package/dist/imaging/tools/custom/4dSliceScrollTool.d.ts +12 -0
  34. package/dist/imaging/tools/custom/BorderMagnifyTool.d.ts +18 -0
  35. package/dist/imaging/tools/custom/contourTool.d.ts +409 -0
  36. package/dist/imaging/tools/custom/diameterTool.d.ts +18 -0
  37. package/dist/imaging/tools/custom/editMaskTool.d.ts +22 -0
  38. package/dist/imaging/tools/custom/ellipticalRoiOverlayTool.d.ts +45 -0
  39. package/dist/imaging/tools/custom/polygonSegmentationMixin.d.ts +54 -0
  40. package/dist/imaging/tools/custom/polylineScissorsTool.d.ts +11 -0
  41. package/dist/imaging/tools/custom/rectangleRoiOverlayTool.d.ts +45 -0
  42. package/dist/imaging/tools/custom/seedTool.d.ts +0 -0
  43. package/dist/imaging/tools/custom/setLabelMap3D.d.ts +39 -0
  44. package/dist/imaging/tools/custom/thresholdsBrushTool.d.ts +19 -0
  45. package/dist/imaging/tools/default.d.ts +53 -0
  46. package/dist/imaging/tools/interaction.d.ts +30 -0
  47. package/dist/imaging/tools/io.d.ts +38 -0
  48. package/dist/imaging/tools/main.d.ts +81 -0
  49. package/dist/imaging/tools/segmentation.d.ts +125 -0
  50. package/dist/imaging/tools/state.d.ts +17 -0
  51. package/dist/imaging/tools/strategies/eraseFreehand.d.ts +16 -0
  52. package/dist/imaging/tools/strategies/fillFreehand.d.ts +16 -0
  53. package/dist/imaging/tools/strategies/index.d.ts +2 -0
  54. package/dist/imaging/waveforms/ecg.d.ts +39 -0
  55. package/dist/index.d.ts +35 -0
  56. package/dist/larvitar.js +90104 -0
  57. package/dist/larvitar.js.map +1 -0
  58. package/imaging/MetaDataReadable.ts +41 -0
  59. package/imaging/MetaDataTypes.ts +3491 -0
  60. package/imaging/dataDictionary.json +5328 -5328
  61. package/imaging/{imageAnonymization.js → imageAnonymization.ts} +41 -13
  62. package/imaging/{imageColormaps.js → imageColormaps.ts} +48 -30
  63. package/imaging/{imageContours.js → imageContours.ts} +24 -22
  64. package/imaging/{imageIo.js → imageIo.ts} +89 -52
  65. package/imaging/{imageLayers.js → imageLayers.ts} +31 -14
  66. package/imaging/{imageLoading.js → imageLoading.ts} +107 -43
  67. package/imaging/{imageParsing.js → imageParsing.ts} +160 -80
  68. package/imaging/{imagePresets.js → imagePresets.ts} +44 -11
  69. package/imaging/imageRendering.ts +1091 -0
  70. package/imaging/{imageReslice.js → imageReslice.ts} +18 -9
  71. package/imaging/imageStore.ts +487 -0
  72. package/imaging/imageTags.ts +609 -0
  73. package/imaging/imageTools.js +2 -1
  74. package/imaging/{imageUtils.js → imageUtils.ts} +211 -701
  75. package/imaging/loaders/{commonLoader.js → commonLoader.ts} +73 -24
  76. package/imaging/loaders/{dicomLoader.js → dicomLoader.ts} +25 -5
  77. package/imaging/loaders/{fileLoader.js → fileLoader.ts} +5 -5
  78. package/imaging/loaders/{multiframeLoader.js → multiframeLoader.ts} +145 -90
  79. package/imaging/loaders/{nrrdLoader.js → nrrdLoader.ts} +231 -64
  80. package/imaging/loaders/{resliceLoader.js → resliceLoader.ts} +51 -20
  81. package/imaging/monitors/{memory.js → memory.ts} +54 -8
  82. package/imaging/monitors/performance.ts +34 -0
  83. package/imaging/parsers/ecg.ts +54 -0
  84. package/imaging/tools/README.md +27 -0
  85. package/imaging/tools/custom/4dSliceScrollTool.js +47 -46
  86. package/imaging/tools/custom/BorderMagnifyTool.js +99 -0
  87. package/imaging/tools/custom/ellipticalRoiOverlayTool.js +534 -0
  88. package/imaging/tools/custom/polylineScissorsTool.js +1 -1
  89. package/imaging/tools/custom/rectangleRoiOverlayTool.js +564 -0
  90. package/imaging/tools/{setLabelMap3D.js → custom/setLabelMap3D.ts} +19 -25
  91. package/imaging/tools/{default.js → default.ts} +119 -33
  92. package/imaging/tools/{interaction.js → interaction.ts} +42 -23
  93. package/imaging/tools/{io.js → io.ts} +47 -31
  94. package/imaging/tools/{main.js → main.ts} +105 -40
  95. package/imaging/tools/{segmentation.js → segmentation.ts} +95 -68
  96. package/imaging/tools/{state.js → state.ts} +7 -12
  97. package/imaging/tools/types.d.ts +243 -0
  98. package/imaging/types.d.ts +200 -0
  99. package/imaging/waveforms/ecg.ts +191 -0
  100. package/{index.js → index.ts} +53 -14
  101. package/jsdoc.json +1 -1
  102. package/package.json +35 -14
  103. package/tsconfig.json +102 -0
  104. package/imaging/imageRendering.js +0 -860
  105. package/imaging/imageStore.js +0 -322
  106. package/modules/vuex/larvitar.js +0 -187
  107. /package/imaging/tools/{polygonSegmentationMixin.js → custom/polygonSegmentationMixin.js} +0 -0
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @public
3
+ * @class RectangleRoiTool
4
+ * @memberof Tools.Annotation
5
+ * @classdesc Tool for drawing rectangular regions of interest, and measuring
6
+ * the statistics of the enclosed pixels.
7
+ * @extends Tools.Base.BaseAnnotationTool
8
+ */
9
+ export default class RectangleRoiOverlayTool {
10
+ constructor(props?: {});
11
+ throttledUpdateCachedStats: any;
12
+ createNewMeasurement(eventData: any): {
13
+ computeMeasurements: any;
14
+ visible: boolean;
15
+ active: boolean;
16
+ color: undefined;
17
+ invalidated: boolean;
18
+ handles: {
19
+ start: {
20
+ x: any;
21
+ y: any;
22
+ highlight: boolean;
23
+ active: boolean;
24
+ };
25
+ end: {
26
+ x: any;
27
+ y: any;
28
+ highlight: boolean;
29
+ active: boolean;
30
+ };
31
+ initialRotation: any;
32
+ textBox: {
33
+ active: boolean;
34
+ hasMoved: boolean;
35
+ movesIndependently: boolean;
36
+ drawnIndependently: boolean;
37
+ allowedOutsideImage: boolean;
38
+ hasBoundingBox: boolean;
39
+ };
40
+ };
41
+ } | undefined;
42
+ pointNearTool(element: any, data: any, coords: any, interactionType: any): boolean;
43
+ updateCachedStats(image: any, element: any, data: any): void;
44
+ renderToolData(evt: any): void;
45
+ }
File without changes
@@ -0,0 +1,39 @@
1
+ /**
2
+ * This is a custom version of setLabelMap3D from cs tools source code
3
+ * This let us implement a non-blocking version of the for loop that loads 3d labelmaps on a volume
4
+ * @ronzim
5
+ */
6
+ import { EnabledElement } from "cornerstone-core";
7
+ /**
8
+ * Takes a 16-bit encoded `ArrayBuffer` and stores it as a `Labelmap3D` for the
9
+ * `BrushStackState` associated with the element.
10
+ *
11
+ * @param {HTMLElement|string} elementOrEnabledElementUID The cornerstone
12
+ * enabled element or its UUID.
13
+ * @param {ArrayBuffer} buffer
14
+ * @param {number} labelmapIndex The index to store the labelmap under.
15
+ * @param {Object[]} metadata = [] Any metadata about the segments.
16
+ * @param {number[][]} [segmentsOnLabelmapArray] An array of array of segments on each imageIdIndex.
17
+ * If not present, is calculated.
18
+ * @param {colorLUTIndex} [colorLUTIndex = 0] The index of the colorLUT to use to render the segmentation.
19
+ * @returns {null}
20
+ */
21
+ declare function setLabelmap3DForElement(elementOrEnabledElementUID: EnabledElement | string, buffer: ArrayBuffer, labelmapIndex: number, metadata: Object[] | undefined, segmentsOnLabelmapArray: number[][], colorLUTIndex?: number): Promise<unknown>;
22
+ /**
23
+ * Takes an 16-bit encoded `ArrayBuffer` and stores it as a `Labelmap3D` for
24
+ * the `BrushStackState` associated with the firstImageId.
25
+ *
26
+ * @param {HTMLElement|string} firstImageId The firstImageId of the series to
27
+ * store the segmentation on.
28
+ * @param {ArrayBuffer} buffer
29
+ * @param {number} labelmapIndex The index to store the labelmap under.
30
+ * @param {Object[]} metadata = [] Any metadata about the segments.
31
+ * @param {number} numberOfFrames The number of frames, required to set up the
32
+ * relevant labelmap2D views.
33
+ * @param {number[][]} [segmentsOnLabelmapArray] An array of array of segments on each imageIdIndex.
34
+ * If not present, is calculated.
35
+ * @param {colorLUTIndex} [colorLUTIndex = 0] The index of the colorLUT to use to render the segmentation.
36
+ * @returns {null}
37
+ */
38
+ declare function setLabelmap3DByFirstImageId(firstImageId: string, buffer: ArrayBuffer, labelmapIndex: number, metadata: Object[] | undefined, numberOfFrames: number, segmentsOnLabelmapArray: number[][], colorLUTIndex?: number): Promise<unknown>;
39
+ export { setLabelmap3DByFirstImageId, setLabelmap3DForElement };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @public
3
+ * @class ThresholdsBrushTool
4
+ * @memberof Tools.Brush
5
+ * @classdesc Tool for drawing segmentations on an image (only pixels inside thresholds)
6
+ * @extends Tools.Base.BaseBrushTool
7
+ */
8
+ export default class ThresholdsBrushTool {
9
+ constructor(props?: {});
10
+ touchDragCallback: (evt: Object) => void;
11
+ /**
12
+ * Paints the data to the labelmap.
13
+ *
14
+ * @protected
15
+ * @param {Object} evt The data object associated with the event.
16
+ * @returns {void}
17
+ */
18
+ protected _paint(evt: Object): void;
19
+ }
@@ -0,0 +1,53 @@
1
+ /** @module imaging/tools/default
2
+ * @desc This file provides definitions
3
+ * for default tools
4
+ */
5
+ import type { ToolConfig, ToolMouseKeys, ToolSettings, ToolStyle } from "./types";
6
+ /**
7
+ * These tools are added with `addDefaultTools()`
8
+ */
9
+ declare const DEFAULT_TOOLS: {
10
+ [key: string]: ToolConfig;
11
+ };
12
+ /**
13
+ * D/Vision Lab custom tools
14
+ */
15
+ declare const dvTools: {
16
+ [key: string]: any;
17
+ };
18
+ /**
19
+ * Tools default style
20
+ * Available font families :
21
+ * Work Sans, Roboto, OpenSans, HelveticaNeue-Light,
22
+ * Helvetica Neue Light, Helvetica Neue, Helvetica,
23
+ * Arial, Lucida Grande, sans-serif;
24
+ */
25
+ declare const DEFAULT_STYLE: ToolStyle;
26
+ /**
27
+ * Tools default settings
28
+ */
29
+ declare const DEFAULT_SETTINGS: ToolSettings;
30
+ /**
31
+ * Shortcut and mouse bindings defaults
32
+ */
33
+ declare const DEFAULT_MOUSE_KEYS: ToolMouseKeys;
34
+ /**
35
+ * Get available tools by type (useful to populate menus)
36
+ * @param {String} type
37
+ */
38
+ declare const getDefaultToolsByType: (type: NonNullable<ToolConfig["type"]>) => ToolConfig[];
39
+ /**
40
+ * Override default tools props
41
+ * @param {Array} newProps - An array of objects as in the DEFAULT_TOOLS list, but with a subset of props
42
+ * NOTE: prop "name" is mandatory
43
+ */
44
+ declare const setDefaultToolsProps: (newProps: Partial<ToolConfig>[]) => void;
45
+ /**
46
+ * Register a custom tool
47
+ * @param {String} toolName - The name of the tool
48
+ * @param {Object} toolClass - The tool class
49
+ * NOTE: toolName must be unique
50
+ * NOTE: toolClass must be a valid cornerstone tool
51
+ */
52
+ declare const registerExternalTool: (toolName: string, toolClass: any) => void;
53
+ export { DEFAULT_TOOLS, DEFAULT_STYLE, DEFAULT_SETTINGS, DEFAULT_MOUSE_KEYS, dvTools, getDefaultToolsByType, setDefaultToolsProps, registerExternalTool };
@@ -0,0 +1,30 @@
1
+ /** @module imaging/tools/interaction
2
+ * @desc This file provides functionalities for
3
+ * tools interactions
4
+ */
5
+ import type { ToolMouseKeys } from "./types";
6
+ /**
7
+ * Setup mouse handler modifiers and keyboard shortcuts:
8
+ * register a tool on right button and another one
9
+ * when pressing a modifier (ctrl/shift/alt) + right button
10
+ * The activation take place on all active viewports (we added a check to activate only on viewports
11
+ * in which the tool has been added previously)
12
+ * Improvements could be:
13
+ * - "restore previous active tool" instead of passed "default" tool
14
+ * - manage left button (an idea could be to cycle over object keys for both buttons)
15
+ * - possibility to change modifier keys
16
+ * @param {Object} config - see tools/default
17
+ */
18
+ export declare function addMouseKeyHandlers(config: ToolMouseKeys): void;
19
+ /**
20
+ *
21
+ */
22
+ export declare function removeMouseKeyHandlers(): void;
23
+ /**
24
+ * Add event handlers to mouse move
25
+ * @instance
26
+ * @function toggleMouseHandlers
27
+ * @param {String | HTMLElement} elementId - The html div id used for rendering or its DOM HTMLElement
28
+ * @param {Boolean} disable - If true disable handlers, default is false
29
+ */
30
+ export declare const toggleMouseToolsListeners: (elementId: string | HTMLElement, disable: boolean) => void;
@@ -0,0 +1,38 @@
1
+ /** @module imaging/tools/io
2
+ * @desc This file provides functionalities for
3
+ * tools input/output
4
+ */
5
+ import type { ToolState } from "./types";
6
+ import { fileManager } from "../loaders/fileLoader";
7
+ declare global {
8
+ interface Document {
9
+ documentMode?: any;
10
+ }
11
+ interface Navigator {
12
+ msSaveBlob?: (blob: any, defaultName?: string) => boolean;
13
+ }
14
+ }
15
+ /**
16
+ * Load annotation from json object
17
+ * @param {Object} jsonData - The previously saved tools state
18
+ */
19
+ export declare const loadAnnotations: (jsonData: ToolState) => void;
20
+ /**
21
+ * Save annotations from current stack, download as json file if requested
22
+ * @param {bool} download - True to download json
23
+ * @param {string} filename - The json file name, @default state.json
24
+ */
25
+ export declare const saveAnnotations: (download: boolean, filename?: string) => any;
26
+ /**
27
+ * Save annotation from current stack, download as csv file
28
+ * containing only useful informations for user
29
+ */
30
+ export declare const exportAnnotations: (manager: typeof fileManager, filename?: string) => void;
31
+ /**
32
+ *
33
+ * @param {*} allToolState
34
+ */
35
+ export declare function generateCSV(manager: typeof fileManager, allToolState: ToolState): {
36
+ fieldsArr: string[];
37
+ data: Object[];
38
+ };
@@ -0,0 +1,81 @@
1
+ /** @module imaging/tools/main
2
+ * @desc This file provides functionalities
3
+ * for initializing tools and stacks
4
+ */
5
+ import { saveAnnotations, loadAnnotations, exportAnnotations } from "./io";
6
+ import type { ToolConfig, ToolSettings, ToolStyle } from "./types";
7
+ /**
8
+ * Initialize cornerstone tools with default configuration (extended with custom configuration)
9
+ * @function initializeCSTools
10
+ * @param {Object} settings - the settings object (see tools/default.js)
11
+ * @param {Object} settings - the style object (see tools/default.js)
12
+ * @example larvitar.initializeCSTools({showSVGCursors:false}, {color: "0000FF"});
13
+ */
14
+ declare const initializeCSTools: (settings?: ToolSettings, style?: ToolStyle) => void;
15
+ /**
16
+ * Create stack object to sync stack tools
17
+ * @function csToolsCreateStack
18
+ * @param {HTMLElement} element - The target hmtl element.
19
+ * @param {Array?} imageIds - Stack image ids.
20
+ * @param {String} currentImageId - The current image id.
21
+ */
22
+ declare const csToolsCreateStack: (element: HTMLElement, imageIds?: string[], currentImageIndex?: number) => void;
23
+ export declare function csToolsUpdateImageIds(elementId: string, imageIds: string[], imageIdIndex: number): void;
24
+ /**
25
+ * Update currentImageIdIndex in cs tools stack
26
+ * @param {String} elementId - The target html element id
27
+ * @param {String} imageId - The imageId in the form xxxxxx//:imageIndex
28
+ */
29
+ export declare function csToolsUpdateImageIndex(elementId: string, imageId: string): void;
30
+ /**
31
+ * Add a cornerstone tool (grab it from original library or dvision custom tools)
32
+ * @param {*} toolName
33
+ * @param {*} targetElementId
34
+ * @example larvitar.addTool("ScaleOverlay", {configuration:{minorTickLength: 10, majorTickLength: 25}}, "viewer")
35
+ */
36
+ declare const addTool: (toolName: string, customConfig: Partial<ToolConfig>, targetElementId?: string) => void;
37
+ /**
38
+ * Add all default tools, as listed in tools/default.js
39
+ * @function addDefaultTools
40
+ */
41
+ export declare const addDefaultTools: (elementId: string) => void;
42
+ /**
43
+ * Set Tool "active" on all elements (ie, rendered and manipulable) & refresh cornerstone elements
44
+ * @function setToolActive
45
+ * @param {String} toolName - The tool name.
46
+ * @param {Object} options - The custom options. @default from tools/default.js
47
+ * @param {Array} viewports - The hmtl element id to be used for tool initialization.
48
+ * @param {Boolean} doNotSetInStore - Flag to avoid setting in store (useful on tools initialization eg in addDefaultTools). NOTE: This is just a hack, we must rework tools/ui sync.
49
+ */
50
+ declare const setToolActive: (toolName: string, options?: Partial<ToolConfig["options"]>, viewports?: string[], doNotSetInStore?: boolean) => void;
51
+ /**
52
+ * Set Tool "disabled" on all elements (ie, not rendered) & refresh cornerstone elements
53
+ * @function setToolDisabled
54
+ * @param {String} toolName - The tool name.
55
+ * @param {Array} viewports - The hmtl element id to be used for tool initialization.
56
+ * @param {Boolean} resetCursor - Flag to restore native cursor. @default true
57
+ */
58
+ declare const setToolDisabled: (toolName: string, viewports?: string[], resetCursor?: boolean) => void;
59
+ /**
60
+ * Set Tool "enabled" on all elements (ie, rendered but not manipulable) & refresh cornerstone elements
61
+ * @function setToolEnabled
62
+ * @param {String} toolName - The tool name.
63
+ * @param {Array} viewports - The hmtl element id to be used for tool initialization.
64
+ * @param {Boolean} resetCursor - Flag to restore native cursor. @default true
65
+ */
66
+ declare const setToolEnabled: (toolName: string, viewports?: string[], resetCursor?: boolean) => void;
67
+ /**
68
+ * Set Tool "enabled" on all elements (ie, rendered and manipulable passively) & refresh cornerstone elements
69
+ * @function setToolPassive
70
+ * @param {String} toolName - The tool name.
71
+ * @param {Array} viewports - The hmtl element id to be used for tool initialization.
72
+ */
73
+ declare const setToolPassive: (toolName: string, viewports?: string[]) => void;
74
+ /** @inner Internal module functions */
75
+ /**
76
+ * Set cornerstone tools custom configuration (extend default configuration)
77
+ * @function setToolsStyle
78
+ * @param {Object} style - the style object (see tools/defaults.js)
79
+ */
80
+ declare const setToolsStyle: (style?: ToolStyle) => void;
81
+ export { initializeCSTools, setToolsStyle, csToolsCreateStack, addTool, setToolActive, setToolEnabled, setToolDisabled, setToolPassive, saveAnnotations, loadAnnotations, exportAnnotations };
@@ -0,0 +1,125 @@
1
+ /** @module imaging/tools/segmentation
2
+ * @desc This file provides functionalities
3
+ * for handling masks and luts
4
+ */
5
+ import { BrushProperties, MaskProperties, SegmentationConfig } from "./types.d";
6
+ import type { TypedArray } from "../types";
7
+ export declare function rgbToHex(c: number[]): string;
8
+ export declare function hexToRgb(hex: string): number[];
9
+ /**
10
+ * Force cs tools refresh on all enabled images
11
+ */
12
+ export declare function forceRender(): void;
13
+ /**
14
+ * Set color for label
15
+ * @param {Number} labelId
16
+ * @param {String} color in hex format
17
+ */
18
+ export declare function setLabelColor(labelId: string, color: string): void;
19
+ /**
20
+ * Get color from label
21
+ * @param {Number} labelId
22
+ * @returns {String} Color in hex format
23
+ */
24
+ export declare function getLabelColor(labelId: string): string;
25
+ /**
26
+ * A function to group all settings to load before masks
27
+ * @param {Object} customConfig - Object containing override values for segmentation module config
28
+ */
29
+ export declare function initSegmentationModule(customConfig: SegmentationConfig): void;
30
+ /**
31
+ * Add segmentation mask to segmentation module
32
+ * @param {Object} props - The mask properties (labelId, color and opacity)
33
+ * @param {TypedArray} - The mask data array
34
+ * @param {String} elementId - The target html element Id or its DOM HTMLElement
35
+ * @returns {Promise} - Return a promise which will resolve when segmentation mask is added
36
+ */
37
+ export declare function addSegmentationMask(props: MaskProperties, data: TypedArray, elementId: string | HTMLElement): Promise<void>;
38
+ /**
39
+ * Set a new mask slice into the labelmap buffer
40
+ * @param {String} elementId - The target html element Id or its DOM HTMLElement
41
+ * @param {Number} sliceIndex - the index of the new mask slice
42
+ * @param {ArrayBuffer} pixelData - the pixelData array
43
+ */
44
+ export declare function loadMaskSlice(elementId: string | HTMLElement, sliceIndex: number, pixelData: TypedArray): void;
45
+ /**
46
+ * Activate a specific labelmap through its labelId
47
+ * @param {Number} labelId - The labelmap id to activate
48
+ * @param {String} elementId - The target html element Id or its DOM HTMLElement
49
+ */
50
+ export declare function setActiveLabelmap(labelId: number, elementId: string | HTMLElement): void;
51
+ /**
52
+ * Get active labelmap for target element
53
+ * @param {String} elementId - The target html element Id or its DOM HTMLElement
54
+ * @returns {Object} The active labelmap object that contains the buffer
55
+ */
56
+ export declare function getActiveLabelmapBuffer(elementId: string | HTMLElement): any;
57
+ /**
58
+ * Activate a specific segment through its index
59
+ * @param {Number} segmentIndex - The segment index to activate
60
+ * @param {String} elementId - The target html element Id or its DOM HTMLElement
61
+ */
62
+ export declare function setActiveSegment(segmentIndex: number, elementId: string | HTMLElement): void;
63
+ /**
64
+ * Change opacity for active label
65
+ * @param {Number} opacity - The desired opacity value
66
+ */
67
+ export declare function setActiveLabelOpacity(opacity: number): void;
68
+ /**
69
+ * Change opacity for inactive labels
70
+ * @param {Number} opacity - The desired opacity value
71
+ */
72
+ export declare function setInactiveLabelOpacity(opacity: number): void;
73
+ /**
74
+ * Toggle mask visibility
75
+ * @param {String} elementId - The target html element Id or its DOM HTMLElement
76
+ * @param {Number} labelId - The id of the mask label
77
+ */
78
+ export declare function toggleVisibility(elementId: string | HTMLElement, labelId: number): void;
79
+ /**
80
+ * Toggle between 'contours mode' and 'filled mode'
81
+ * @param {Bool} toggle - Contour mode enabled if true
82
+ */
83
+ export declare function toggleContourMode(toggle: boolean): void;
84
+ /**
85
+ * Set mask appearance props
86
+ * @param {Object} maskProps - The mask appearance props (labelId, visualization [0=filled, 1=contour, 2=hidden], opacity (if mode=0), between 0 and 1)
87
+ */
88
+ export declare function setMaskProps(props: MaskProperties): void;
89
+ /**
90
+ * Clear state for segmentation module
91
+ */
92
+ export declare function clearSegmentationState(): void;
93
+ /**
94
+ * Enable brushing
95
+ * NOTE: if options contains `thresholds`, ThresholdsBrush is activated, otherwise BrushTool is activated.
96
+ * Anyway, the activated tool name is returned
97
+ * @param {Object} options - An object containing configuration values (eg radius, thresholds, etc...)
98
+ */
99
+ export declare function enableBrushTool(viewports: string[], options: BrushProperties): "Brush" | "ThresholdsBrush";
100
+ /**
101
+ * Disable brushing
102
+ * This function disables both brush tools, if found active on `viewports`
103
+ * @param {String} toolToActivate - The name of the tool to activate after removing the brush @optional
104
+ */
105
+ export declare function disableBrushTool(viewports: string[], toolToActivate?: string): void;
106
+ /**
107
+ * Change the brush props
108
+ * @param {Object} props - The new brush props {radius: number[px], thresholds: array[min,max]}
109
+ */
110
+ export declare function setBrushProps(props: BrushProperties): void;
111
+ /**
112
+ * Undo last brush operation (stroke)
113
+ * @param {String} elementId - The target html element Id or its DOM HTMLElement
114
+ */
115
+ export declare function undoLastStroke(elementId: string | HTMLElement): void;
116
+ /**
117
+ * Redo last brush operation (stroke)
118
+ * @param {String} elementId - The target html element Id or its DOM HTMLElement
119
+ */
120
+ export declare function redoLastStroke(elementId: string | HTMLElement): void;
121
+ /**
122
+ * Delete mask from state
123
+ * @param {Number} labelId - The labelmap id to delete
124
+ */
125
+ export declare function deleteMask(labelId: number): void;
@@ -0,0 +1,17 @@
1
+ /** @module imaging/tools/state
2
+ * @desc This file provides functionalities
3
+ * for handling tools' state
4
+ */
5
+ import type { ToolState } from "./types";
6
+ /**
7
+ *
8
+ * @param {*} elementId
9
+ */
10
+ declare const saveToolState: (elementId: string) => any;
11
+ /**
12
+ *
13
+ * @param {*} elementId
14
+ * @param {*} allToolState
15
+ */
16
+ declare const restoreToolState: (elementId: string, allToolState: ToolState) => void;
17
+ export { saveToolState, restoreToolState };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Erase all pixels inside/outside the region defined by `operationData.points`.
3
+ * @param {} evt The Cornerstone event.
4
+ * @param {} operationData An object containing the `pixelData` to
5
+ * modify, the `segmentIndex` and the `points` array.
6
+ * @returns {null}
7
+ */
8
+ export function eraseInsideFreehand(evt: any, operationData: any): null;
9
+ /**
10
+ * Erase all pixels outside the region defined by `operationData.points`.
11
+ * @param {} evt The Cornerstone event.
12
+ * @param {} operationData An object containing the `pixelData` to
13
+ * modify, the `segmentIndex` and the `points` array.
14
+ * @returns {null}
15
+ */
16
+ export function eraseOutsideFreehand(evt: any, operationData: any): null;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Fill all pixels inside/outside the region defined by `operationData.points`.
3
+ * @param {} evt The Cornerstone event.
4
+ * @param {} operationData An object containing the `pixelData` to
5
+ * modify, the `segmentIndex` and the `points` array.
6
+ * @returns {null}
7
+ */
8
+ export function fillInsideFreehand(evt: any, operationData: any): null;
9
+ /**
10
+ * Fill all pixels outside the region defined by `operationData.points`.
11
+ * @param {} evt The Cornerstone event.
12
+ * @param {} operationData An object containing the `pixelData` to
13
+ * modify, the `segmentIndex` and the `points` array.
14
+ * @returns {null}
15
+ */
16
+ export function fillOutsideFreehand(evt: any, operationData: any): null;
@@ -0,0 +1,2 @@
1
+ export { eraseInsideFreehand, eraseOutsideFreehand } from "./eraseFreehand";
2
+ export { fillInsideFreehand, fillOutsideFreehand } from "./fillFreehand";
@@ -0,0 +1,39 @@
1
+ /** @module waveforms/ecg
2
+ * @desc This file provides utility functions for
3
+ * rendering ecg waveforms using plotly.js
4
+ */
5
+ import Plotly from "plotly.js-dist-min";
6
+ /**
7
+ * Render ECG waveform in a div
8
+ * @instance
9
+ * @function renderECG
10
+ * @param {number[]} data - ECG waveform data
11
+ * @param {string} divId - DivId to render waveform in
12
+ * @param {string} colorMarker - Color of the marker
13
+ * @param {number} numberOfframes - Number of frames in the image
14
+ * @param {number} frameTime - Time interval of each frame in the image
15
+ * @param {number} frameId - FrameId of the image to be rendered
16
+ * @returns {Object} traceData - Plotly trace data
17
+ */
18
+ export declare const renderECG: (data: number[], divId: string, colorMarker: string, numberOfFrames: number, frameTime: number, frameId?: number) => Partial<Plotly.PlotData>[];
19
+ /**
20
+ * Sync ECG waveform with rendered image on click
21
+ * @instance
22
+ * @function syncECGFrame
23
+ * @param {Object} traceData - Plotly trace data
24
+ * @param {string} seriesId - SeriesId of the image
25
+ * @param {string} canvasId - CanvasId of the image
26
+ * @param {number} numberOfFrames - Number of frames in the image
27
+ * @param {string} divId - DivId to render waveform in
28
+ */
29
+ export declare const syncECGFrame: (traceData: Partial<Plotly.PlotData>[], seriesId: string, canvasId: string, numberOfFrames: number, divId: string) => void;
30
+ /**
31
+ * Sync ECG waveform with rendered image on click
32
+ * @instance
33
+ * @function updateECGFrame
34
+ * @param {Object} traceData - Plotly trace data
35
+ * @param {number} frameId - FrameId of the image
36
+ * @param {number} numberOfFrames - Number of frames in the image
37
+ * @param {string} divId - DivId to render waveform in
38
+ */
39
+ export declare const updateECGFrame: (traceData: Partial<Plotly.PlotData>[], frameId: number, numberOfFrames: number, divId: string) => void;
@@ -0,0 +1,35 @@
1
+ declare const VERSION: string;
2
+ import cornerstone from "cornerstone-core";
3
+ import cornerstoneTools from "cornerstone-tools";
4
+ import { parseDicom } from "dicom-parser";
5
+ import { default as cornerstoneDICOMImageLoader } from "cornerstone-wado-image-loader";
6
+ declare const segModule: any;
7
+ import { checkAndClearMemory, checkMemoryAllocation, getUsedMemory, getAvailableMemory } from "./imaging/monitors/memory";
8
+ import { getPerformanceMonitor, activatePerformanceMonitor, deactivatePerformanceMonitor } from "./imaging/monitors/performance";
9
+ import store from "./imaging/imageStore";
10
+ import { parseContours } from "./imaging/imageContours";
11
+ import { parseECG } from "./imaging/parsers/ecg";
12
+ import { renderECG, syncECGFrame, updateECGFrame } from "./imaging/waveforms/ecg";
13
+ import { getImagePresets, setImagePreset, setImageCustomPreset } from "./imaging/imagePresets";
14
+ import { getNormalOrientation, getMinPixelValue, getMaxPixelValue, getPixelRepresentation, getTypedArrayFromDataType, getSortedStack, randomId, getMeanValue, getReslicedMetadata, getReslicedPixeldata, getDistanceBetweenSlices, getImageMetadata } from "./imaging/imageUtils";
15
+ import { buildHeader, getCachedPixelData, buildData, buildDataAsync, importNRRDImage } from "./imaging/imageIo";
16
+ import { anonymize } from "./imaging/imageAnonymization";
17
+ import { buildLayer, updateLayer, getActiveLayer, setActiveLayer } from "./imaging/imageLayers";
18
+ import { initializeImageLoader, initializeWebImageLoader, initializeFileImageLoader, registerNRRDImageLoader, registerResliceLoader, registerMultiFrameImageLoader, updateLoadedStack } from "./imaging/imageLoading";
19
+ import { readFile, readFiles, parseDataSet, clearImageParsing } from "./imaging/imageParsing";
20
+ import { clearImageCache, loadAndCacheImages, renderFileImage, renderDICOMPDF, renderWebImage, disableViewport, unloadViewport, resizeViewport, renderImage, updateImage, resetViewports, updateViewportData, storeViewportData, invertImage, flipImageHorizontal, flipImageVertical, rotateImageLeft, rotateImageRight } from "./imaging/imageRendering";
21
+ import { resliceSeries } from "./imaging/imageReslice";
22
+ import { addDiameterTool, addContoursTool, addMaskEditingTool, getCurrentMaskData, addStackStateToElement, addSeedsTool, clearMeasurements, getToolState, clearToolStateByName, updateDiameterTool, addToolStateSingleSlice, clearCornerstoneElements, syncToolStack, updateStackToolState, setSegmentationConfig } from "./imaging/imageTools";
23
+ import { csToolsCreateStack, csToolsUpdateImageIds, csToolsUpdateImageIndex, initializeCSTools, setToolsStyle, addDefaultTools, addTool, setToolActive, setToolDisabled, setToolEnabled, setToolPassive, exportAnnotations } from "./imaging/tools/main";
24
+ import { DEFAULT_TOOLS, dvTools, getDefaultToolsByType, setDefaultToolsProps, registerExternalTool } from "./imaging/tools/default";
25
+ import { initSegmentationModule, addSegmentationMask, clearSegmentationState, deleteMask, setActiveLabelmap, setActiveSegment, enableBrushTool, disableBrushTool, undoLastStroke, redoLastStroke, setBrushProps, toggleContourMode, toggleVisibility, hexToRgb, rgbToHex, getActiveLabelmapBuffer } from "./imaging/tools/segmentation";
26
+ import { updateLarvitarManager, populateLarvitarManager, getLarvitarManager, getLarvitarImageTracker, resetLarvitarManager, removeSeriesFromLarvitarManager, getSeriesDataFromLarvitarManager, getImageFrame, getSopInstanceUIDFromLarvitarManager } from "./imaging/loaders/commonLoader";
27
+ import { buildNrrdImage, getNrrdImageId, loadNrrdImage, getImageIdFromSlice, getSliceNumberFromImageId, getNrrdSerieDimensions } from "./imaging/loaders/nrrdLoader";
28
+ import { getDicomImageId, cacheImage, cacheImages } from "./imaging/loaders/dicomLoader";
29
+ import { loadReslicedImage } from "./imaging/loaders/resliceLoader";
30
+ import { loadMultiFrameImage, buildMultiFrameImage, getMultiFrameImageId, clearMultiFrameCache } from "./imaging/loaders/multiframeLoader";
31
+ import { fileManager, resetFileLoader, resetFileManager, populateFileManager, getFileImageId } from "./imaging/loaders/fileLoader";
32
+ import { getColormapsList, applyColorMap, addColorMap, fillPixelData, HSVToRGB } from "./imaging/imageColormaps";
33
+ import { saveAnnotations, loadAnnotations } from "./imaging/tools/io";
34
+ import { addMouseKeyHandlers, removeMouseKeyHandlers, toggleMouseToolsListeners } from "./imaging/tools/interaction";
35
+ export { VERSION, cornerstone, cornerstoneTools, parseDicom, segModule, cornerstoneDICOMImageLoader, checkAndClearMemory, checkMemoryAllocation, getUsedMemory, getAvailableMemory, getPerformanceMonitor, activatePerformanceMonitor, deactivatePerformanceMonitor, store, parseECG, syncECGFrame, updateECGFrame, renderECG, getImagePresets, setImagePreset, setImageCustomPreset, getNormalOrientation, getMinPixelValue, getMaxPixelValue, getPixelRepresentation, getTypedArrayFromDataType, getSortedStack, randomId, getMeanValue, getReslicedMetadata, getReslicedPixeldata, getDistanceBetweenSlices, getImageMetadata, buildHeader, getCachedPixelData, buildData, buildDataAsync, importNRRDImage, anonymize, buildLayer, updateLayer, getActiveLayer, setActiveLayer, initializeImageLoader, initializeWebImageLoader, initializeFileImageLoader, registerNRRDImageLoader, registerResliceLoader, registerMultiFrameImageLoader, updateLoadedStack, readFile, readFiles, parseDataSet, clearImageParsing, clearImageCache, loadAndCacheImages, renderFileImage, renderDICOMPDF, renderWebImage, disableViewport, unloadViewport, resizeViewport, renderImage, updateImage, resetViewports, updateViewportData, toggleMouseToolsListeners, storeViewportData, invertImage, flipImageHorizontal, flipImageVertical, rotateImageLeft, rotateImageRight, resliceSeries, getColormapsList, applyColorMap, addColorMap, fillPixelData, HSVToRGB, parseContours, updateLarvitarManager, populateLarvitarManager, getLarvitarManager, getLarvitarImageTracker, resetLarvitarManager, removeSeriesFromLarvitarManager, getSeriesDataFromLarvitarManager, getImageFrame, getSopInstanceUIDFromLarvitarManager, buildNrrdImage, getNrrdImageId, loadNrrdImage, getImageIdFromSlice, getSliceNumberFromImageId, getNrrdSerieDimensions, loadReslicedImage, getDicomImageId, cacheImage, cacheImages, loadMultiFrameImage, buildMultiFrameImage, getMultiFrameImageId, clearMultiFrameCache, fileManager, resetFileLoader, resetFileManager, populateFileManager, getFileImageId, addDiameterTool, addContoursTool, addMaskEditingTool, getCurrentMaskData, addStackStateToElement, addSeedsTool, clearMeasurements, getToolState, clearToolStateByName, updateDiameterTool, addToolStateSingleSlice, clearCornerstoneElements, syncToolStack, updateStackToolState, setSegmentationConfig, csToolsCreateStack, csToolsUpdateImageIds, csToolsUpdateImageIndex, initializeCSTools, setToolsStyle, addDefaultTools, addTool, setToolActive, setToolDisabled, setToolEnabled, setToolPassive, exportAnnotations, DEFAULT_TOOLS, dvTools, getDefaultToolsByType, setDefaultToolsProps, registerExternalTool, saveAnnotations, loadAnnotations, addMouseKeyHandlers, removeMouseKeyHandlers, initSegmentationModule, addSegmentationMask, setActiveLabelmap, setActiveSegment, undoLastStroke, redoLastStroke, setBrushProps, hexToRgb, rgbToHex, clearSegmentationState, deleteMask, enableBrushTool, disableBrushTool, toggleContourMode, toggleVisibility, getActiveLabelmapBuffer };