larvitar 3.6.2 → 3.6.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.
@@ -15,4 +15,4 @@ import { Contours } from "./types";
15
15
  */
16
16
  export declare const parseContours: (contoursData: {
17
17
  [key: string]: Uint8Array;
18
- }, pointBatchSize: number, segmentationName: string, viewports: Array<string>) => Contours;
18
+ }, pointBatchSize: number, segmentationName: string, viewports?: Array<string>) => Contours;
@@ -1,20 +1,145 @@
1
- export function addDefaultTools(toolToActivate: any): void;
2
- export function addDiameterTool(elementId: string, diameters: any[], seriesId: string): void;
3
- export function addContoursTool(rawContours: Object, maskName: string): void;
4
- export function addMaskEditingTool(mask: any[], callback: Function, targetViewport: string): void;
5
- export function setSegmentationConfig(config: Object): void;
6
- export function getCurrentMaskData(viewportId: string): any[];
7
- export function addStackStateToElement(seriesId: string, element: HTMLElement): void;
8
- export function addSeedsTool(preLoadSeeds: any[], initViewport: string): void;
9
- export function clearMeasurements(): void;
10
- export function setToolActive(toolName: string, options: Object, activeViewport: string, viewports: any[]): void;
11
- export function setToolDisabled(toolName: string, activeViewport: string, viewports: any[]): void;
12
- export function setToolEnabled(toolName: string, activeViewport: string, viewports: any[]): void;
13
- export function setToolPassive(toolName: string, activeViewport: string, viewports: any[]): void;
14
- export function getToolState(toolName: string): Object;
15
- export function clearToolStateByName(toolName: string, options: Object): void;
16
- export function updateDiameterTool(diameterId: string | number, value: Object, seriesId: string, viewportId: string): void;
17
- export function addToolStateSingleSlice(element: HTMLElement, toolName: string, data: Object | any[], slice: number, seriesId: string): void;
18
- export function clearCornerstoneElements(): void;
19
- export function syncToolStack(srcSliceNumber: number, toolName: string, viewport: string, seriesId: string): void;
20
- export function updateStackToolState(elementId: string, imageIndex: number): void;
1
+ /** @module imaging/imageTools
2
+ * @desc This file provides functionalities for
3
+ * interacting with cornerstone tools
4
+ * DEPRECATION WARNING: these are legacy functions
5
+ * that will be removed soon. Use the corresponding
6
+ * functions in /tools/main.js instead.
7
+ * For this reason, this file will not be translated to TypeScript.
8
+ */
9
+ import { DiameterStateData, SegmentationConfig } from "./tools/types";
10
+ /**
11
+ * Add Diameter tool
12
+ * @function addDiameterTool
13
+ * @param {String} elementId - The target hmtl element id or its DOM HTMLElement
14
+ * @param {Array} diameters - The array of diameter objects.
15
+ * @param {String} seriesId - The id of the target serie.
16
+ */
17
+ export declare const addDiameterTool: (elementId: string, diameters: number[], seriesId: string) => void;
18
+ /**
19
+ * Add Contour tool
20
+ * @function addContoursTool
21
+ * @param {Object} rawContours - The contours object (generated from a segmentation mask).
22
+ * @param {String} maskName - The name tag that identify the mask
23
+ */
24
+ /**
25
+ * Add Contour tool
26
+ * @function addContoursTool
27
+ * @param {Object} rawContours - The contours object (generated from a segmentation mask).
28
+ * @param {String} maskName - The name tag that identify the mask
29
+ */
30
+ export declare const addContoursTool: (rawContours: {
31
+ [key: string]: Uint8Array;
32
+ }, maskName: string) => void;
33
+ /**
34
+ * Add mask editing tool
35
+ * @function addMaskEditingTool
36
+ * @param {Array} mask - The mask data.
37
+ * @param {Function} callback - The tool initialization callback
38
+ * @param {String} targetViewport - The target hmtl element id.
39
+ */
40
+ export declare const addMaskEditingTool: (mask: string[], callback: () => void, targetViewport: string) => void;
41
+ /**
42
+ * Modify configuration for cornerstone tools segmentation module
43
+ * @function setSegmentationConfig
44
+ * @param {Object} config - The custom configuration.
45
+ * @example
46
+ * Example of custom configuration
47
+ * config = {
48
+ renderOutline: true,
49
+ renderFill: true,
50
+ shouldRenderInactiveLabelmaps: true,
51
+ radius: 10,
52
+ minRadius: 1,
53
+ maxRadius: 50,
54
+ segmentsPerLabelmap: 65535,
55
+ fillAlpha: 0.7,
56
+ fillAlphaInactive: 0.1,
57
+ outlineAlpha: 0.7,
58
+ outlineAlphaInactive: 0.35,
59
+ outlineWidth: 3,
60
+ storeHistory: true
61
+ };
62
+ */
63
+ export declare const setSegmentationConfig: (config: Partial<SegmentationConfig>) => void;
64
+ /**
65
+ * Get mask editing tool current data from state
66
+ * @function getCurrentMaskData
67
+ * @param {String} viewportId - The target hmtl element id.
68
+ * @return {Array} labelmap3D - The mask array
69
+ */
70
+ export declare const getCurrentMaskData: (viewportId: string) => unknown[];
71
+ /**
72
+ * Add Stack State to a single hmtl element
73
+ * @function addStackStateToElement
74
+ * @param {String} seriesId - The id of the target serie.
75
+ * @param {HTMLElement} element - The target hmtl element.
76
+ */
77
+ export declare const addStackStateToElement: (seriesId: string, element: HTMLElement) => void;
78
+ /**
79
+ * Add seeds tool
80
+ * @function addSeedsTool
81
+ * @param {Array} preLoadSeeds - The array of seeds to load as initialization.
82
+ * @param {String} initViewport - The hmtl element id to be used for tool initialization.
83
+ */
84
+ export declare const addSeedsTool: (preLoadSeeds: string[], initViewport: string) => void;
85
+ /**
86
+ * Delete all measurements from tools state, for tools that have the "cleaneable" prop set to true in tools/default.js
87
+ * @function clearMeasurements
88
+ */
89
+ export declare const clearMeasurements: () => void;
90
+ /**
91
+ * Get tool data for all enabled elements
92
+ * @function getToolState
93
+ * @param {String} toolName - The tool name.
94
+ * @return {Object} - Tool data grouped by element id
95
+ */
96
+ export declare const getToolState: (toolName: string) => any;
97
+ /**
98
+ * Clear tool data for a subset of seeds
99
+ * @function clearToolStateByName
100
+ * @param {String} toolName - The tool name.
101
+ * @param {Object} options - Props used to select the data to delete (at the moment only {name : "targetName"} is implemented)
102
+ */
103
+ export declare const clearToolStateByName: (toolName: string, options: any) => void;
104
+ /**
105
+ * Update diameter tool with new value (removing old one)
106
+ * @function updateDiameterTool
107
+ * @param {String | Number} diameterId - The id that identify the diameter data.
108
+ * @param {Object} value - The object representing the new diameter data.
109
+ * @param {String} seriesId - The target serie id.
110
+ * @param {String} viewportId - The viewport id.
111
+ */
112
+ export declare const updateDiameterTool: (diameterId: string, value: {
113
+ tool: DiameterStateData;
114
+ }, seriesId: string, viewportId: string) => void;
115
+ /**
116
+ * Add tool data for a single target slice
117
+ * @function addToolStateSingleSlice
118
+ * @param {HTMLElement} element - The target hmtl element.
119
+ * @param {String} toolName - The tool name.
120
+ * @param {Object | Array} data - The tool data to add (tool-specific)
121
+ * @param {Number} slice - The target slice to put the data in.
122
+ * @param {String} seriesId - The target serie id.
123
+ */
124
+ export declare const addToolStateSingleSlice: (element: HTMLElement, toolName: string, data: Partial<DiameterStateData>, slice: number, seriesId?: string) => void;
125
+ /**
126
+ * Clear tool state and disable all cornerstone elements
127
+ * @function clearCornerstoneElements
128
+ */
129
+ export declare const clearCornerstoneElements: () => void;
130
+ /**
131
+ * Sync the cornerstone tools stack given a slice as data source
132
+ * @function syncToolStack
133
+ * @param {Number} srcSliceNumber - The slice to be used as data source.
134
+ * @param {String} toolName - The name of the tool to sync.
135
+ * @param {String} viewport - The target viewport id.
136
+ * @param {String} seriesId - The target serie id.
137
+ */
138
+ export declare const syncToolStack: (srcSliceNumber: number, toolName: string, viewport: string, seriesId: string) => void;
139
+ /**
140
+ * Update slice index in cornerstone tools stack state
141
+ * @function updateStackToolState
142
+ * @param {String} elementId - The html div id used for rendering or its DOM HTMLElement
143
+ * @param {Number} imageIndex - The new imageIndex value.
144
+ */
145
+ export declare const updateStackToolState: (elementId: string | HTMLElement, imageIndex: number) => void;
@@ -1,21 +1,28 @@
1
- declare const BorderMagnifyTool_base: any;
2
- export default class BorderMagnifyTool extends BorderMagnifyTool_base {
3
- [x: string]: any;
4
- constructor(props?: {});
1
+ import { EventData } from "../types";
2
+ declare const MagnifyTool: any;
3
+ export default class BorderMagnifyTool extends MagnifyTool {
4
+ static [x: string]: any;
5
+ constructor(props?: {
6
+ showBorders?: boolean;
7
+ showInfo?: boolean;
8
+ borderColor?: string;
9
+ });
10
+ activeCallback(element: HTMLElement): void;
11
+ disabledCallback(element: HTMLElement): void;
12
+ passiveCallback(element: HTMLElement): void;
5
13
  /**
6
14
  * Event handler for the "keydown" event to toggle the visibility of borders and info on "B" key press.
7
15
  * @param {KeyboardEvent} event
8
16
  * @returns {void}
9
17
  */
10
18
  handleKeyDown(event: KeyboardEvent): void;
11
- activeCallback(element: any): void;
12
- disabledCallback(element: any): void;
13
- passiveCallback(element: any): void;
14
19
  /**
15
20
  * Overrides the _drawMagnificationTool method to add configurable borders and display zoom/ROI dimensions.
16
21
  * @param {*} evt
17
22
  * @returns {void}
18
23
  */
19
- _drawMagnificationTool(evt: any): void;
24
+ _drawMagnificationTool(evt?: {
25
+ detail: EventData;
26
+ }): void;
20
27
  }
21
28
  export {};
@@ -1,3 +1,5 @@
1
+ import { Coords, EventData, MeasurementData, MeasurementMouseEvent } from "../types";
2
+ declare const BaseAnnotationTool: any;
1
3
  /**
2
4
  * @public
3
5
  * @class WwwcRemoveRegionTool
@@ -6,14 +8,10 @@
6
8
  * @classdesc Tool for setting wwwc based on a rectangular region.
7
9
  * @extends Tools.Base.BaseTool
8
10
  */
9
- export default class WwwcRemoveRegionTool {
11
+ export default class WwwcRemoveRegionTool extends BaseAnnotationTool {
12
+ static [x: string]: any;
10
13
  constructor(props?: {});
11
- dataHandles: any[];
12
- element: any;
13
- _drawingMouseUpCallback: (evt: any) => void;
14
- _editMouseUpCallback: (evt: any) => void;
15
- throttledUpdateCachedStats: any;
16
- createNewMeasurement(eventData: any): {
14
+ createNewMeasurement(eventData: EventData): {
17
15
  computeMeasurements: any;
18
16
  visible: boolean;
19
17
  active: boolean;
@@ -21,18 +19,18 @@ export default class WwwcRemoveRegionTool {
21
19
  invalidated: boolean;
22
20
  handles: {
23
21
  start: {
24
- x: any;
25
- y: any;
22
+ x: number;
23
+ y: number;
26
24
  highlight: boolean;
27
25
  active: boolean;
28
26
  };
29
27
  end: {
30
- x: any;
31
- y: any;
28
+ x: number;
29
+ y: number;
32
30
  highlight: boolean;
33
31
  active: boolean;
34
32
  };
35
- initialRotation: any;
33
+ initialRotation: number;
36
34
  textBox: {
37
35
  active: boolean;
38
36
  hasMoved: boolean;
@@ -43,20 +41,18 @@ export default class WwwcRemoveRegionTool {
43
41
  };
44
42
  };
45
43
  } | undefined;
46
- originalWW: any;
47
- originalWC: any;
48
- pointNearTool(element: any, data: any, coords: any, interactionType: any): boolean;
49
- updateCachedStats(image: any, element: any, data: any): void;
50
- renderToolData(evt: any): void;
51
- mode: any;
52
- _withinHandleBoxes(startCanvas: any, endCanvas: any): boolean;
44
+ pointNearTool(element: Element, data: MeasurementData, coords: Coords, interactionType: string): boolean;
45
+ updateCachedStats(image: cornerstone.Image, element: Element, data: MeasurementData): void;
46
+ renderToolData(evt: MeasurementMouseEvent): void;
47
+ _withinHandleBoxes(startCanvas: Coords, endCanvas: Coords): boolean;
53
48
  /**
54
49
  * Event handler for MOUSE_UP/TOUCH_END during handle drag event loop.
55
50
  *
56
51
  * @private
57
52
  * @method _applyStrategy
58
- * @param {(CornerstoneTools.event#MOUSE_UP|CornerstoneTools.event#TOUCH_END)} evt Interaction event emitted by an enabledElement
53
+ * @param {MeasurementMouseEvent} evt Interaction event emitted by an enabledElement
59
54
  * @returns {void}
60
55
  */
61
- private _applyStrategy;
56
+ _applyStrategy(evt: MeasurementMouseEvent): void;
62
57
  }
58
+ export {};