larvitar 4.0.0-alpha.7 → 4.0.0-alpha.8
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.
|
@@ -21,6 +21,18 @@ declare const DEFAULT_TOOLS: {
|
|
|
21
21
|
declare const dvTools: {
|
|
22
22
|
[key: string]: any;
|
|
23
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
|
+
};
|
|
24
36
|
/**
|
|
25
37
|
* Tools default style
|
|
26
38
|
* Available font families :
|
|
@@ -57,4 +69,4 @@ declare const setDefaultToolsProps: (newProps: Partial<ToolConfig>[]) => void;
|
|
|
57
69
|
* NOTE: toolClass must be a valid cornerstone tool
|
|
58
70
|
*/
|
|
59
71
|
declare const registerExternalTool: (toolName: string, toolClass: any, toolVersion?: "MPR" | "3D" | "") => void;
|
|
60
|
-
export { DEFAULT_TOOLS, DEFAULT_TOOLS_3D, DEFAULT_TOOLS_MPR, DEFAULT_STYLE, DEFAULT_SETTINGS, DEFAULT_MOUSE_KEYS, dvTools, getDefaultToolsByType, setDefaultToolsProps, registerExternalTool };
|
|
72
|
+
export { DEFAULT_TOOLS, DEFAULT_TOOLS_3D, DEFAULT_TOOLS_MPR, DEFAULT_STYLE, DEFAULT_SETTINGS, DEFAULT_MOUSE_KEYS, dvTools, dvTools3D, dvToolsMPR, getDefaultToolsByType, setDefaultToolsProps, registerExternalTool };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseTool } from "@cornerstonejs/tools";
|
|
2
|
+
import { Viewport } from "@cornerstonejs/core";
|
|
2
3
|
import * as EventTypes from "@cornerstonejs/tools/dist/esm/types/EventTypes";
|
|
3
4
|
/**
|
|
4
5
|
* WindowLevel tool manipulates the windowLevel applied to a viewport. It
|
|
@@ -14,16 +15,16 @@ declare class CustomWWWLTool extends BaseTool {
|
|
|
14
15
|
touchDragCallback(evt: EventTypes.InteractionEventType): void;
|
|
15
16
|
mouseDragCallback(evt: EventTypes.InteractionEventType): void;
|
|
16
17
|
getPTScaledNewRange({ deltaPointsCanvas, lower, upper, clientHeight, viewport, volumeId, isPreScaled }: {
|
|
17
|
-
deltaPointsCanvas:
|
|
18
|
-
lower:
|
|
19
|
-
upper:
|
|
20
|
-
clientHeight:
|
|
21
|
-
viewport:
|
|
22
|
-
volumeId
|
|
23
|
-
isPreScaled:
|
|
18
|
+
deltaPointsCanvas: number[];
|
|
19
|
+
lower: number;
|
|
20
|
+
upper: number;
|
|
21
|
+
clientHeight: number;
|
|
22
|
+
viewport: Viewport;
|
|
23
|
+
volumeId?: string;
|
|
24
|
+
isPreScaled: boolean;
|
|
24
25
|
}): {
|
|
25
|
-
lower:
|
|
26
|
-
upper:
|
|
26
|
+
lower: number;
|
|
27
|
+
upper: number;
|
|
27
28
|
};
|
|
28
29
|
getNewRange({ viewport, deltaPointsCanvas, volumeId, lower, upper }: {
|
|
29
30
|
viewport: any;
|
|
@@ -15,19 +15,23 @@ import type { RenderingEngine } from "@cornerstonejs/core";
|
|
|
15
15
|
*/
|
|
16
16
|
export declare const initializeCSTools: (settings?: ToolSettings, style?: ToolStyle) => Promise<void>;
|
|
17
17
|
/**
|
|
18
|
-
* Add a cornerstone tool (grab it from original library or dvision custom tools)
|
|
19
|
-
* @param {
|
|
20
|
-
* @param {
|
|
18
|
+
* Add a cornerstone 3D tool (grab it from original library or dvision custom 3D or MPR tools)
|
|
19
|
+
* @param {String} toolName
|
|
20
|
+
* @param {Partial<ToolConfig>} customConfig
|
|
21
|
+
* @param {String} type The type of tool to add (3D or MPR)
|
|
22
|
+
* @param {String} groupId The cornerstone3D Tool GroupID
|
|
21
23
|
* @example larvitar.addTool("ScaleOverlay", {configuration:{minorTickLength: 10, majorTickLength: 25}}, "viewer")
|
|
22
24
|
*/
|
|
23
|
-
export declare const addTool: (toolName: string, customConfig: Partial<ToolConfig>, groupId?: string) => void;
|
|
25
|
+
export declare const addTool: (toolName: string, customConfig: Partial<ToolConfig>, type?: string, groupId?: string) => void;
|
|
24
26
|
/**
|
|
25
27
|
* @function addDefaultTools
|
|
26
28
|
* @desc Adds default tools to the rendering engine (wwwl, pan, zoom, stackScroll)
|
|
27
|
-
* @param
|
|
28
|
-
* @param renderingEngine - the rendering engine where the tools will be added
|
|
29
|
+
* @param {String[]} elementIds - the ids of the elements where the tools will be added
|
|
30
|
+
* @param {RenderingEngine} renderingEngine - the rendering engine where the tools will be added
|
|
31
|
+
* @param {String} type The type of tool to add (3D or MPR)
|
|
32
|
+
* @param {String} groupId The cornerstone3D Tool GroupID
|
|
29
33
|
*/
|
|
30
|
-
export declare const addDefaultTools: (elementIds: string[], renderingEngine: RenderingEngine, type?: string) => void;
|
|
34
|
+
export declare const addDefaultTools: (elementIds: string[], renderingEngine: RenderingEngine, type?: string, toolGroupId?: string) => void;
|
|
31
35
|
/**
|
|
32
36
|
* Set Tool "active" on all elements (ie, rendered and manipulable)
|
|
33
37
|
* @param toolName - The tool name.
|
|
@@ -53,9 +57,10 @@ export declare const syncViewportsCamera: (id: string | undefined, targetViewpor
|
|
|
53
57
|
* @param groupId - The id of the tool group to create. @default "default"
|
|
54
58
|
* @param viewports
|
|
55
59
|
* @param tools
|
|
60
|
+
* @param type - MPR or 3D
|
|
56
61
|
* @returns toolGroup - The created tool group.
|
|
57
62
|
*/
|
|
58
|
-
export declare const createToolGroup: (groupId?: string, viewports?: string[], tools?: any[]) => cornerstoneTools.Types.IToolGroup | undefined;
|
|
63
|
+
export declare const createToolGroup: (groupId?: string, viewports?: string[], tools?: any[], type?: string) => cornerstoneTools.Types.IToolGroup | undefined;
|
|
59
64
|
/**
|
|
60
65
|
* Set slab thickness and mode for a given viewport
|
|
61
66
|
* @function setSlab
|
package/dist/larvitar.js
CHANGED
|
@@ -85551,7 +85551,7 @@ __webpack_require__.d(index_dist_esm_constants_namespaceObject, {
|
|
|
85551
85551
|
});
|
|
85552
85552
|
|
|
85553
85553
|
;// ./package.json
|
|
85554
|
-
const index_package_namespaceObject = /*#__PURE__*/JSON.parse('{"name":"larvitar","keywords":["DICOM","imaging","medical","cornerstone"],"version":"4.0.0-alpha.
|
|
85554
|
+
const index_package_namespaceObject = /*#__PURE__*/JSON.parse('{"name":"larvitar","keywords":["DICOM","imaging","medical","cornerstone"],"version":"4.0.0-alpha.8","description":"typescript library for parsing, loading, rendering and interacting with DICOM images","repository":{"url":"https://github.com/dvisionlab/Larvitar.git","type":"git"},"main":"dist/larvitar.js","types":"dist/index.d.ts","files":["dist","imaging/**/*.d.ts","imaging3d/**/*.d.ts"],"scripts":{"coverage":"typescript-coverage-report","format":"prettier --write \\"imaging/**/*.{js,ts,json,css,md}\\" \\"imaging3d/**/*.{js,ts,json,css,md}\\" \\"docs/examples/**/*.html\\"","format:check":"prettier --check \\"imaging/**/*.{js,ts,json,css,md}\\" \\"imaging3d/**/*.{js,ts,json,css,md}\\" \\"docs/examples/**/*.html\\"","postinstall":"patch-package","build":"webpack --config ./bundler/webpack.prod.debug.js","dev":"webpack --progress --config ./bundler/webpack.dev.js","docs:dev":"vuepress dev docs","docs:build":"vuepress build docs","cypress":"cypress open","cypress:run":"cypress run","cypress:run:headless":"cypress run --headless"},"author":"Simone Manini <simone.manini@dvisionlab.com> (https://www.dvisionlab.com)","contributors":["Mattia Ronzoni <mattia.ronzoni@dvisionlab.com> (https://www.dvisionlab.com)","Laura Borghesi <laura.borghesi@dvisionlab.com> (https://www.dvisionlab.com)","Sara Zanchi <sara.zanchi@dvisionlab.com> (https://www.dvisionlab.com)"],"license":"MIT","dependencies":{"@cornerstonejs/core":"^3.12.1","@cornerstonejs/dicom-image-loader":"^3.12.1","@cornerstonejs/nifti-volume-loader":"^3.12.1","@cornerstonejs/tools":"^3.12.1","@hyzyla/pdfium":"^2.1.2","@icr/polyseg-wasm":"^0.4.0","consola":"^3.4.0","cornerstone-core":"^2.6.1","cornerstone-file-image-loader":"^0.3.0","cornerstone-tools":"^6.0.7","cornerstone-wado-image-loader":"^4.13.2","cornerstone-web-image-loader":"^2.1.1","crypto-js":"^4.1.1","dcmjs":"^0.34.0","dicom-character-set":"^1.0.3","dicom-parser":"^1.8.13","hammerjs":"^2.0.8","jpeg-lossless-decoder-js":"^2.0.7","keycode-js":"^3.1.0","lodash":"^4.17.15","pako":"^1.0.10","plotly.js-dist-min":"^2.27.1","uuid":"^8.3.2"},"devDependencies":{"@babel/core":"^7.21.8","@rollup/plugin-commonjs":"^28.0.3","@types/cornerstone-core":"^2.3.0","@types/crypto-js":"^4.1.1","@types/hammerjs":"^2.0.41","@types/lodash":"^4.14.192","@types/papaparse":"^5.3.7","@types/plotly.js":"^2.12.30","@types/plotly.js-dist-min":"^2.3.4","@types/uuid":"^9.0.1","@vuepress/bundler-vite":"^2.0.0-rc.18","@vuepress/plugin-slimsearch":"^2.0.0-rc.68","@vuepress/theme-default":"^2.0.0-rc.60","babel-loader":"^9.1.2","clean-webpack-plugin":"^4.0.0","cypress":"^14.2.0","cypress-image-snapshot":"^4.0.1","cypress-mochawesome-reporter":"^3.8.2","cypress-multi-reporters":"^2.0.5","eslint":"^9.17.0","html-loader":"^4.2.0","html-webpack-plugin":"^5.6.0","jsdom":"^26.0.0","lodash-webpack-plugin":"^0.11.6","mocha-json-reporter":"^1.0.0-1","patch-package":"^8.0.0","prettier":"^3.5.3","sass-embedded":"^1.80.7","ts-loader":"^9.4.2","typescript":"^5.0.2","typescript-coverage-report":"^0.7.0","vuepress":"^2.0.0-rc.18","webpack":"^5.76.3","webpack-cli":"^5.0.1","webpack-dev-server":"^4.13.1"}}');
|
|
85555
85555
|
// EXTERNAL MODULE: ./node_modules/cornerstone-core/dist/cornerstone.js
|
|
85556
85556
|
var index_dist_cornerstone = __webpack_require__(1198);
|
|
85557
85557
|
var index_cornerstone_default = /*#__PURE__*/__webpack_require__.n(index_dist_cornerstone);
|
|
@@ -97936,6 +97936,14 @@ const index_dvTools = {
|
|
|
97936
97936
|
RotateTool: index_RotateTool,
|
|
97937
97937
|
GspsTool: index_GspsTool
|
|
97938
97938
|
};
|
|
97939
|
+
/**
|
|
97940
|
+
* D/Vision Lab 3D custom tools
|
|
97941
|
+
*/
|
|
97942
|
+
const index_dvTools3D = {};
|
|
97943
|
+
/**
|
|
97944
|
+
* D/Vision Lab MPR custom tools
|
|
97945
|
+
*/
|
|
97946
|
+
const index_dvToolsMPR = {};
|
|
97939
97947
|
/**
|
|
97940
97948
|
* Tools default style
|
|
97941
97949
|
* Available font families :
|
|
@@ -98034,7 +98042,12 @@ const index_registerExternalTool = function (toolName, toolClass, toolVersion =
|
|
|
98034
98042
|
: toolVersion === "3D"
|
|
98035
98043
|
? index_DEFAULT_TOOLS_3D
|
|
98036
98044
|
: index_DEFAULT_TOOLS;
|
|
98037
|
-
|
|
98045
|
+
const customTools = toolVersion === "MPR"
|
|
98046
|
+
? index_dvToolsMPR
|
|
98047
|
+
: toolVersion === "3D"
|
|
98048
|
+
? index_dvTools3D
|
|
98049
|
+
: index_dvTools;
|
|
98050
|
+
customTools[toolClass.name] = toolClass;
|
|
98038
98051
|
targetTools[toolName] = {
|
|
98039
98052
|
name: toolName,
|
|
98040
98053
|
class: toolClass.name,
|
|
@@ -284168,13 +284181,24 @@ const index_main_isToolMissing = function (toolName, targetElementId) {
|
|
|
284168
284181
|
return false;
|
|
284169
284182
|
};
|
|
284170
284183
|
/**
|
|
284171
|
-
* Add a cornerstone tool (grab it from original library or dvision custom tools)
|
|
284172
|
-
* @param {
|
|
284173
|
-
* @param {
|
|
284184
|
+
* Add a cornerstone 3D tool (grab it from original library or dvision custom 3D or MPR tools)
|
|
284185
|
+
* @param {String} toolName
|
|
284186
|
+
* @param {Partial<ToolConfig>} customConfig
|
|
284187
|
+
* @param {String} type The type of tool to add (3D or MPR)
|
|
284188
|
+
* @param {String} groupId The cornerstone3D Tool GroupID
|
|
284174
284189
|
* @example larvitar.addTool("ScaleOverlay", {configuration:{minorTickLength: 10, majorTickLength: 25}}, "viewer")
|
|
284175
284190
|
*/
|
|
284176
|
-
const index_main_addTool = function (toolName, customConfig, groupId) {
|
|
284177
|
-
|
|
284191
|
+
const index_main_addTool = function (toolName, customConfig, type, groupId) {
|
|
284192
|
+
let allToolsList;
|
|
284193
|
+
if (type === "3D") {
|
|
284194
|
+
allToolsList = index_DEFAULT_TOOLS_3D;
|
|
284195
|
+
}
|
|
284196
|
+
else if (type === "MPR") {
|
|
284197
|
+
allToolsList = index_DEFAULT_TOOLS_MPR;
|
|
284198
|
+
}
|
|
284199
|
+
else {
|
|
284200
|
+
allToolsList = Object.assign(Object.assign({}, index_DEFAULT_TOOLS_3D), index_DEFAULT_TOOLS_MPR);
|
|
284201
|
+
}
|
|
284178
284202
|
console.log("allToolsList", allToolsList);
|
|
284179
284203
|
// extend defaults with user custom props
|
|
284180
284204
|
let defaultConfig = allToolsList[toolName]
|
|
@@ -284185,7 +284209,17 @@ const index_main_addTool = function (toolName, customConfig, groupId) {
|
|
|
284185
284209
|
if (!toolClassName) {
|
|
284186
284210
|
throw new Error(`Tool ${toolName} class not found. Please check tools/default or pass a valid tool class name in the configuration object.`);
|
|
284187
284211
|
}
|
|
284188
|
-
|
|
284212
|
+
let customTool;
|
|
284213
|
+
if (type === "3D") {
|
|
284214
|
+
customTool = index_dvTools3D[toolClassName];
|
|
284215
|
+
}
|
|
284216
|
+
else if (type === "MPR") {
|
|
284217
|
+
customTool = index_dvToolsMPR[toolClassName];
|
|
284218
|
+
}
|
|
284219
|
+
else {
|
|
284220
|
+
customTool = index_dvTools3D[toolClassName] || index_dvToolsMPR[toolClassName];
|
|
284221
|
+
}
|
|
284222
|
+
const toolClass = customTool ||
|
|
284189
284223
|
index_dist_esm_namespaceObject[toolClassName];
|
|
284190
284224
|
index_addTool_addTool(toolClass);
|
|
284191
284225
|
if (groupId) {
|
|
@@ -284202,11 +284236,13 @@ const index_main_addTool = function (toolName, customConfig, groupId) {
|
|
|
284202
284236
|
/**
|
|
284203
284237
|
* @function addDefaultTools
|
|
284204
284238
|
* @desc Adds default tools to the rendering engine (wwwl, pan, zoom, stackScroll)
|
|
284205
|
-
* @param
|
|
284206
|
-
* @param renderingEngine - the rendering engine where the tools will be added
|
|
284239
|
+
* @param {String[]} elementIds - the ids of the elements where the tools will be added
|
|
284240
|
+
* @param {RenderingEngine} renderingEngine - the rendering engine where the tools will be added
|
|
284241
|
+
* @param {String} type The type of tool to add (3D or MPR)
|
|
284242
|
+
* @param {String} groupId The cornerstone3D Tool GroupID
|
|
284207
284243
|
*/
|
|
284208
|
-
const index_main_addDefaultTools = function (elementIds, renderingEngine, type = "
|
|
284209
|
-
) {
|
|
284244
|
+
const index_main_addDefaultTools = function (elementIds, renderingEngine, type = "3D", // "MPR" or "3D"
|
|
284245
|
+
toolGroupId = "default") {
|
|
284210
284246
|
elementIds.forEach(elementId => {
|
|
284211
284247
|
const element = renderingEngine.getViewport(elementId).element;
|
|
284212
284248
|
try {
|
|
@@ -284220,7 +284256,6 @@ const index_main_addDefaultTools = function (elementIds, renderingEngine, type =
|
|
|
284220
284256
|
const viewport = renderingEngine.getViewport(elementId);
|
|
284221
284257
|
index_stackPrefetch_stackPrefetch.enable(viewport.element);
|
|
284222
284258
|
});
|
|
284223
|
-
const toolGroupId = "default"; // TODO as param with default value
|
|
284224
284259
|
const toolGroup = index_ToolGroupManager_createToolGroup(toolGroupId);
|
|
284225
284260
|
if (!toolGroup) {
|
|
284226
284261
|
index_logger_logger.error("addDefaultTools: tool group not created");
|
|
@@ -284229,10 +284264,10 @@ const index_main_addDefaultTools = function (elementIds, renderingEngine, type =
|
|
|
284229
284264
|
elementIds.forEach(viewportId => {
|
|
284230
284265
|
toolGroup.addViewport(viewportId, renderingEngine.id);
|
|
284231
284266
|
});
|
|
284232
|
-
const toolsList = type === "
|
|
284267
|
+
const toolsList = type === "3D" ? index_DEFAULT_TOOLS_3D : index_DEFAULT_TOOLS_MPR;
|
|
284233
284268
|
// for each default tool
|
|
284234
284269
|
(0,index_lodash.each)(toolsList, tool => {
|
|
284235
|
-
index_main_addTool(tool.name, tool.configuration);
|
|
284270
|
+
index_main_addTool(tool.name, tool.configuration, type);
|
|
284236
284271
|
toolGroup.addTool(tool.name, tool.configuration);
|
|
284237
284272
|
index_logger_logger.debug(`Tool ${tool.name} added to group:`, toolGroupId);
|
|
284238
284273
|
// if sync tool, enable
|
|
@@ -284243,7 +284278,7 @@ const index_main_addDefaultTools = function (elementIds, renderingEngine, type =
|
|
|
284243
284278
|
// TODO handle options (mouseButtonMask, etc) and other modes (eg passive)
|
|
284244
284279
|
if (tool.defaultActive) {
|
|
284245
284280
|
console.log("setToolActive", tool.name, tool.options);
|
|
284246
|
-
index_main_setToolActive(tool.name, tool.options,
|
|
284281
|
+
index_main_setToolActive(tool.name, tool.options, toolGroupId, true);
|
|
284247
284282
|
index_logger_logger.debug(`Tool ${tool.name} set as default active`);
|
|
284248
284283
|
}
|
|
284249
284284
|
});
|
|
@@ -284381,10 +284416,11 @@ targetViewportId, sourceViewportId) {
|
|
|
284381
284416
|
* @param groupId - The id of the tool group to create. @default "default"
|
|
284382
284417
|
* @param viewports
|
|
284383
284418
|
* @param tools
|
|
284419
|
+
* @param type - MPR or 3D
|
|
284384
284420
|
* @returns toolGroup - The created tool group.
|
|
284385
284421
|
*/
|
|
284386
|
-
const index_main_createToolGroup = function (groupId = "default", viewports = [], tools = [] // TODO type this properly
|
|
284387
|
-
) {
|
|
284422
|
+
const index_main_createToolGroup = function (groupId = "default", viewports = [], tools = [], // TODO type this properly
|
|
284423
|
+
type) {
|
|
284388
284424
|
const toolGroup = index_ToolGroupManager_createToolGroup(groupId);
|
|
284389
284425
|
if (!toolGroup) {
|
|
284390
284426
|
index_logger_logger.error("createToolGroup: tool group not created");
|
|
@@ -284400,7 +284436,7 @@ const index_main_createToolGroup = function (groupId = "default", viewports = []
|
|
|
284400
284436
|
toolGroup.addViewport(vp, renderingEngineId);
|
|
284401
284437
|
});
|
|
284402
284438
|
tools.forEach(tool => {
|
|
284403
|
-
index_main_addTool(tool.name, tool.configuration, groupId);
|
|
284439
|
+
index_main_addTool(tool.name, tool.configuration, type, groupId);
|
|
284404
284440
|
index_logger_logger.debug(`Tool ${tool.name} added to group:`, groupId);
|
|
284405
284441
|
});
|
|
284406
284442
|
return toolGroup;
|
|
@@ -284434,7 +284470,9 @@ const index_setWWWL = function (ww, wl, viewportId) {
|
|
|
284434
284470
|
index_logger_logger.error("setWWWL: viewport not found");
|
|
284435
284471
|
return;
|
|
284436
284472
|
}
|
|
284437
|
-
viewport.setProperties({
|
|
284473
|
+
viewport.setProperties({
|
|
284474
|
+
voiRange: { lower: wl - ww / 2, upper: wl + ww / 2 }
|
|
284475
|
+
});
|
|
284438
284476
|
viewport.render();
|
|
284439
284477
|
};
|
|
284440
284478
|
|
|
@@ -284568,7 +284606,6 @@ class index_CustomWWWLTool extends index_base_BaseTool {
|
|
|
284568
284606
|
return;
|
|
284569
284607
|
}
|
|
284570
284608
|
}
|
|
284571
|
-
// @ts-ignore
|
|
284572
284609
|
getPTScaledNewRange({ deltaPointsCanvas, lower, upper, clientHeight, viewport, volumeId, isPreScaled }) {
|
|
284573
284610
|
let multiplier = index_exampleCustomTool_DEFAULT_MULTIPLIER;
|
|
284574
284611
|
if (isPreScaled) {
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"medical",
|
|
7
7
|
"cornerstone"
|
|
8
8
|
],
|
|
9
|
-
"version": "4.0.0-alpha.
|
|
9
|
+
"version": "4.0.0-alpha.8",
|
|
10
10
|
"description": "typescript library for parsing, loading, rendering and interacting with DICOM images",
|
|
11
11
|
"repository": {
|
|
12
12
|
"url": "https://github.com/dvisionlab/Larvitar.git",
|