larvitar 1.5.13 → 2.0.0
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/.vscode/settings.json +4 -0
- package/README.md +78 -48
- package/bundler/webpack.common.js +27 -0
- package/bundler/webpack.dev.js +23 -0
- package/bundler/webpack.prod.js +19 -0
- package/decs.d.ts +12 -0
- package/dist/imaging/MetaDataReadable.d.ts +39 -0
- package/dist/imaging/MetaDataTypes.d.ts +3488 -0
- package/dist/imaging/imageAnonymization.d.ts +12 -0
- package/dist/imaging/imageColormaps.d.ts +47 -0
- package/dist/imaging/imageContours.d.ts +18 -0
- package/dist/imaging/imageIo.d.ts +42 -0
- package/dist/imaging/imageLayers.d.ts +56 -0
- package/dist/imaging/imageLoading.d.ts +65 -0
- package/dist/imaging/imageParsing.d.ts +46 -0
- package/dist/imaging/imagePresets.d.ts +43 -0
- package/dist/imaging/imageRendering.d.ts +238 -0
- package/dist/imaging/imageReslice.d.ts +14 -0
- package/dist/imaging/imageStore.d.ts +121 -0
- package/dist/imaging/imageTags.d.ts +22 -0
- package/dist/imaging/imageTools.d.ts +20 -0
- package/dist/imaging/imageUtils.d.ts +165 -0
- package/dist/imaging/loaders/commonLoader.d.ts +103 -0
- package/dist/imaging/loaders/dicomLoader.d.ts +29 -0
- package/dist/imaging/loaders/fileLoader.d.ts +33 -0
- package/dist/imaging/loaders/multiframeLoader.d.ts +37 -0
- package/dist/imaging/loaders/nrrdLoader.d.ts +112 -0
- package/dist/imaging/loaders/resliceLoader.d.ts +15 -0
- package/dist/imaging/monitors/memory.d.ts +41 -0
- package/dist/imaging/monitors/performance.d.ts +23 -0
- package/dist/imaging/parsers/ecg.d.ts +15 -0
- package/dist/imaging/parsers/nrrd.d.ts +3 -0
- package/dist/imaging/tools/custom/4dSliceScrollTool.d.ts +12 -0
- package/dist/imaging/tools/custom/contourTool.d.ts +409 -0
- package/dist/imaging/tools/custom/diameterTool.d.ts +18 -0
- package/dist/imaging/tools/custom/editMaskTool.d.ts +22 -0
- package/dist/imaging/tools/custom/ellipticalRoiOverlayTool.d.ts +45 -0
- package/dist/imaging/tools/custom/polygonSegmentationMixin.d.ts +54 -0
- package/dist/imaging/tools/custom/polylineScissorsTool.d.ts +11 -0
- package/dist/imaging/tools/custom/rectangleRoiOverlayTool.d.ts +45 -0
- package/dist/imaging/tools/custom/seedTool.d.ts +0 -0
- package/dist/imaging/tools/custom/setLabelMap3D.d.ts +39 -0
- package/dist/imaging/tools/custom/thresholdsBrushTool.d.ts +19 -0
- package/dist/imaging/tools/default.d.ts +53 -0
- package/dist/imaging/tools/interaction.d.ts +30 -0
- package/dist/imaging/tools/io.d.ts +38 -0
- package/dist/imaging/tools/main.d.ts +81 -0
- package/dist/imaging/tools/segmentation.d.ts +125 -0
- package/dist/imaging/tools/state.d.ts +17 -0
- package/dist/imaging/tools/strategies/eraseFreehand.d.ts +16 -0
- package/dist/imaging/tools/strategies/fillFreehand.d.ts +16 -0
- package/dist/imaging/tools/strategies/index.d.ts +2 -0
- package/dist/index.d.ts +34 -0
- package/dist/larvitar.js +89801 -0
- package/dist/larvitar.js.map +1 -0
- package/imaging/MetaDataReadable.ts +40 -0
- package/imaging/MetaDataTypes.ts +3490 -0
- package/imaging/dataDictionary.json +5328 -5328
- package/imaging/{imageAnonymization.js → imageAnonymization.ts} +41 -13
- package/imaging/{imageColormaps.js → imageColormaps.ts} +48 -30
- package/imaging/{imageContours.js → imageContours.ts} +24 -22
- package/imaging/{imageIo.js → imageIo.ts} +89 -52
- package/imaging/{imageLayers.js → imageLayers.ts} +31 -14
- package/imaging/{imageLoading.js → imageLoading.ts} +108 -45
- package/imaging/{imageParsing.js → imageParsing.ts} +158 -80
- package/imaging/{imagePresets.js → imagePresets.ts} +44 -11
- package/imaging/imageRendering.ts +1091 -0
- package/imaging/{imageReslice.js → imageReslice.ts} +18 -9
- package/imaging/imageStore.ts +487 -0
- package/imaging/imageTags.ts +609 -0
- package/imaging/imageTools.js +2 -1
- package/imaging/{imageUtils.js → imageUtils.ts} +211 -701
- package/imaging/loaders/{commonLoader.js → commonLoader.ts} +73 -24
- package/imaging/loaders/{dicomLoader.js → dicomLoader.ts} +25 -5
- package/imaging/loaders/{fileLoader.js → fileLoader.ts} +5 -5
- package/imaging/loaders/{multiframeLoader.js → multiframeLoader.ts} +145 -90
- package/imaging/loaders/{nrrdLoader.js → nrrdLoader.ts} +230 -64
- package/imaging/loaders/{resliceLoader.js → resliceLoader.ts} +51 -20
- package/imaging/monitors/{memory.js → memory.ts} +54 -8
- package/imaging/monitors/performance.ts +34 -0
- package/imaging/parsers/ecg.ts +51 -0
- package/imaging/tools/README.md +27 -0
- package/imaging/tools/custom/4dSliceScrollTool.js +47 -46
- package/imaging/tools/custom/ellipticalRoiOverlayTool.js +534 -0
- package/imaging/tools/custom/polylineScissorsTool.js +1 -1
- package/imaging/tools/custom/rectangleRoiOverlayTool.js +564 -0
- package/imaging/tools/{setLabelMap3D.js → custom/setLabelMap3D.ts} +19 -25
- package/imaging/tools/{default.js → default.ts} +114 -30
- package/imaging/tools/{interaction.js → interaction.ts} +42 -23
- package/imaging/tools/{io.js → io.ts} +47 -31
- package/imaging/tools/{main.js → main.ts} +105 -40
- package/imaging/tools/{segmentation.js → segmentation.ts} +95 -68
- package/imaging/tools/{state.js → state.ts} +7 -12
- package/imaging/tools/types.d.ts +243 -0
- package/imaging/types.d.ts +197 -0
- package/{index.js → index.ts} +43 -14
- package/jsdoc.json +1 -1
- package/package.json +32 -14
- package/tsconfig.json +102 -0
- package/imaging/imageRendering.js +0 -860
- package/imaging/imageStore.js +0 -322
- package/modules/vuex/larvitar.js +0 -187
- /package/imaging/tools/{polygonSegmentationMixin.js → custom/polygonSegmentationMixin.js} +0 -0
package/imaging/imageStore.js
DELETED
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
/** @module imaging/imageStore
|
|
2
|
-
* @desc This file provides functionalities
|
|
3
|
-
* for data config store.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { defineVue } from "../modules/vuex/larvitar";
|
|
7
|
-
import larvitar from "../modules/vuex/larvitar";
|
|
8
|
-
|
|
9
|
-
// external libraries
|
|
10
|
-
import { get as _get } from "lodash";
|
|
11
|
-
|
|
12
|
-
// default viewport store object
|
|
13
|
-
const DEFAULT_VIEWPORT = {
|
|
14
|
-
loading: 0, // from 0 to 100 (%)
|
|
15
|
-
ready: false, // true when currentImageId is rendered
|
|
16
|
-
minSliceId: 0,
|
|
17
|
-
maxSliceId: 0,
|
|
18
|
-
sliceId: 0,
|
|
19
|
-
minTimeId: 0,
|
|
20
|
-
maxTimeId: 0,
|
|
21
|
-
timeId: 0,
|
|
22
|
-
timestamp: 0,
|
|
23
|
-
timestamps: [],
|
|
24
|
-
timeIds: [],
|
|
25
|
-
rows: 0,
|
|
26
|
-
cols: 0,
|
|
27
|
-
spacing_x: 0.0,
|
|
28
|
-
spacing_y: 0.0,
|
|
29
|
-
thickness: 0.0,
|
|
30
|
-
minPixelValue: 0,
|
|
31
|
-
maxPixelValue: 0,
|
|
32
|
-
isColor: false,
|
|
33
|
-
isMultiframe: false,
|
|
34
|
-
isTimeserie: false,
|
|
35
|
-
isPDF: false,
|
|
36
|
-
viewport: {
|
|
37
|
-
scale: 0.0,
|
|
38
|
-
rotation: 0.0,
|
|
39
|
-
translation: {
|
|
40
|
-
x: 0.0,
|
|
41
|
-
y: 0.0
|
|
42
|
-
},
|
|
43
|
-
voi: {
|
|
44
|
-
windowCenter: 0.0,
|
|
45
|
-
windowWidth: 0.0
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
default: {
|
|
49
|
-
scale: 0.0,
|
|
50
|
-
rotation: 0.0,
|
|
51
|
-
translation: {
|
|
52
|
-
x: 0.0,
|
|
53
|
-
y: 0.0
|
|
54
|
-
},
|
|
55
|
-
rotation: 0.0,
|
|
56
|
-
voi: {
|
|
57
|
-
windowCenter: 0.0,
|
|
58
|
-
windowWidth: 0.0
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* The Larvitar Internal Store
|
|
65
|
-
*/
|
|
66
|
-
export let larvitar_store = null;
|
|
67
|
-
|
|
68
|
-
/** Class representing the Larvitar Store. */
|
|
69
|
-
class Larvitar_Store {
|
|
70
|
-
/**
|
|
71
|
-
* Create the Larvitar Store
|
|
72
|
-
* @param {Obj} vuex_store - The Vuex store
|
|
73
|
-
* @param {String} vuex_module - The name of the vuex store module, can be null
|
|
74
|
-
*/
|
|
75
|
-
constructor(vuex_store, vuex_module) {
|
|
76
|
-
this.VUEX_STORE = vuex_store ? true : false;
|
|
77
|
-
this.vuex_store = vuex_store;
|
|
78
|
-
this.vuex_module = vuex_module;
|
|
79
|
-
this.state = {
|
|
80
|
-
series: {}, // seriesUID: {imageIds:[], progress:value}
|
|
81
|
-
leftActiveTool: "Wwwc",
|
|
82
|
-
rightActiveTool: "Zoom",
|
|
83
|
-
colormapId: "gray",
|
|
84
|
-
viewports: {},
|
|
85
|
-
errorLog: null,
|
|
86
|
-
temp: {}
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Enable the VUEX storage method
|
|
92
|
-
* @function enableVuex
|
|
93
|
-
* @param {String} vuex_module - The name of the vuex store module, can be null
|
|
94
|
-
*/
|
|
95
|
-
enableVuex(vuex_module) {
|
|
96
|
-
// VUEX IS ENABLED BY DEFAULT
|
|
97
|
-
this.VUEX_STORE = true;
|
|
98
|
-
this.vuex_module = vuex_module;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Disable the VUEX storage method
|
|
103
|
-
* @function disableVuex
|
|
104
|
-
*/
|
|
105
|
-
disableVuex() {
|
|
106
|
-
// VUEX IS ENABLED BY DEFAULT
|
|
107
|
-
this.VUEX_STORE = false;
|
|
108
|
-
this.vuex_module = null;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Add a viewport into the store
|
|
113
|
-
* @function addViewport
|
|
114
|
-
* @param {String} viewportId - The viewport id
|
|
115
|
-
*/
|
|
116
|
-
addViewport(viewportId) {
|
|
117
|
-
if (this.VUEX_STORE) {
|
|
118
|
-
let dispatch = "addViewport";
|
|
119
|
-
let route = this.vuex_module
|
|
120
|
-
? this.vuex_module + "/" + dispatch
|
|
121
|
-
: dispatch;
|
|
122
|
-
this.vuex_store.dispatch(route, viewportId);
|
|
123
|
-
} else {
|
|
124
|
-
this.state.viewports[viewportId] = {};
|
|
125
|
-
this.state.viewports[viewportId] = DEFAULT_VIEWPORT;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Delete a viewport from the store
|
|
131
|
-
* @function deleteViewport
|
|
132
|
-
* @param {String} viewportId - The viewport id
|
|
133
|
-
*/
|
|
134
|
-
deleteViewport(viewportId) {
|
|
135
|
-
if (this.VUEX_STORE) {
|
|
136
|
-
let dispatch = "deleteViewport";
|
|
137
|
-
let route = this.vuex_module
|
|
138
|
-
? this.vuex_module + "/" + dispatch
|
|
139
|
-
: dispatch;
|
|
140
|
-
this.vuex_store.dispatch(route, viewportId);
|
|
141
|
-
} else {
|
|
142
|
-
delete this.state.viewports[viewportId];
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Add a serie into the store
|
|
148
|
-
* @function addSeriesIds
|
|
149
|
-
* @param {String} seriesId - The serie's id
|
|
150
|
-
* @param {Array} imageIds - The array of image ids
|
|
151
|
-
*/
|
|
152
|
-
addSeriesIds(seriesId, imageIds) {
|
|
153
|
-
if (this.VUEX_STORE) {
|
|
154
|
-
let dispatch = "addSeriesIds";
|
|
155
|
-
let route = this.vuex_module
|
|
156
|
-
? this.vuex_module + "/" + dispatch
|
|
157
|
-
: dispatch;
|
|
158
|
-
this.vuex_store.dispatch(route, [seriesId, imageIds]);
|
|
159
|
-
} else {
|
|
160
|
-
if (this.state.series[seriesId] == null) {
|
|
161
|
-
this.state.series[seriesId] = {};
|
|
162
|
-
}
|
|
163
|
-
this.state.series[seriesId]["imageIds"] = imageIds;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Remove a serie from the store
|
|
169
|
-
* @function removeSeriesIds
|
|
170
|
-
* @param {String} seriesId - The serie's id
|
|
171
|
-
*/
|
|
172
|
-
removeSeriesIds(seriesId) {
|
|
173
|
-
if (this.VUEX_STORE) {
|
|
174
|
-
let dispatch = "removeSeriesIds";
|
|
175
|
-
let route = this.vuex_module
|
|
176
|
-
? this.vuex_module + "/" + dispatch
|
|
177
|
-
: dispatch;
|
|
178
|
-
this.vuex_store.dispatch(route, seriesId);
|
|
179
|
-
} else {
|
|
180
|
-
delete this.state.series[seriesId];
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Removes all the series from the store
|
|
186
|
-
* @function resetSeriesIds
|
|
187
|
-
*/
|
|
188
|
-
resetSeriesIds(seriesId) {
|
|
189
|
-
if (this.VUEX_STORE) {
|
|
190
|
-
let dispatch = "resetSeriesIds";
|
|
191
|
-
let route = this.vuex_module
|
|
192
|
-
? this.vuex_module + "/" + dispatch
|
|
193
|
-
: dispatch;
|
|
194
|
-
this.vuex_store.dispatch(route, seriesId);
|
|
195
|
-
} else {
|
|
196
|
-
delete this.state.series[seriesId];
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Set a value into store
|
|
202
|
-
* @function set
|
|
203
|
-
* @param {field} field - The name of the field to be updated
|
|
204
|
-
* @param {Object} data - The data object
|
|
205
|
-
*/
|
|
206
|
-
set(field, data) {
|
|
207
|
-
if (this.VUEX_STORE) {
|
|
208
|
-
let dispatch = "set" + field[0].toUpperCase() + field.slice(1);
|
|
209
|
-
let route = this.vuex_module
|
|
210
|
-
? this.vuex_module + "/" + dispatch
|
|
211
|
-
: dispatch;
|
|
212
|
-
this.vuex_store.dispatch(route, data);
|
|
213
|
-
} else {
|
|
214
|
-
if (field == "scale" || field == "rotation" || field == "translation") {
|
|
215
|
-
this.state["viewports"][data[0]]["viewport"][field] = data[1];
|
|
216
|
-
} else if (field == "contrast") {
|
|
217
|
-
this.state["viewports"][data[0]]["viewport"]["voi"]["windowWidth"] =
|
|
218
|
-
data[1];
|
|
219
|
-
this.state["viewports"][data[0]]["viewport"]["voi"]["windowCenter"] =
|
|
220
|
-
data[2];
|
|
221
|
-
} else if (field == "dimensions") {
|
|
222
|
-
this.state["viewports"][data[0]]["rows"] = data[1];
|
|
223
|
-
this.state["viewports"][data[0]]["cols"] = data[2];
|
|
224
|
-
} else if (field == "spacing") {
|
|
225
|
-
this.state["viewports"][data[0]]["spacing_x"] = data[1];
|
|
226
|
-
this.state["viewports"][data[0]]["spacing_y"] = data[2];
|
|
227
|
-
} else if (field == "thickness") {
|
|
228
|
-
this.state["viewports"][data[0]]["thickness"] = data[1];
|
|
229
|
-
} else if (field == "minPixelValue") {
|
|
230
|
-
this.state["viewports"][data[0]]["minPixelValue"] = data[1];
|
|
231
|
-
} else if (field == "maxPixelValue") {
|
|
232
|
-
this.state["viewports"][data[0]]["maxPixelValue"] = data[1];
|
|
233
|
-
} else if (field == "renderingStatus") {
|
|
234
|
-
this.state["viewports"][data[0]]["ready"] = data[1];
|
|
235
|
-
} else if (field == "loadingProgress") {
|
|
236
|
-
this.state["viewports"][data[0]]["loading"] = data[1];
|
|
237
|
-
} else if (field == "minSliceId") {
|
|
238
|
-
this.state["viewports"][data[0]]["minSliceId"] = data[1];
|
|
239
|
-
} else if (field == "maxSliceId") {
|
|
240
|
-
this.state["viewports"][data[0]]["maxSliceId"] = data[1];
|
|
241
|
-
} else if (field == "sliceId") {
|
|
242
|
-
this.state["viewports"][data[0]]["sliceId"] = data[1];
|
|
243
|
-
} else if (field == "minTimeId") {
|
|
244
|
-
this.state["viewports"][data[0]]["minTimeId"] = data[1];
|
|
245
|
-
} else if (field == "maxTimeId") {
|
|
246
|
-
this.state["viewports"][data[0]]["maxTimeId"] = data[1];
|
|
247
|
-
} else if (field == "timeId") {
|
|
248
|
-
this.state["viewports"][data[0]]["timeId"] = data[1];
|
|
249
|
-
} else if (field == "timestamp") {
|
|
250
|
-
this.state["viewports"][data[0]]["timestamp"] = data[1];
|
|
251
|
-
} else if (field == "timestamps") {
|
|
252
|
-
this.state["viewports"][data[0]]["timestamps"] = data[1];
|
|
253
|
-
} else if (field == "timeIds") {
|
|
254
|
-
this.state["viewports"][data[0]]["timeIds"] = data[1];
|
|
255
|
-
} else if (field == "isColor") {
|
|
256
|
-
this.state["viewports"][data[0]]["isColor"] = data[1];
|
|
257
|
-
} else if (field == "isMultiframe") {
|
|
258
|
-
this.state["viewports"][data[0]]["isMultiframe"] = data[1];
|
|
259
|
-
} else if (field == "isPDF") {
|
|
260
|
-
this.state["viewports"][data[0]]["isPDF"] = data[1];
|
|
261
|
-
} else if (field == "isTimeserie") {
|
|
262
|
-
this.state["viewports"][data[0]]["isTimeserie"] = data[1];
|
|
263
|
-
} else if (field == "defaultViewport") {
|
|
264
|
-
this.state["viewports"][data[0]]["default"]["scale"] = data[1];
|
|
265
|
-
this.state["viewports"][data[0]]["default"]["rotation"] = data[2];
|
|
266
|
-
this.state["viewports"][data[0]]["default"]["translation"]["x"] =
|
|
267
|
-
data[3];
|
|
268
|
-
this.state["viewports"][data[0]]["default"]["translation"]["y"] =
|
|
269
|
-
data[4];
|
|
270
|
-
this.state["viewports"][data[0]]["default"]["voi"]["windowWidth"] =
|
|
271
|
-
data[5];
|
|
272
|
-
this.state["viewports"][data[0]]["default"]["voi"]["windowCenter"] =
|
|
273
|
-
data[6];
|
|
274
|
-
} else if (field == "progress") {
|
|
275
|
-
this.state.series[data[0]]["progress"] = data[1];
|
|
276
|
-
} else {
|
|
277
|
-
if (Array.isArray(data)) {
|
|
278
|
-
this.state[field][data[0]] = data[1];
|
|
279
|
-
} else {
|
|
280
|
-
this.state[field] = data;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Get a value from the store
|
|
288
|
-
* @function get
|
|
289
|
-
* @param {Array} args - The array of arguments
|
|
290
|
-
* @return {Object} - The stored value
|
|
291
|
-
*/
|
|
292
|
-
get(...args) {
|
|
293
|
-
if (this.VUEX_STORE) {
|
|
294
|
-
if (this.vuex_module) {
|
|
295
|
-
args.unshift(this.vuex_module);
|
|
296
|
-
}
|
|
297
|
-
return _get(this.vuex_store.state, args, "error");
|
|
298
|
-
} else {
|
|
299
|
-
return _get(this.state, args, "error");
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Instancing the store
|
|
306
|
-
* @param {Object} vuexStore - The app vuex store [optional]
|
|
307
|
-
* @param {String} vuexModule - The name of the vuex store module, can be null
|
|
308
|
-
* @param {Boolean} registerModule - If true, the module is registered under Vuex global store
|
|
309
|
-
* @param {Object} _Vue - The Vue instance
|
|
310
|
-
*/
|
|
311
|
-
|
|
312
|
-
export function initLarvitarStore(vuexStore, vuexModule, registerModule, _Vue) {
|
|
313
|
-
if (vuexStore) {
|
|
314
|
-
larvitar_store = new Larvitar_Store(vuexStore, vuexModule);
|
|
315
|
-
if (registerModule) {
|
|
316
|
-
defineVue(_Vue);
|
|
317
|
-
vuexStore.registerModule(vuexModule, larvitar);
|
|
318
|
-
}
|
|
319
|
-
} else {
|
|
320
|
-
larvitar_store = new Larvitar_Store();
|
|
321
|
-
}
|
|
322
|
-
}
|
package/modules/vuex/larvitar.js
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
// Larvitar Vuex instance
|
|
2
|
-
var Vue = null;
|
|
3
|
-
|
|
4
|
-
// default viewport store object
|
|
5
|
-
const DEFAULT_VIEWPORT = {
|
|
6
|
-
ready: false, // true when currentImageId is rendered
|
|
7
|
-
minSliceId: 0,
|
|
8
|
-
maxSliceId: 0,
|
|
9
|
-
sliceId: 0,
|
|
10
|
-
minTimeId: 0,
|
|
11
|
-
maxTimeId: 0,
|
|
12
|
-
timeId: 0,
|
|
13
|
-
timestamp: 0,
|
|
14
|
-
timestamps: [],
|
|
15
|
-
timeIds: [],
|
|
16
|
-
rows: 0,
|
|
17
|
-
cols: 0,
|
|
18
|
-
spacing_x: 0.0,
|
|
19
|
-
spacing_y: 0.0,
|
|
20
|
-
thickness: 0.0,
|
|
21
|
-
minPixelValue: 0,
|
|
22
|
-
maxPixelValue: 0,
|
|
23
|
-
isColor: false,
|
|
24
|
-
isMultiframe: false,
|
|
25
|
-
isPDF: false,
|
|
26
|
-
isTimeserie: false,
|
|
27
|
-
viewport: {
|
|
28
|
-
scale: 0.0,
|
|
29
|
-
rotation: 0.0,
|
|
30
|
-
translation: {
|
|
31
|
-
x: 0.0,
|
|
32
|
-
y: 0.0
|
|
33
|
-
},
|
|
34
|
-
voi: {
|
|
35
|
-
windowCenter: 0.0,
|
|
36
|
-
windowWidth: 0.0
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
default: {
|
|
40
|
-
scale: 0.0,
|
|
41
|
-
translation: {
|
|
42
|
-
x: 0.0,
|
|
43
|
-
y: 0.0
|
|
44
|
-
},
|
|
45
|
-
voi: {
|
|
46
|
-
windowCenter: 0.0,
|
|
47
|
-
windowWidth: 0.0
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export default {
|
|
53
|
-
namespaced: true,
|
|
54
|
-
state: {
|
|
55
|
-
colormapId: "gray",
|
|
56
|
-
leftActiveTool: "Wwwc",
|
|
57
|
-
rightActiveTool: "Wwwc",
|
|
58
|
-
series: {}, // seriesUID: {imageIds:[], progress:value}
|
|
59
|
-
viewports: {}
|
|
60
|
-
},
|
|
61
|
-
getters: {
|
|
62
|
-
viewport: state => id => state.viewports[id]
|
|
63
|
-
},
|
|
64
|
-
mutations: {
|
|
65
|
-
canvas: (state, { id, d }) => {
|
|
66
|
-
if (!state.viewports[id]) {
|
|
67
|
-
console.warn(`Can not update viewport ${id}: viewport not found.`);
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
Vue.set(state.viewports[id], "viewport", {
|
|
72
|
-
...state.viewports[id].viewport,
|
|
73
|
-
...d
|
|
74
|
-
});
|
|
75
|
-
},
|
|
76
|
-
series: (state, { id, d }) =>
|
|
77
|
-
Vue.set(state.series, id, { ...state.series[id], ...d }),
|
|
78
|
-
viewport: (state, { id, d }) => {
|
|
79
|
-
if (!state.viewports[id]) {
|
|
80
|
-
console.warn(`Can not update viewport ${id}: viewport not found.`);
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
Vue.set(state.viewports, id, { ...state.viewports[id], ...d });
|
|
85
|
-
},
|
|
86
|
-
leftActiveTool: (state, { d }) => {
|
|
87
|
-
state.leftActiveTool = d.value;
|
|
88
|
-
},
|
|
89
|
-
rightActiveTool: (state, { d }) => {
|
|
90
|
-
state.rightActiveTool = d.value;
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
actions: {
|
|
94
|
-
addViewport: ({ state }, viewportId) => {
|
|
95
|
-
if (!state.viewports[viewportId])
|
|
96
|
-
Vue.set(state.viewports, viewportId, DEFAULT_VIEWPORT);
|
|
97
|
-
// else preserve already stored viewport (remove it manually if you want to reset it)
|
|
98
|
-
},
|
|
99
|
-
deleteViewport: ({ state }, viewportId) =>
|
|
100
|
-
Vue.delete(state.viewports, viewportId),
|
|
101
|
-
setLeftActiveTool: ({ commit }, value) => {
|
|
102
|
-
commit("leftActiveTool", { d: { value } });
|
|
103
|
-
},
|
|
104
|
-
setRightActiveTool: ({ commit }, value) => {
|
|
105
|
-
commit("rightActiveTool", { d: { value } });
|
|
106
|
-
},
|
|
107
|
-
removeSeriesIds: ({ state }, seriesId) =>
|
|
108
|
-
Vue.delete(state.series, seriesId),
|
|
109
|
-
resetSeriesIds: ({ state }) => Vue.set(state.series, {}),
|
|
110
|
-
setErrorLog: () => {}, // TODO LT pass elementId
|
|
111
|
-
|
|
112
|
-
// Series fields setters
|
|
113
|
-
addSeriesIds: ({ commit }, [id, imageIds]) =>
|
|
114
|
-
commit("series", { id, d: { imageIds } }),
|
|
115
|
-
// !!! this is CACHE progress
|
|
116
|
-
setProgress: ({ commit }, [id, progress]) =>
|
|
117
|
-
commit("series", { id, d: { progress } }),
|
|
118
|
-
// Viewport fields setters
|
|
119
|
-
setDimensions: ({ commit }, [id, rows, cols]) =>
|
|
120
|
-
commit("viewport", { id, d: { rows, cols } }),
|
|
121
|
-
setRenderingStatus: ({ commit }, [id, ready]) =>
|
|
122
|
-
commit("viewport", { id, d: { ready } }),
|
|
123
|
-
setSpacing: ({ commit }, [id, spacing_x, spacing_y]) =>
|
|
124
|
-
commit("viewport", { id, d: { spacing_x, spacing_y } }),
|
|
125
|
-
setThickness: ({ commit }, [id, thickness]) =>
|
|
126
|
-
commit("viewport", { id, d: { thickness } }),
|
|
127
|
-
setMinPixelValue: ({ commit }, [id, minPixelValue]) =>
|
|
128
|
-
commit("viewport", { id, d: { minPixelValue } }),
|
|
129
|
-
setMaxPixelValue: ({ commit }, [id, maxPixelValue]) =>
|
|
130
|
-
commit("viewport", { id, d: { maxPixelValue } }),
|
|
131
|
-
setMinSliceId: ({ commit }, [id, minSliceId]) =>
|
|
132
|
-
commit("viewport", { id, d: { minSliceId } }),
|
|
133
|
-
setMaxSliceId: ({ commit }, [id, maxSliceId]) =>
|
|
134
|
-
commit("viewport", { id, d: { maxSliceId } }),
|
|
135
|
-
setSliceId: ({ commit }, [id, sliceId]) =>
|
|
136
|
-
commit("viewport", { id, d: { sliceId } }),
|
|
137
|
-
setMinTimeId: ({ commit }, [id, minTimeId]) =>
|
|
138
|
-
commit("viewport", { id, d: { minTimeId } }),
|
|
139
|
-
setMaxTimeId: ({ commit }, [id, maxTimeId]) =>
|
|
140
|
-
commit("viewport", { id, d: { maxTimeId } }),
|
|
141
|
-
setTimeId: ({ commit }, [id, timeId]) =>
|
|
142
|
-
commit("viewport", { id, d: { timeId } }),
|
|
143
|
-
setTimestamp: ({ commit }, [id, timestamp]) =>
|
|
144
|
-
commit("viewport", { id, d: { timestamp } }),
|
|
145
|
-
setTimestamps: ({ commit }, [id, timestamps]) =>
|
|
146
|
-
commit("viewport", { id, d: { timestamps } }),
|
|
147
|
-
setTimeIds: ({ commit }, [id, timeIds]) =>
|
|
148
|
-
commit("viewport", { id, d: { timeIds } }),
|
|
149
|
-
setIsColor: ({ commit }, [id, isColor]) =>
|
|
150
|
-
commit("viewport", { id, d: { isColor } }),
|
|
151
|
-
setIsMultiframe: ({ commit }, [id, isMultiframe]) =>
|
|
152
|
-
commit("viewport", { id, d: { isMultiframe } }),
|
|
153
|
-
setIsPDF: ({ commit }, [id, isPDF]) =>
|
|
154
|
-
commit("viewport", { id, d: { isPDF } }),
|
|
155
|
-
setIsTimeserie: ({ commit }, [id, isTimeserie]) =>
|
|
156
|
-
commit("viewport", { id, d: { isTimeserie } }),
|
|
157
|
-
setDefaultViewport: (
|
|
158
|
-
{ commit },
|
|
159
|
-
[id, scale, rotation, x, y, windowWidth, windowCenter]
|
|
160
|
-
) =>
|
|
161
|
-
commit("viewport", {
|
|
162
|
-
id,
|
|
163
|
-
d: {
|
|
164
|
-
default: {
|
|
165
|
-
scale,
|
|
166
|
-
rotation,
|
|
167
|
-
translation: { x, y },
|
|
168
|
-
voi: { windowWidth, windowCenter }
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}),
|
|
172
|
-
// viewports[id].viewport properties
|
|
173
|
-
setScale: ({ commit }, [id, scale]) =>
|
|
174
|
-
commit("canvas", { id, d: { scale } }),
|
|
175
|
-
setRotation: ({ commit }, [id, rotation]) =>
|
|
176
|
-
commit("canvas", { id, d: { rotation } }),
|
|
177
|
-
setTranslation: ({ commit }, [id, translation]) =>
|
|
178
|
-
commit("canvas", { id, d: { translation } }),
|
|
179
|
-
setContrast: ({ commit }, [id, windowWidth, windowCenter]) =>
|
|
180
|
-
commit("canvas", { id, d: { voi: { windowWidth, windowCenter } } })
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
// define Vue instance from outside dependency
|
|
185
|
-
export const defineVue = _Vue => {
|
|
186
|
-
Vue = _Vue;
|
|
187
|
-
};
|
|
File without changes
|