larvitar 2.0.7 → 2.0.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.
- package/README.md +2 -2
- package/dist/imaging/imageRendering.d.ts +12 -2
- package/dist/imaging/imageStore.d.ts +5 -64
- package/dist/larvitar.js +22 -9
- package/dist/larvitar.js.map +1 -1
- package/imaging/types.d.ts +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
## Dicom Image Toolkit for CornerstoneJS
|
|
10
10
|
|
|
11
|
-
### Current version: 2.0.
|
|
12
|
-
### Latest Published Release: 2.0.
|
|
11
|
+
### Current version: 2.0.8
|
|
12
|
+
### Latest Published Release: 2.0.8
|
|
13
13
|
|
|
14
14
|
This library provides common DICOM functionalities to be used in web-applications: it's wrapper that simplifies the use of cornerstone-js environment.
|
|
15
15
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* rendering images in html canvas using cornerstone
|
|
4
4
|
*/
|
|
5
5
|
import cornerstone from "cornerstone-core";
|
|
6
|
-
import { Image, Series, StoreViewportOptions, Viewport } from "./types";
|
|
6
|
+
import { Image, Series, StoreViewport, StoreViewportOptions, Viewport } from "./types";
|
|
7
7
|
/**
|
|
8
8
|
* Purge the cornestone internal cache
|
|
9
9
|
* If seriesId is passed as argument only imageIds of the series are purged from internal cache
|
|
@@ -130,7 +130,7 @@ export declare const updateViewportData: (elementId: string, viewportData: Viewp
|
|
|
130
130
|
* @param {String} viewport - The viewport tag name
|
|
131
131
|
* @param {Object} data - The viewport data object
|
|
132
132
|
*/
|
|
133
|
-
export declare const storeViewportData: (image: cornerstone.Image, elementId: string, viewport: Viewport, data:
|
|
133
|
+
export declare const storeViewportData: (image: cornerstone.Image, elementId: string, viewport: Viewport, data: ReturnType<typeof getSeriesData>) => void;
|
|
134
134
|
/**
|
|
135
135
|
* Invert pixels of an image
|
|
136
136
|
* @instance
|
|
@@ -166,3 +166,13 @@ export declare const rotateImageLeft: (elementId: string | HTMLElement) => void;
|
|
|
166
166
|
* @param {Object} elementId - The html div id used for rendering or its DOM HTMLElement
|
|
167
167
|
*/
|
|
168
168
|
export declare const rotateImageRight: (elementId: string | HTMLElement) => void;
|
|
169
|
+
/**
|
|
170
|
+
* Get series metadata from default props and series' metadata
|
|
171
|
+
* @instance
|
|
172
|
+
* @function getSeriesData
|
|
173
|
+
* @param {Object} series - The parsed data series
|
|
174
|
+
* @param {Object} defaultProps - Optional default properties
|
|
175
|
+
* @return {Object} data - A data dictionary with parsed tags' values
|
|
176
|
+
*/
|
|
177
|
+
declare const getSeriesData: (series: Series, defaultProps: StoreViewportOptions) => StoreViewport;
|
|
178
|
+
export {};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @desc This file provides functionalities
|
|
3
3
|
* for data config store.
|
|
4
4
|
*/
|
|
5
|
+
import type { StoreViewport } from "./types.d";
|
|
5
6
|
type StoreSeries = {
|
|
6
7
|
imageIds: string[];
|
|
7
8
|
progress: number;
|
|
@@ -15,12 +16,12 @@ type Store = {
|
|
|
15
16
|
[seriesUID: string]: StoreSeries;
|
|
16
17
|
};
|
|
17
18
|
viewports: {
|
|
18
|
-
[key: string]:
|
|
19
|
+
[key: string]: StoreViewport;
|
|
19
20
|
};
|
|
20
21
|
[key: string]: any;
|
|
21
22
|
};
|
|
22
23
|
type SetPayload = ["errorLog" | "leftActiveTool" | "rightActiveTool", string] | [
|
|
23
|
-
"isColor" | "isMultiframe" | "isPDF" | "isTimeserie" | "ready",
|
|
24
|
+
("isColor" | "isMultiframe" | "isPDF" | "waveform" | "isTimeserie" | "ready"),
|
|
24
25
|
string,
|
|
25
26
|
boolean
|
|
26
27
|
] | [
|
|
@@ -43,67 +44,6 @@ type SetPayload = ["errorLog" | "leftActiveTool" | "rightActiveTool", string] |
|
|
|
43
44
|
number,
|
|
44
45
|
boolean
|
|
45
46
|
];
|
|
46
|
-
export declare const DEFAULT_VIEWPORT: {
|
|
47
|
-
loading: number;
|
|
48
|
-
ready: boolean;
|
|
49
|
-
minSliceId: number;
|
|
50
|
-
maxSliceId: number;
|
|
51
|
-
sliceId: number;
|
|
52
|
-
pendingSliceId?: number;
|
|
53
|
-
minTimeId: number;
|
|
54
|
-
maxTimeId: number;
|
|
55
|
-
timeId: number;
|
|
56
|
-
timestamp: number;
|
|
57
|
-
timestamps: number[];
|
|
58
|
-
timeIds: number[];
|
|
59
|
-
rows: number;
|
|
60
|
-
cols: number;
|
|
61
|
-
spacing_x: number;
|
|
62
|
-
spacing_y: number;
|
|
63
|
-
thickness: number;
|
|
64
|
-
minPixelValue: number;
|
|
65
|
-
maxPixelValue: number;
|
|
66
|
-
isColor: boolean;
|
|
67
|
-
isMultiframe: boolean;
|
|
68
|
-
isTimeserie: boolean;
|
|
69
|
-
isPDF: boolean;
|
|
70
|
-
imageIndex?: number;
|
|
71
|
-
imageId?: string;
|
|
72
|
-
numberOfSlices?: number;
|
|
73
|
-
numberOfTemporalPositions?: number;
|
|
74
|
-
timeIndex?: number;
|
|
75
|
-
viewport: {
|
|
76
|
-
scale: number;
|
|
77
|
-
rotation: number;
|
|
78
|
-
translation: {
|
|
79
|
-
x: number;
|
|
80
|
-
y: number;
|
|
81
|
-
};
|
|
82
|
-
voi: {
|
|
83
|
-
windowCenter: number;
|
|
84
|
-
windowWidth: number;
|
|
85
|
-
};
|
|
86
|
-
rows: number;
|
|
87
|
-
cols: number;
|
|
88
|
-
spacing_x: number;
|
|
89
|
-
spacing_y: number;
|
|
90
|
-
thickness: number;
|
|
91
|
-
};
|
|
92
|
-
default: {
|
|
93
|
-
scale: number;
|
|
94
|
-
rotation: number;
|
|
95
|
-
translation: {
|
|
96
|
-
x: number;
|
|
97
|
-
y: number;
|
|
98
|
-
};
|
|
99
|
-
voi: {
|
|
100
|
-
windowCenter: number;
|
|
101
|
-
windowWidth: number;
|
|
102
|
-
invert: boolean;
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
export type Viewport = typeof DEFAULT_VIEWPORT;
|
|
107
47
|
export declare const set: (payload: SetPayload) => void;
|
|
108
48
|
declare const _default: {
|
|
109
49
|
initialize: () => void;
|
|
@@ -115,10 +55,11 @@ declare const _default: {
|
|
|
115
55
|
setSliceId: (elementId: string, imageIndex: number) => void;
|
|
116
56
|
setPendingSliceId: (elementId: string, imageIndex: number) => void;
|
|
117
57
|
setMaxSliceId: (elementId: string, imageIndex: number) => void;
|
|
58
|
+
setTimeId: (elementId: string, timeIndex: number) => void;
|
|
118
59
|
get: (props: string | string[]) => any;
|
|
119
60
|
addStoreListener: (listener: (data: Store) => {}) => (data: Store) => {};
|
|
120
61
|
removeStoreListener: () => undefined;
|
|
121
|
-
addViewportListener: (elementId: string, listener: (data:
|
|
62
|
+
addViewportListener: (elementId: string, listener: (data: StoreViewport) => {}) => void;
|
|
122
63
|
removeViewportListener: (elementId: string) => void;
|
|
123
64
|
addSeriesListener: (seriesId: string, listener: (data: StoreSeries) => {}) => void;
|
|
124
65
|
removeSeriesListener: (seriesId: string) => void;
|
package/dist/larvitar.js
CHANGED
|
@@ -81931,18 +81931,24 @@ const storeViewportData = function (image, elementId, viewport, data) {
|
|
|
81931
81931
|
(0, imageStore_1.set)(["maxPixelValue", elementId, image.maxPixelValue]);
|
|
81932
81932
|
// slice id from 0 to n - 1
|
|
81933
81933
|
(0, imageStore_1.set)(["minSliceId", elementId, 0]);
|
|
81934
|
-
|
|
81934
|
+
if (data.imageIndex) {
|
|
81935
|
+
(0, imageStore_1.set)(["sliceId", elementId, data.imageIndex]);
|
|
81936
|
+
}
|
|
81935
81937
|
const pendingSliceId = imageStore_1.default.get(["viewports", elementId, "pendingSliceId"]);
|
|
81936
81938
|
if (data.imageIndex == pendingSliceId) {
|
|
81937
81939
|
(0, imageStore_1.set)(["pendingSliceId", elementId, undefined]);
|
|
81938
81940
|
}
|
|
81939
|
-
|
|
81941
|
+
if (data.numberOfSlices) {
|
|
81942
|
+
(0, imageStore_1.set)(["maxSliceId", elementId, data.numberOfSlices - 1]);
|
|
81943
|
+
}
|
|
81940
81944
|
if (data.isTimeserie) {
|
|
81941
81945
|
(0, imageStore_1.set)(["minTimeId", elementId, 0]);
|
|
81942
81946
|
(0, imageStore_1.set)(["timeId", elementId, data.timeIndex || 0]);
|
|
81943
|
-
(
|
|
81944
|
-
|
|
81945
|
-
|
|
81947
|
+
if (data.numberOfSlices && data.numberOfTemporalPositions) {
|
|
81948
|
+
(0, imageStore_1.set)(["maxTimeId", elementId, data.numberOfTemporalPositions - 1]);
|
|
81949
|
+
let maxSliceId = data.numberOfSlices * data.numberOfTemporalPositions - 1;
|
|
81950
|
+
(0, imageStore_1.set)(["maxSliceId", elementId, maxSliceId]);
|
|
81951
|
+
}
|
|
81946
81952
|
(0, imageStore_1.set)(["timestamp", elementId, data.timestamp]);
|
|
81947
81953
|
(0, imageStore_1.set)(["timestamps", elementId, data.timestamps]);
|
|
81948
81954
|
(0, imageStore_1.set)(["timeIds", elementId, data.timeIds]);
|
|
@@ -81984,6 +81990,7 @@ const storeViewportData = function (image, elementId, viewport, data) {
|
|
|
81984
81990
|
(0, imageStore_1.set)(["isMultiframe", elementId, data.isMultiframe]);
|
|
81985
81991
|
(0, imageStore_1.set)(["isTimeserie", elementId, data.isTimeserie]);
|
|
81986
81992
|
(0, imageStore_1.set)(["isPDF", elementId, false]);
|
|
81993
|
+
(0, imageStore_1.set)(["waveform", elementId, data.waveform]);
|
|
81987
81994
|
};
|
|
81988
81995
|
exports.storeViewportData = storeViewportData;
|
|
81989
81996
|
/**
|
|
@@ -82150,6 +82157,7 @@ const getSeriesData = function (series, defaultProps) {
|
|
|
82150
82157
|
: null;
|
|
82151
82158
|
data.isColor = series.color;
|
|
82152
82159
|
data.isPDF = series.isPDF;
|
|
82160
|
+
data.waveform = series.waveform;
|
|
82153
82161
|
if (instance) {
|
|
82154
82162
|
data.rows = instance.metadata.x00280010;
|
|
82155
82163
|
data.cols = instance.metadata.x00280011;
|
|
@@ -82277,7 +82285,7 @@ exports.resliceSeries = resliceSeries;
|
|
|
82277
82285
|
* for data config store.
|
|
82278
82286
|
*/
|
|
82279
82287
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
82280
|
-
exports.set =
|
|
82288
|
+
exports.set = void 0;
|
|
82281
82289
|
// external libraries
|
|
82282
82290
|
const lodash_1 = __webpack_require__(6486);
|
|
82283
82291
|
// Larvitar store object
|
|
@@ -82296,7 +82304,7 @@ const INITIAL_STORE_DATA = {
|
|
|
82296
82304
|
viewports: {}
|
|
82297
82305
|
};
|
|
82298
82306
|
// default viewport object
|
|
82299
|
-
|
|
82307
|
+
const DEFAULT_VIEWPORT = {
|
|
82300
82308
|
loading: 0,
|
|
82301
82309
|
ready: false,
|
|
82302
82310
|
minSliceId: 0,
|
|
@@ -82320,6 +82328,7 @@ exports.DEFAULT_VIEWPORT = {
|
|
|
82320
82328
|
isMultiframe: false,
|
|
82321
82329
|
isTimeserie: false,
|
|
82322
82330
|
isPDF: false,
|
|
82331
|
+
waveform: false,
|
|
82323
82332
|
viewport: {
|
|
82324
82333
|
scale: 0.0,
|
|
82325
82334
|
rotation: 0.0,
|
|
@@ -82386,6 +82395,7 @@ const setValue = (store, data) => {
|
|
|
82386
82395
|
case "isColor":
|
|
82387
82396
|
case "isMultiframe":
|
|
82388
82397
|
case "isPDF":
|
|
82398
|
+
case "waveform":
|
|
82389
82399
|
case "isTimeserie":
|
|
82390
82400
|
case "ready":
|
|
82391
82401
|
if (!viewport) {
|
|
@@ -82547,7 +82557,7 @@ exports["default"] = {
|
|
|
82547
82557
|
// add/remove viewports
|
|
82548
82558
|
addViewport: (name) => {
|
|
82549
82559
|
validateStore();
|
|
82550
|
-
STORE.viewports[name] = (0, lodash_1.cloneDeep)(
|
|
82560
|
+
STORE.viewports[name] = (0, lodash_1.cloneDeep)(DEFAULT_VIEWPORT);
|
|
82551
82561
|
},
|
|
82552
82562
|
deleteViewport: (name) => {
|
|
82553
82563
|
validateStore();
|
|
@@ -82580,6 +82590,9 @@ exports["default"] = {
|
|
|
82580
82590
|
setMaxSliceId: (elementId, imageIndex) => {
|
|
82581
82591
|
(0, exports.set)(["maxSliceId", elementId, imageIndex]);
|
|
82582
82592
|
},
|
|
82593
|
+
setTimeId: (elementId, timeIndex) => {
|
|
82594
|
+
(0, exports.set)(["timeId", elementId, timeIndex]);
|
|
82595
|
+
},
|
|
82583
82596
|
// get
|
|
82584
82597
|
get: (props) => {
|
|
82585
82598
|
validateStore();
|
|
@@ -88923,7 +88936,7 @@ module.exports = JSON.parse('{"x00000000":{"tag":"x00000000","vr":"UL","vm":"1",
|
|
|
88923
88936
|
/***/ ((module) => {
|
|
88924
88937
|
|
|
88925
88938
|
"use strict";
|
|
88926
|
-
module.exports = JSON.parse('{"name":"larvitar","keywords":["DICOM","imaging","medical","cornerstone"],"version":"2.0.
|
|
88939
|
+
module.exports = JSON.parse('{"name":"larvitar","keywords":["DICOM","imaging","medical","cornerstone"],"version":"2.0.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"],"scripts":{"coverage":"typescript-coverage-report","generate-docs":"node_modules/.bin/jsdoc -c jsdoc.json","build":"webpack --config ./bundler/webpack.prod.js && cp ./dist/larvitar.js ./docs/examples/larvitar.js","dev":"webpack --progress --config ./bundler/webpack.dev.js && cp ./dist/larvitar.js ./docs/examples/larvitar.js","dev-wip":"webpack serve --config ./bundler/webpack.dev-wip.js"},"author":"Simone Manini <simone.manini@dvisionlab.com> (https://www.dvisionlab.com)","contributors":["Mattia Ronzoni <mattia.ronzoni@dvisionlab.com> (https://www.dvisionlab.com)","Sara Zanchi <sara.zanchi@dvisionlab.com> (https://www.dvisionlab.com)","Ale Re <ale.re@dvisionlab.com> (https://www.dvisionlab.com)","Laura Borghesi Re <laura.borghesi@dvisionlab.com> (https://www.dvisionlab.com)"],"license":"MIT","dependencies":{"@rollup/plugin-commonjs":"^17.1.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","dicom-character-set":"^1.0.3","dicom-parser":"^1.8.13","docdash":"^1.2.0","hammerjs":"^2.0.8","jpeg-lossless-decoder-js":"^2.0.7","keycode-js":"^3.1.0","lodash":"^4.17.15","pako":"^1.0.10","papaparse":"^5.3.0","plotly.js-dist-min":"^2.27.1","uuid":"^8.3.2"},"devDependencies":{"@babel/core":"^7.21.8","@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","babel-loader":"^9.1.2","clean-webpack-plugin":"^4.0.0","copy-webpack-plugin":"^11.0.0","fs":"^0.0.1-security","html-loader":"^4.2.0","html-webpack-plugin":"^5.5.0","ip":"^1.1.8","jsdoc":"^3.6.4","portfinder-sync":"^0.0.2","ts-loader":"^9.4.2","typescript":"^5.0.2","typescript-coverage-report":"^0.7.0","webpack":"^5.76.3","webpack-bundle-analyzer":"^4.8.0","webpack-cli":"^5.0.1","webpack-dev-server":"^4.13.1"}}');
|
|
88927
88940
|
|
|
88928
88941
|
/***/ })
|
|
88929
88942
|
|