larvitar 4.0.0-alpha.2 → 4.0.0-alpha.20

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,5 +1,14 @@
1
- var larvitar;
2
- /******/ (() => { // webpackBootstrap
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory();
4
+ else if(typeof define === 'function' && define.amd)
5
+ define([], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["larvitar"] = factory();
8
+ else
9
+ root["larvitar"] = factory();
10
+ })(self, () => {
11
+ return /******/ (() => { // webpackBootstrap
3
12
  /******/ var __webpack_modules__ = ({
4
13
 
5
14
  /***/ 6221:
@@ -279,7 +288,8 @@ var larvitar;
279
288
  /******/
280
289
  /******/ // run startup
281
290
  /******/ var __webpack_exports__ = __webpack_require__.x();
282
- /******/ larvitar = __webpack_exports__;
283
291
  /******/
292
+ /******/ return __webpack_exports__;
284
293
  /******/ })()
285
- ;
294
+ ;
295
+ });
@@ -1,5 +1,14 @@
1
- var larvitar;
2
- /******/ (() => { // webpackBootstrap
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory();
4
+ else if(typeof define === 'function' && define.amd)
5
+ define([], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["larvitar"] = factory();
8
+ else
9
+ root["larvitar"] = factory();
10
+ })(self, () => {
11
+ return /******/ (() => { // webpackBootstrap
3
12
  /******/ var __webpack_modules__ = ({
4
13
 
5
14
  /***/ 1234:
@@ -254,7 +263,8 @@ var larvitar;
254
263
  /******/
255
264
  /******/ // run startup
256
265
  /******/ var __webpack_exports__ = __webpack_require__.x();
257
- /******/ larvitar = __webpack_exports__;
258
266
  /******/
267
+ /******/ return __webpack_exports__;
259
268
  /******/ })()
260
- ;
269
+ ;
270
+ });
@@ -1,6 +1,7 @@
1
1
  export type ExtendedMetaDataTypes = MetaDataTypes & {
2
2
  [key: string]: unknown;
3
3
  };
4
+ export declare const arrayTags: string[];
4
5
  export type MetaDataTypes = {
5
6
  x20000010?: number;
6
7
  x2000001e?: MetaDataTypes[];
@@ -4,7 +4,7 @@
4
4
  import { DataSet } from "dicom-parser";
5
5
  import { ImageObject, MetaData } from "./types";
6
6
  import { getImageManager } from "./imageManagers";
7
- import type { ExtendedMetaDataTypes } from "./MetaDataTypes";
7
+ import { type ExtendedMetaDataTypes } from "./MetaDataTypes";
8
8
  /**
9
9
  * Reset series stack object and its internal data
10
10
  * @instance
@@ -3,7 +3,8 @@
3
3
  * rendering images in html canvas using cornerstone
4
4
  */
5
5
  import cornerstone from "cornerstone-core";
6
- import { RenderProps, Series, StoreViewport, Viewport } from "./types";
6
+ import { DisplayedArea, RenderProps, Series, StoreViewport, Viewport } from "./types";
7
+ import { ViewportComplete } from "./tools/types";
7
8
  /**
8
9
  * Purge the cornestone internal cache
9
10
  * If seriesId is passed as argument only imageIds of the series are purged from internal cache
@@ -106,6 +107,23 @@ export declare const unloadViewport: (elementId: string) => void;
106
107
  * @param {String} elementId - The html div id used for rendering or its DOM HTMLElement
107
108
  */
108
109
  export declare const resizeViewport: (elementId: string | HTMLElement) => void;
110
+ /**
111
+ * Check if the displayed image is anisotropic (row pixel spacing !== col pixel spacing)
112
+ * @instance
113
+ * @function isAnisotropic
114
+ * @param {String} elementId - The html div id used for rendering or its DOM HTMLElement
115
+ * @returns {Boolean}
116
+ */
117
+ export declare const isAnisotropic: (elementId: string) => boolean;
118
+ /**
119
+ * Retrieves Anisotropic Viewport displayedArea properties
120
+ * @instance
121
+ * @function getAnisotropicDisplayedArea
122
+ * @param {String} elementId - The html div id used for rendering or its DOM HTMLElement
123
+ * @param {ViewportComplete} viewport - The viewport
124
+ * @returns {DisplayedArea}
125
+ */
126
+ export declare const getAnisotropicDisplayedArea: (id: string, viewport: ViewportComplete) => DisplayedArea | undefined;
109
127
  /**
110
128
  * Cache image and render it in a html div using cornerstone
111
129
  * @instance
@@ -32,7 +32,7 @@ type SetPayload = ["errorLog" | "leftActiveTool" | "rightActiveTool", string] |
32
32
  ("progress" | "loading" | "minPixelValue" | "maxPixelValue" | "minSliceId" | "maxSliceId" | "minTimeId" | "maxTimeId" | "rotation" | "scale" | "sliceId" | "timeId" | "thickness" | "numberOfFrames" | "numberOfTemporalPositions"),
33
33
  string,
34
34
  number
35
- ] | ["cached", string, string, boolean] | ["timestamp", string, number | undefined] | ["uniqueUID" | "modality", string, string | undefined] | ["pendingSliceId", string, number | undefined] | ["timestamps" | "timeIds", string, number[]] | ["pixelShift", string, number[] | undefined] | [
35
+ ] | ["cached", string, string, boolean] | ["timestamp", string, number | undefined] | ["uniqueUID" | "modality" | "filterName", string, string | undefined] | ["pendingSliceId", string, number | undefined] | ["timestamps" | "timeIds", string, number[]] | ["pixelShift", string, number[] | undefined] | [
36
36
  "contrast" | "dimensions" | "spacing" | "translation",
37
37
  string,
38
38
  number,
@@ -62,6 +62,7 @@ declare const _default: {
62
62
  setTimeId: (elementId: string, timeIndex: number) => void;
63
63
  setDSAEnabled: (elementId: string, enabled: boolean) => void;
64
64
  setDSAPixelShift: (elementId: string, pixelShift?: number[]) => void;
65
+ setImageFilter: (elementId: string, filterName: string) => void;
65
66
  resetActiveTools(): void;
66
67
  get: (props: string | string[] | undefined) => any;
67
68
  addStoreListener: (listener: (data: Store) => {}) => (data: Store) => {};
@@ -2,7 +2,7 @@
2
2
  * @desc This file provides utility functions for
3
3
  * manipulating image pixels and image metadata
4
4
  */
5
- import type { CustomDataSet, MetaData, ReslicedInstance, Series } from "./types";
5
+ import type { CustomDataSet, MetaData, ReslicedInstance, Series, TypedArray } from "./types";
6
6
  /**
7
7
  * @typedef {Object} CornerstoneSeries
8
8
  * @property {Array} imageIds Array of the instances imageIds
@@ -16,20 +16,30 @@ import type { CustomDataSet, MetaData, ReslicedInstance, Series } from "./types"
16
16
  * @param {Array} el - The image_orientation dicom tag
17
17
  */
18
18
  export declare const getNormalOrientation: (el: [number, number, number, number, number, number]) => number[];
19
+ /**
20
+ * Get the min and max pixel value from pixelData
21
+ * @instance
22
+ * @function getMinPixelValue
23
+ * @param {Array} pixelData - Pixel data array
24
+ */
25
+ export declare const getMinMaxPixelValue: (pixelData: number[] | TypedArray) => {
26
+ minPixelValue: number;
27
+ maxPixelValue: number;
28
+ };
19
29
  /**
20
30
  * Get the min pixel value from pixelData
21
31
  * @instance
22
32
  * @function getMinPixelValue
23
33
  * @param {Array} pixelData - Pixel data array
24
34
  */
25
- export declare const getMinPixelValue: (pixelData: number[]) => number;
35
+ export declare const getMinPixelValue: (pixelData: number[] | TypedArray) => number;
26
36
  /**
27
37
  * Get the max pixel value from pixelData
28
38
  * @instance
29
39
  * @function getMaxPixelValue
30
40
  * @param {Array} pixelData - Pixel data array
31
41
  */
32
- export declare const getMaxPixelValue: (pixelData: number[]) => number;
42
+ export declare const getMaxPixelValue: (pixelData: number[] | TypedArray) => number;
33
43
  /**
34
44
  * Create the pixel representation string (type and length) from dicom tags
35
45
  * @instance
@@ -0,0 +1,29 @@
1
+ import { Image, TypedArray, KernelConfig } from "../types";
2
+ /**
3
+ * Apply convolution filter to DICOM image
4
+ * @param {Object} loadedImage - The DICOM image object
5
+ * @param {string} filterName - Name of the filter to apply
6
+ * @param {number} multiplier - Optional multiplier for kernel values (default: 1)
7
+ * @returns {TypedArray} - Convolved pixel data
8
+ */
9
+ export declare function applyConvolutionFilter(loadedImage: Image, filterName: string, generateImage?: boolean, multiplier?: number): Partial<Image> | TypedArray;
10
+ /**
11
+ * Create the filtered image
12
+ * @param {string} name - Name for the new kernel
13
+ * @param {Object} config - Kernel configuration (modality, label, size, kernel)
14
+ * @returns {Partial<Image>} - Convolved pixel data
15
+ */
16
+ export declare function createFilteredImage(loadedImage: Image, filteredPixelArray: number[]): Partial<Image>;
17
+ /**
18
+ * Add custom kernel to the global object
19
+ * @param {string} name - Name for the new kernel
20
+ * @param {Object} config - Kernel configuration (modality, label, size, kernel)
21
+ */
22
+ export declare function addCustomKernel(name: string, config: KernelConfig): void;
23
+ /**
24
+ * Get kernels
25
+ * @returns {Object} - CONVOLUTION_KERNELS object
26
+ */
27
+ export declare function getKernels(): {
28
+ [x: string]: KernelConfig;
29
+ };
@@ -2,7 +2,13 @@
2
2
  * @desc This file provides definitions
3
3
  * for default tools
4
4
  */
5
- import type { ToolConfig, ToolMouseKeys, ToolSettings, ToolStyle } from "./types";
5
+ import type { CursorOptions, ToolConfig, ToolMouseKeys, ToolSettings, ToolStyle, ToolStyle3D } from "./types";
6
+ declare const DEFAULT_TOOLS_3D: {
7
+ [key: string]: ToolConfig;
8
+ };
9
+ declare const DEFAULT_TOOLS_MPR: {
10
+ [key: string]: ToolConfig;
11
+ };
6
12
  /**
7
13
  * These tools are added with `addDefaultTools()`
8
14
  */
@@ -15,6 +21,18 @@ declare const DEFAULT_TOOLS: {
15
21
  declare const dvTools: {
16
22
  [key: string]: any;
17
23
  };
24
+ /**
25
+ * D/Vision Lab 3D custom tools
26
+ */
27
+ declare const dvTools3D: {
28
+ [key: string]: any;
29
+ };
30
+ /**
31
+ * D/Vision Lab MPR custom tools
32
+ */
33
+ declare const dvToolsMPR: {
34
+ [key: string]: any;
35
+ };
18
36
  /**
19
37
  * Tools default style
20
38
  * Available font families :
@@ -23,6 +41,7 @@ declare const dvTools: {
23
41
  * Arial, Lucida Grande, sans-serif;
24
42
  */
25
43
  declare const DEFAULT_STYLE: ToolStyle;
44
+ declare const DEFAULT_STYLE_3D: ToolStyle3D;
26
45
  /**
27
46
  * Tools default settings
28
47
  */
@@ -46,8 +65,31 @@ declare const setDefaultToolsProps: (newProps: Partial<ToolConfig>[]) => void;
46
65
  * Register a custom tool
47
66
  * @param {String} toolName - The name of the tool
48
67
  * @param {Object} toolClass - The tool class
68
+ * @param {String} toolVersion - The version of the tool, can be "MPR", "3D" (to be used with cs3D) or "" (default - cs legacy)
49
69
  * NOTE: toolName must be unique
50
70
  * NOTE: toolClass must be a valid cornerstone tool
51
71
  */
52
- declare const registerExternalTool: (toolName: string, toolClass: any) => void;
53
- export { DEFAULT_TOOLS, DEFAULT_STYLE, DEFAULT_SETTINGS, DEFAULT_MOUSE_KEYS, dvTools, getDefaultToolsByType, setDefaultToolsProps, registerExternalTool };
72
+ declare const registerExternalTool: (toolName: string, toolClass: any, toolVersion?: "MPR" | "3D" | "", toolCursor?: string, cursorOptions?: CursorOptions) => void;
73
+ /**
74
+ * Register a custom tool cursor
75
+ * @param {String} toolName - The name of the tool
76
+ * @param {string} iconContent - The tool class
77
+ * @param {CursorOptions} cursorOptions - tthe cursor options
78
+ ex.
79
+ const iconContent = `
80
+ <svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 30 30">
81
+ <image href="data:image/svg+xml;base64,${measurementBase64}" width="30" height="30" style="filter: invert(100%);"/>
82
+ </svg>
83
+ `;
84
+ const cursorOptions = {
85
+ iconSize: 30,
86
+ mousePoint: { x: 15, y: 15 },
87
+ mousePointerGroupString: ``,
88
+ viewBox: {
89
+ x: 0,
90
+ y: 0
91
+ }
92
+ };
93
+ */
94
+ export declare const registerCursor: (toolName: string, iconContent: string, cursorOptions: CursorOptions) => void;
95
+ export { DEFAULT_TOOLS, DEFAULT_TOOLS_3D, DEFAULT_TOOLS_MPR, DEFAULT_STYLE, DEFAULT_STYLE_3D, DEFAULT_SETTINGS, DEFAULT_MOUSE_KEYS, dvTools, dvTools3D, dvToolsMPR, getDefaultToolsByType, setDefaultToolsProps, registerExternalTool };
@@ -1,5 +1,5 @@
1
1
  import { EnabledElement } from "cornerstone-core";
2
- import { Image, Viewport } from "../types";
2
+ import { DisplayedArea, Image, Viewport } from "../types";
3
3
  type ToolOptions = {
4
4
  mouseButtonMask?: number | number[];
5
5
  supportedInteractionTypes?: string[];
@@ -24,6 +24,30 @@ export type ToolConfig = {
24
24
  currentMode?: string;
25
25
  offset?: number;
26
26
  };
27
+ export type ToolStyle3D = {
28
+ global: {
29
+ angleArcLineDash: string;
30
+ color: string;
31
+ colorHighlighted: string;
32
+ colorLocked: string;
33
+ colorSelected: string;
34
+ lineDash: string;
35
+ lineWidth: string;
36
+ markerSize: string;
37
+ shadow: boolean;
38
+ textBoxBackground: string;
39
+ textBoxColor: string;
40
+ textBoxColorHighlighted: string;
41
+ textBoxColorLocked: string;
42
+ textBoxColorSelected: string;
43
+ textBoxFontFamily: string;
44
+ textBoxFontSize: string;
45
+ textBoxLinkLineDash: string;
46
+ textBoxLinkLineWidth: string;
47
+ textBoxShadow: boolean;
48
+ textBoxVisibility: boolean;
49
+ };
50
+ };
27
51
  export type ToolStyle = {
28
52
  width: number;
29
53
  color: string;
@@ -33,6 +57,13 @@ export type ToolStyle = {
33
57
  fontSize: number;
34
58
  backgroundColor: string;
35
59
  };
60
+ export type CursorOptions = {
61
+ name: string;
62
+ iconSize: number;
63
+ mousePoint: Coords;
64
+ mousePointerGroupString: string;
65
+ viewBox: Coords;
66
+ };
36
67
  export type ToolSettings = {
37
68
  mouseEnabled: boolean;
38
69
  touchEnabled: boolean;
@@ -131,7 +162,7 @@ export type HandlePosition = {
131
162
  };
132
163
  export interface ViewportComplete extends Viewport {
133
164
  initialRotation: number;
134
- displayedArea: any;
165
+ displayedArea: DisplayedArea;
135
166
  scale: number;
136
167
  rotation: number;
137
168
  vflip: boolean;
@@ -3,7 +3,7 @@ import { DataSet } from "dicom-parser";
3
3
  import { MetaDataTypes } from "./MetaDataTypes";
4
4
  import { MetaDataReadable } from "./MetaDataReadable";
5
5
  import { Element } from "dicom-parser";
6
- import { Overlay } from "./tools/types";
6
+ import { Coords, DisplayAreaVisualizations, Overlay } from "./tools/types";
7
7
  export type tags = {
8
8
  [x: string]: Element;
9
9
  }[];
@@ -58,6 +58,7 @@ export type StoreViewport = {
58
58
  numberOfTemporalPositions?: number;
59
59
  numberOfFrames?: number;
60
60
  timeIndex?: number;
61
+ filterName?: string;
61
62
  viewport: {
62
63
  scale: number;
63
64
  rotation: number;
@@ -143,6 +144,7 @@ export type DSA = {
143
144
  };
144
145
  export type Series = {
145
146
  imageIds: string[];
147
+ imageIds3D: string[];
146
148
  instances: {
147
149
  [key: string]: Instance;
148
150
  };
@@ -186,21 +188,15 @@ export interface Layer extends cornerstone.EnabledElementLayer {
186
188
  }
187
189
  export interface Viewport extends cornerstone.Viewport {
188
190
  newImageIdIndex: number;
189
- displayedArea: {
190
- tlhc: {
191
- x: number;
192
- y: number;
193
- };
194
- brhc: {
195
- x: number;
196
- y: number;
197
- };
198
- columnPixelSpacing: number;
199
- rowPixelSpacing: number;
200
- presentationSizeMode: string;
201
- };
202
191
  overlayColor?: boolean | string;
203
192
  }
193
+ export type DisplayedArea = {
194
+ tlhc?: Coords;
195
+ brhc?: Coords;
196
+ presentationSizeMode?: DisplayAreaVisualizations;
197
+ rowPixelSpacing?: number;
198
+ columnPixelSpacing?: number;
199
+ };
204
200
  export type Contours = {
205
201
  [key: string]: {
206
202
  [key: string]: Array<{
@@ -288,6 +284,7 @@ export type NrrdInputVolume = {
288
284
  export type NrrdSeries = {
289
285
  currentImageIdIndex: number;
290
286
  imageIds: string[];
287
+ imageIds3D: string[];
291
288
  instances: {
292
289
  [key: string]: Instance;
293
290
  };
@@ -338,7 +335,14 @@ type translation = {
338
335
  x: number;
339
336
  y: number;
340
337
  };
338
+ export type KernelConfig = {
339
+ Label: string;
340
+ Size: number;
341
+ Kernel: number[][];
342
+ Modality?: string[];
343
+ };
341
344
  export type RenderProps = {
345
+ filterName?: string;
342
346
  cached?: boolean;
343
347
  imageIndex?: number;
344
348
  scale?: number;
@@ -11,11 +11,79 @@ import { MprViewport } from "./types";
11
11
  * @function renderImage
12
12
  * @param {Object} seriesStack - The original series data object
13
13
  * @param {String} elementId - The html div id used for rendering or its DOM HTMLElement
14
- * @param {Object} defaultProps - Optional default props
14
+ * @param {RenderProps} options - Optional rendering options
15
15
  * @return {Promise} Return a promise which will resolve when image is displayed
16
16
  */
17
17
  export declare const renderImage: (seriesStack: Series, elementId: string | HTMLElement, options?: RenderProps) => Promise<{
18
18
  success: boolean;
19
19
  renderingEngine: cornerstone.RenderingEngine;
20
20
  }>;
21
- export declare const renderMpr: (seriesStack: Series, mprViewports: MprViewport[], options?: RenderProps) => Promise<unknown>;
21
+ /**
22
+ * Initialize a rendering engine with a renderingEngineId
23
+ * @instance
24
+ * @function initializeRenderingEngine
25
+ * @param {string} renderingEngineId - The unique identifier of the rendering engine to initialize
26
+ * @return {cornerstone.RenderingEngine} Returns the initialized rendering engine
27
+ * @throws {Error} If the rendering engine with the same UID already exists
28
+ */
29
+ export declare const initializeRenderingEngine: (renderingEngineId: string) => cornerstone.RenderingEngine | void;
30
+ /**
31
+ * Destroy a rendering engine by its unique UID
32
+ * @instance
33
+ * @function destroyRenderingEngine
34
+ * @param {string} renderingEngineId - The unique identifier of the rendering engine to destroy
35
+ * @return {void}
36
+ * @throws {Error} If the rendering engine does not exist or has already been destroyed
37
+ */
38
+ export declare const destroyRenderingEngine: (renderingEngineId: string) => void;
39
+ /**
40
+ * Initialize volume viewports for a rendering engine
41
+ * @instance
42
+ * @function initializeVolumeViewports
43
+ * @param {string} renderingEngineId - The unique identifier of the rendering engine to initialize
44
+ * @param {MprViewport[]} mprViewports - An array of MprViewport objects to initialize
45
+ * @returns {void}
46
+ */
47
+ export declare const initializeVolumeViewports: (renderingEngineId: string, mprViewports: MprViewport[]) => void;
48
+ /**
49
+ * Load and cache a volume from a series
50
+ * @instance
51
+ * @function loadAndCacheVolume
52
+ * @param {Series} series - The series object containing imageIds and instances
53
+ * @returns {cornerstone.ImageVolume | cornerstone.Types.IStreamingImageVolume} Returns a promise that resolves to the loaded volume
54
+ */
55
+ export declare const loadAndCacheVolume: (series: Series) => Promise<cornerstone.ImageVolume | cornerstone.Types.IStreamingImageVolume>;
56
+ /**
57
+ * Set a volume for a rendering engine
58
+ * @instance
59
+ * @function setVolumeForRenderingEngine
60
+ * @param {string} volumeId - The unique identifier of the volume to set
61
+ * @param {string} renderingEngineId - The unique identifier of the rendering engine to set the volume for
62
+ * @returns
63
+ */
64
+ export declare const setVolumeForRenderingEngine: (volumeId: string, renderingEngineId: string) => void;
65
+ export declare const renderMpr: (series: Series, renderingEngineId: string, options?: RenderProps) => Promise<cornerstone.RenderingEngine>;
66
+ /**
67
+ * Unload a MPR rendering engine
68
+ * @instance
69
+ * @function unloadMpr
70
+ * @param {string} renderingEngineId - The unique identifier of the rendering engine to unload
71
+ * @returns {void}
72
+ */
73
+ export declare const unloadMpr: (renderingEngineId: string) => void;
74
+ /**
75
+ * Resize a rendering engine
76
+ * @instance
77
+ * @function resizeRenderingEngine
78
+ * @param {string} renderingEngineId - The unique identifier of the rendering engine to resize
79
+ * @returns {void}
80
+ */
81
+ export declare const resizeRenderingEngine: (renderingEngineId: string) => void;
82
+ /**
83
+ * Reset viewport values (contrast, pan and zoom)
84
+ * @instance
85
+ * @function resetViewports
86
+ * @param {Array} elementIds - The array of hmtl div ids
87
+ * @param {Array} keys - The array of viewport sections to resets (default is all)
88
+ */
89
+ export declare const resetViewports: (elementIds: string[], keys?: Array<"contrast" | "pan" | "zoom">) => void;
@@ -0,0 +1,44 @@
1
+ import { BaseTool } from "@cornerstonejs/tools";
2
+ import { Viewport } from "@cornerstonejs/core";
3
+ import * as EventTypes from "@cornerstonejs/tools/dist/esm/types/EventTypes";
4
+ /**
5
+ * WindowLevel tool manipulates the windowLevel applied to a viewport. It
6
+ * provides a way to set the windowCenter and windowWidth of a viewport
7
+ * by dragging mouse over the image.
8
+ *
9
+ */
10
+ declare class CustomWWWLTool extends BaseTool {
11
+ static toolName: string;
12
+ constructor(toolProps?: {}, defaultToolProps?: {
13
+ supportedInteractionTypes: string[];
14
+ });
15
+ touchDragCallback(evt: EventTypes.InteractionEventType): void;
16
+ mouseDragCallback(evt: EventTypes.InteractionEventType): void;
17
+ getPTScaledNewRange({ deltaPointsCanvas, lower, upper, clientHeight, viewport, volumeId, isPreScaled }: {
18
+ deltaPointsCanvas: number[];
19
+ lower: number;
20
+ upper: number;
21
+ clientHeight: number;
22
+ viewport: Viewport;
23
+ volumeId?: string;
24
+ isPreScaled: boolean;
25
+ }): {
26
+ lower: number;
27
+ upper: number;
28
+ };
29
+ getNewRange({ viewport, deltaPointsCanvas, volumeId, lower, upper }: {
30
+ viewport: any;
31
+ deltaPointsCanvas: any;
32
+ volumeId: any;
33
+ lower: any;
34
+ upper: any;
35
+ }): {
36
+ lower: number;
37
+ upper: number;
38
+ };
39
+ _getMultiplierFromDynamicRange(viewport: any, volumeId: any): number;
40
+ _getImageDynamicRangeFromViewport(viewport: any): number;
41
+ _getImageDynamicRangeFromMiddleSlice: (scalarData: any, dimensions: any) => number;
42
+ private _getMinMax;
43
+ }
44
+ export default CustomWWWLTool;
@@ -2,18 +2,107 @@
2
2
  * @desc This file provides functionalities
3
3
  * for initializing tools and stacks
4
4
  */
5
- import { RenderingEngine } from "@cornerstonejs/core";
5
+ import * as cornerstone from "@cornerstonejs/core";
6
+ import * as cornerstoneTools from "@cornerstonejs/tools";
7
+ import type { ToolConfig, ToolSettings, ToolStyle3D } from "../../imaging/tools/types";
8
+ import type { RenderingEngine } from "@cornerstonejs/core";
9
+ /**
10
+ * Initialize cornerstone tools with default configuration (extended with custom configuration)
11
+ * @function initializeCSTools
12
+ * @param {ToolSettings} settings - the settings object (see tools/default.js)
13
+ * @param {ToolStyle} style - the style object (see tools/default.js)
14
+ * @example larvitar.initializeCSTools({showSVGCursors:false}, {color: "0000FF"});
15
+ */
16
+ export declare const initializeCSTools: (settings?: ToolSettings, style?: ToolStyle3D) => Promise<void>;
17
+ /**
18
+ * Set cornerstone tools custom configuration (extend default configuration)
19
+ * @function setToolsStyle
20
+ * @param {Object} style - the style object (see tools/defaults.js)
21
+ */
22
+ export declare const setToolsStyle: (style?: ToolStyle3D) => void;
23
+ /**
24
+ * Add a cornerstone 3D tool (grab it from original library or dvision custom 3D or MPR tools)
25
+ * @param {String} toolName
26
+ * @param {Partial<ToolConfig>} customConfig
27
+ * @param {String} type The type of tool to add (3D or MPR)
28
+ * @param {String} groupId The cornerstone3D Tool GroupID
29
+ * @example larvitar.addTool("ScaleOverlay", {configuration:{minorTickLength: 10, majorTickLength: 25}}, "viewer")
30
+ */
31
+ export declare const addTool: (toolName: string, customConfig: Partial<ToolConfig>, groupId?: string, type?: string) => void;
6
32
  /**
7
33
  * @function addDefaultTools
8
34
  * @desc Adds default tools to the rendering engine (wwwl, pan, zoom, stackScroll)
9
- * @param elementId - the id of the element where the tools will be added
10
- * @param renderingEngine - the rendering engine where the tools will be added
35
+ * @param {String[]} elementIds - the ids of the elements where the tools will be added
36
+ * @param {RenderingEngine} renderingEngine - the rendering engine where the tools will be added
37
+ * @param {String} type The type of tool to add (3D or MPR)
38
+ * @param {String} groupId The cornerstone3D Tool GroupID
39
+ */
40
+ export declare const addDefaultTools: (elementIds: string[], renderingEngine: RenderingEngine, type?: string, toolGroupId?: string) => void;
41
+ /**
42
+ * Set Tool "active" on all elements (ie, rendered and manipulable)
43
+ * @param toolName - The tool name.
44
+ * @param options - The tool options (mouseButtonMask, etc). If not provided, the default options will be used.
45
+ * @param groupId - The tool group id. @default "default"
46
+ * @param doNotSetInStore - Flag to not set the active tool in the store. @default false
47
+ */
48
+ export declare const setToolActive: (toolName: string, options?: Partial<ToolConfig["options"]>, groupId?: string, doNotSetInStore?: boolean) => void;
49
+ export declare const setToolPassive: (toolName: string, groupId?: string, resetCursor?: boolean) => void;
50
+ export declare const setToolEnabled: (toolName: string, groupId?: string, resetCursor?: boolean) => void;
51
+ export declare const setToolDisabled: (toolName: string, groupId?: string, resetCursor?: boolean) => void;
52
+ /**
53
+ * @function syncViewportsVOI
54
+ * @desc Synchronizes the contrast of two (volume) viewports
55
+ * @param id - unique id for the synchronizer @default "default"
56
+ * @param targetViewportId - the id of the target viewport where the camera will be synced
57
+ * @param sourceViewportId - the id of the source viewport from where the camera position will be taken
58
+ */
59
+ export declare const syncViewportsVOI: (id: string | undefined, syncedViewportIds: string[]) => void;
60
+ /**
61
+ * @function syncViewports
62
+ * @desc Synchronizes the camera position and contrast of two (volume) viewports
63
+ * @param id - unique id for the synchronizer @default "default"
64
+ * @param targetViewportId - the id of the target viewport where the camera will be synced
65
+ * @param sourceViewportId - the id of the source viewport from where the camera position will be taken
66
+ * @param otherViewportIds - the ids of other viewports to sync VOI with
67
+ */
68
+ export declare const syncViewports: (id: string | undefined, targetViewportId: string, sourceViewportId: string, otherViewportIds: string[]) => void;
69
+ /**
70
+ * @function syncViewportsSlabAndCamera
71
+ * @desc Synchronizes the camera position and/or the slab of two (volume) viewports
72
+ * @param id - unique id for the synchronizer @default "default"
73
+ * @param syncTypes - the types of synchronization to perform (camera, slab)
74
+ * @param viewportIds - the ids of the viewport to synchronize
75
+ */
76
+ export declare const syncViewportsSlabAndCamera: (id?: string, syncTypes?: string[], ...viewportIds: string[]) => void;
77
+ /**
78
+ * Create a tool group and add the specified viewports and tools to it.
79
+ * @function createToolGroup
80
+ * @param groupId - The id of the tool group to create. @default "default"
81
+ * @param viewports
82
+ * @param tools
83
+ * @param type - MPR or 3D
84
+ * @returns toolGroup - The created tool group.
85
+ */
86
+ export declare const createToolGroup: (groupId?: string, viewports?: string[], tools?: any[], type?: string) => cornerstoneTools.Types.IToolGroup | undefined;
87
+ /**
88
+ * Destroys a tool group and the tools added to it.
89
+ * @function destroyToolGroup
90
+ * @param groupId - The id of the tool group to destroy. @default "default"
91
+ * @returns void
92
+ */
93
+ export declare const destroyToolGroup: (groupId?: string) => void;
94
+ /**
95
+ * Set slab thickness and mode for a given viewport
96
+ * @function setSlab
97
+ * @param slabThickness - The thickness of the slab [in mm].
98
+ * @param slabMode - The blend mode to use for the slab.
99
+ * @param viewportId - The id of the viewport where the slab will be set.
11
100
  */
12
- export declare const addDefaultTools: (elementId: string, renderingEngine: RenderingEngine) => void;
101
+ export declare const setSlab: (slabThickness: number, slabMode: cornerstone.Enums.BlendModes, viewportId: string) => void;
13
102
  /**
14
- * @function addDefaultTools3D
15
- * @desc Adds default tools to the rendering engine (crosshairs)
16
- * @param elementIds - the ids of the elements where the tools will be added
17
- * @param renderingEngine - the rendering engine where the tools will be added
103
+ * Set the window width and level for a given viewport
104
+ * @param ww - window width
105
+ * @param wl - window level
106
+ * @param viewportId - The id of the viewport where the window width and level will be set.
18
107
  */
19
- export declare const addDefaultTools3D: (elementIds: string[], renderingEngine: RenderingEngine) => void;
108
+ export declare const setWWWL: (ww: number, wl: number, viewportId: string) => void;
@@ -1,4 +1,9 @@
1
1
  import { Enums } from "@cornerstonejs/core";
2
+ export type { Types, VolumeViewport, StackViewport, BaseVolumeViewport } from "@cornerstonejs/core";
3
+ export type { IEnabledElement, Point2, Point3, ICamera } from "@cornerstonejs/core/dist/esm/types";
4
+ export type { Annotation, CanvasCoordinates, EventTypes, InteractionTypes, PublicToolProps, SVGDrawingHelper, TextBoxHandle, ToolHandle, ToolProps } from "@cornerstonejs/tools/dist/esm/types";
5
+ export type { Handles } from "@cornerstonejs/tools/dist/esm/types/AnnotationTypes";
6
+ export type { ROICachedStats } from "@cornerstonejs/tools/dist/esm/types/ToolSpecificAnnotationTypes";
2
7
  export type MprViewport = {
3
8
  viewportId: string;
4
9
  orientation: Enums.OrientationAxis;