larvitar 1.2.0 → 1.2.1
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/.github/workflows/build-docs.yml +1 -1
- package/.github/workflows/deploy.yml +4 -4
- package/README.md +3 -3
- package/modules/vuex/larvitar.js +1 -0
- package/package.json +1 -1
- package/docs/documentation/Mixins.polygonSegmentationMixin%20-%20segmentation%20operations%20for%20polyline.html +0 -171
- package/docs/documentation/Tools.Annotation.ContoursTool.html +0 -218
- package/docs/documentation/Tools.Annotation.DiameterTool.html +0 -219
- package/docs/documentation/Tools.Annotation.SeedsTool.html +0 -214
- package/docs/documentation/Tools.Brush.BrushTool.html +0 -218
- package/docs/documentation/Tools.Brush.ThresholdsBrushTool.html +0 -218
- package/docs/documentation/Tools.PolylineScissorsTool.html +0 -218
- package/docs/documentation/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/documentation/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/documentation/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/documentation/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/documentation/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/documentation/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/documentation/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/documentation/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -978
- package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -1049
- package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/documentation/global.html +0 -1303
- package/docs/documentation/imageAnonymization.js.html +0 -245
- package/docs/documentation/imageColormaps.js.html +0 -283
- package/docs/documentation/imageContours.js.html +0 -278
- package/docs/documentation/imageIo.js.html +0 -291
- package/docs/documentation/imageLayers.js.html +0 -188
- package/docs/documentation/imageLoading.js.html +0 -297
- package/docs/documentation/imageParsing.js.html +0 -385
- package/docs/documentation/imagePresets.js.html +0 -207
- package/docs/documentation/imageRendering.js.html +0 -849
- package/docs/documentation/imageReslice.js.html +0 -162
- package/docs/documentation/imageStore.js.html +0 -360
- package/docs/documentation/imageTools.js.html +0 -784
- package/docs/documentation/imageUtils.js.html +0 -1609
- package/docs/documentation/image_colormaps.js.html +0 -283
- package/docs/documentation/image_contours.js.html +0 -279
- package/docs/documentation/image_io.js.html +0 -288
- package/docs/documentation/image_layers.js.html +0 -188
- package/docs/documentation/image_loading.js.html +0 -294
- package/docs/documentation/image_parsing.js.html +0 -391
- package/docs/documentation/image_presets.js.html +0 -207
- package/docs/documentation/image_rendering.js.html +0 -845
- package/docs/documentation/image_reslice.js.html +0 -164
- package/docs/documentation/image_store.js.html +0 -359
- package/docs/documentation/image_tools.js.html +0 -792
- package/docs/documentation/image_utils.js.html +0 -1609
- package/docs/documentation/index.html +0 -175
- package/docs/documentation/loaders_commonLoader.js.html +0 -306
- package/docs/documentation/loaders_dicomLoader.js.html +0 -130
- package/docs/documentation/loaders_fileLoader.js.html +0 -155
- package/docs/documentation/loaders_multiframeLoader.js.html +0 -443
- package/docs/documentation/loaders_niftiLoader.js.html +0 -150
- package/docs/documentation/loaders_nrrdLoader.js.html +0 -545
- package/docs/documentation/loaders_resliceLoader.js.html +0 -258
- package/docs/documentation/module-imaging_contours.html +0 -954
- package/docs/documentation/module-imaging_imageAnonymization.html +0 -544
- package/docs/documentation/module-imaging_imageColormaps.html +0 -1012
- package/docs/documentation/module-imaging_imageContours.html +0 -954
- package/docs/documentation/module-imaging_imageIo.html +0 -1057
- package/docs/documentation/module-imaging_imageLayers.html +0 -904
- package/docs/documentation/module-imaging_imageLoading.html +0 -1301
- package/docs/documentation/module-imaging_imageParsing.html +0 -1356
- package/docs/documentation/module-imaging_imagePresets.html +0 -679
- package/docs/documentation/module-imaging_imageRendering.html +0 -3223
- package/docs/documentation/module-imaging_imageReslice.html +0 -413
- package/docs/documentation/module-imaging_imageStore-Larvitar_Store.html +0 -284
- package/docs/documentation/module-imaging_imageStore.html +0 -1560
- package/docs/documentation/module-imaging_imageTools.html +0 -3617
- package/docs/documentation/module-imaging_imageUtils.html +0 -7253
- package/docs/documentation/module-imaging_io.html +0 -1057
- package/docs/documentation/module-imaging_layers.html +0 -904
- package/docs/documentation/module-imaging_loading.html +0 -1301
- package/docs/documentation/module-imaging_parsing.html +0 -1375
- package/docs/documentation/module-imaging_presets.html +0 -679
- package/docs/documentation/module-imaging_rendering.html +0 -8094
- package/docs/documentation/module-imaging_reslice.html +0 -411
- package/docs/documentation/module-imaging_store-Larvitar_Store.html +0 -284
- package/docs/documentation/module-imaging_store.html +0 -1537
- package/docs/documentation/module-imaging_strategies_eraseFreehand.html +0 -708
- package/docs/documentation/module-imaging_strategies_fillFreehand.html +0 -708
- package/docs/documentation/module-imaging_tools.html +0 -3617
- package/docs/documentation/module-imaging_tools_custom_contourTool.html +0 -207
- package/docs/documentation/module-imaging_tools_custom_diameterTool.html +0 -205
- package/docs/documentation/module-imaging_tools_custom_editMaskTool.html +0 -205
- package/docs/documentation/module-imaging_tools_custom_polygonScissorsTool.html +0 -203
- package/docs/documentation/module-imaging_tools_custom_thresholdBrushTool.html +0 -684
- package/docs/documentation/module-imaging_tools_default.html +0 -205
- package/docs/documentation/module-imaging_tools_interaction.html +0 -530
- package/docs/documentation/module-imaging_tools_io.html +0 -832
- package/docs/documentation/module-imaging_tools_main.html +0 -2028
- package/docs/documentation/module-imaging_tools_polygonSegmentationMixin.html +0 -567
- package/docs/documentation/module-imaging_tools_segmentation.html +0 -3586
- package/docs/documentation/module-imaging_tools_state.html +0 -494
- package/docs/documentation/module-imaging_utils.html +0 -7253
- package/docs/documentation/module-loaders_commonLoader.html +0 -1313
- package/docs/documentation/module-loaders_dicomLoader.html +0 -522
- package/docs/documentation/module-loaders_fileLoader.html +0 -593
- package/docs/documentation/module-loaders_multiframeLoader.html +0 -1169
- package/docs/documentation/module-loaders_niftiLoader.html +0 -565
- package/docs/documentation/module-loaders_nrrdLoader.html +0 -1459
- package/docs/documentation/module-loaders_resliceLoader.html +0 -590
- package/docs/documentation/module-monitors_memory.html +0 -980
- package/docs/documentation/module-tools_default.html +0 -740
- package/docs/documentation/module.exports_module.exports.html +0 -203
- package/docs/documentation/monitors_memory.js.html +0 -189
- package/docs/documentation/parsers_nrrd.js.html +0 -569
- package/docs/documentation/scripts/collapse.js +0 -20
- package/docs/documentation/scripts/linenumber.js +0 -25
- package/docs/documentation/scripts/nav.js +0 -12
- package/docs/documentation/scripts/polyfill.js +0 -4
- package/docs/documentation/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/docs/documentation/scripts/prettify/lang-css.js +0 -2
- package/docs/documentation/scripts/prettify/prettify.js +0 -28
- package/docs/documentation/scripts/search.js +0 -83
- package/docs/documentation/styles/jsdoc.css +0 -765
- package/docs/documentation/styles/prettify.css +0 -80
- package/docs/documentation/tools_contourTool.js.html +0 -1963
- package/docs/documentation/tools_custom_contourTool.js.html +0 -1968
- package/docs/documentation/tools_custom_diameterTool.js.html +0 -225
- package/docs/documentation/tools_custom_editMaskTool.js.html +0 -225
- package/docs/documentation/tools_custom_polylineScissorsTool.js.html +0 -143
- package/docs/documentation/tools_custom_thresholdsBrushTool.js.html +0 -245
- package/docs/documentation/tools_default.js.html +0 -576
- package/docs/documentation/tools_diameterTool.js.html +0 -219
- package/docs/documentation/tools_editMaskTool.js.html +0 -219
- package/docs/documentation/tools_interaction.js.html +0 -258
- package/docs/documentation/tools_io.js.html +0 -297
- package/docs/documentation/tools_main.js.html +0 -443
- package/docs/documentation/tools_polygonSegmentationMixin.js.html +0 -329
- package/docs/documentation/tools_polylineScissorsTool.js.html +0 -136
- package/docs/documentation/tools_seedTool.js.html +0 -423
- package/docs/documentation/tools_segmentation.js.html +0 -558
- package/docs/documentation/tools_state.js.html +0 -163
- package/docs/documentation/tools_strategies_eraseFreehand.js.html +0 -160
- package/docs/documentation/tools_strategies_fillFreehand.js.html +0 -163
- package/docs/documentation/tools_thresholdsBrushTool.js.html +0 -239
- package/docs/documentation/tools_tools.default.js.html +0 -569
- package/docs/documentation/tools_tools.interaction.js.html +0 -251
- package/docs/documentation/tools_tools.io.js.html +0 -288
- package/docs/documentation/tools_tools.main.js.html +0 -442
- package/docs/documentation/tools_tools.segmentation.js.html +0 -445
- package/docs/documentation/tools_tools.state.js.html +0 -157
- package/docs/examples/base.html +0 -170
- package/docs/examples/colorMaps.html +0 -181
- package/docs/examples/defaultTools.html +0 -246
- package/docs/examples/demo/anon1 +0 -0
- package/docs/examples/demo/anon10 +0 -0
- package/docs/examples/demo/anon11 +0 -0
- package/docs/examples/demo/anon12 +0 -0
- package/docs/examples/demo/anon13 +0 -0
- package/docs/examples/demo/anon14 +0 -0
- package/docs/examples/demo/anon15 +0 -0
- package/docs/examples/demo/anon16 +0 -0
- package/docs/examples/demo/anon17 +0 -0
- package/docs/examples/demo/anon18 +0 -0
- package/docs/examples/demo/anon19 +0 -0
- package/docs/examples/demo/anon2 +0 -0
- package/docs/examples/demo/anon20 +0 -0
- package/docs/examples/demo/anon21 +0 -0
- package/docs/examples/demo/anon22 +0 -0
- package/docs/examples/demo/anon23 +0 -0
- package/docs/examples/demo/anon24 +0 -0
- package/docs/examples/demo/anon3 +0 -0
- package/docs/examples/demo/anon4 +0 -0
- package/docs/examples/demo/anon5 +0 -0
- package/docs/examples/demo/anon6 +0 -0
- package/docs/examples/demo/anon7 +0 -0
- package/docs/examples/demo/anon8 +0 -0
- package/docs/examples/demo/anon9 +0 -0
- package/docs/examples/demo/example.nrrd +0 -0
- package/docs/examples/demo/segmentation.nrrd +0 -0
- package/docs/examples/demo/xa_integris.dcm +0 -0
- package/docs/examples/index.html +0 -129
- package/docs/examples/larvitar.js +0 -108623
- package/docs/examples/layers.html +0 -250
- package/docs/examples/masks.html +0 -273
- package/docs/examples/multiframe.html +0 -200
- package/docs/examples/nrrd.html +0 -96
- package/docs/examples/reslice.html +0 -174
- package/docs/index.html +0 -92
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html class="h-100 overflow-hidden">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<link
|
|
6
|
-
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css"
|
|
7
|
-
rel="stylesheet"
|
|
8
|
-
integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl"
|
|
9
|
-
crossorigin="anonymous"
|
|
10
|
-
/>
|
|
11
|
-
<link
|
|
12
|
-
rel="stylesheet"
|
|
13
|
-
href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.2/styles/vs2015.min.css"
|
|
14
|
-
/>
|
|
15
|
-
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.2/highlight.min.js"></script>
|
|
16
|
-
<script>
|
|
17
|
-
hljs.highlightAll();
|
|
18
|
-
</script>
|
|
19
|
-
<title>Larvitar - Layers rendering example</title>
|
|
20
|
-
</head>
|
|
21
|
-
|
|
22
|
-
<body class="h-100" style="background-color: #000000">
|
|
23
|
-
<div class="row h-100">
|
|
24
|
-
<div
|
|
25
|
-
id="viewer"
|
|
26
|
-
class="col-8 h-100"
|
|
27
|
-
style="background-color: black"
|
|
28
|
-
></div>
|
|
29
|
-
<p style="position: absolute; color: white">
|
|
30
|
-
Press "a" to change the active layer
|
|
31
|
-
</p>
|
|
32
|
-
<p style="position: absolute; top: 20px; color: white">
|
|
33
|
-
Press "o" to change the opacity of the active layer
|
|
34
|
-
</p>
|
|
35
|
-
<p
|
|
36
|
-
id="active-layer"
|
|
37
|
-
style="position: absolute; top: 40px; color: white"
|
|
38
|
-
></p>
|
|
39
|
-
<p id="opacity" style="position: absolute; top: 60px; color: white"></p>
|
|
40
|
-
|
|
41
|
-
<div class="col-4 h-100">
|
|
42
|
-
<pre class="h-100">
|
|
43
|
-
<code class="javascript" style="background-color: #000000">
|
|
44
|
-
<p style="font-size:0.6vw;">
|
|
45
|
-
let demoFiles = [];
|
|
46
|
-
let counter = 0;
|
|
47
|
-
|
|
48
|
-
const getDemoFileNames = function () {
|
|
49
|
-
let demoFileList = [];
|
|
50
|
-
for (let i = 1; i < 25; i++) {
|
|
51
|
-
let filename = "anon" + i;
|
|
52
|
-
demoFileList.push(filename);
|
|
53
|
-
}
|
|
54
|
-
return demoFileList;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
// init all
|
|
58
|
-
larvitar.initLarvitarStore();
|
|
59
|
-
larvitar.initializeImageLoader();
|
|
60
|
-
larvitar.initializeCSTools();
|
|
61
|
-
larvitar.larvitar_store.addViewport("viewer");
|
|
62
|
-
|
|
63
|
-
async function createFile(fileName, cb) {
|
|
64
|
-
let response = await fetch("./demo/" + fileName);
|
|
65
|
-
let data = await response.blob();
|
|
66
|
-
let file = new File([data], fileName);
|
|
67
|
-
demoFiles.push(file);
|
|
68
|
-
counter++;
|
|
69
|
-
if (counter == 24) {
|
|
70
|
-
cb();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
let layer_1, layer_2;
|
|
75
|
-
|
|
76
|
-
function renderSerie() {
|
|
77
|
-
larvitar
|
|
78
|
-
.readFiles(demoFiles)
|
|
79
|
-
.then(seriesStack => {
|
|
80
|
-
let seriesId = _.keys(seriesStack)[0];
|
|
81
|
-
|
|
82
|
-
let serie_1 = { ...seriesStack[seriesId] };
|
|
83
|
-
let serie_2 = { ...seriesStack[seriesId] };
|
|
84
|
-
|
|
85
|
-
layer_1 = larvitar.buildLayer(serie_1, "main");
|
|
86
|
-
layer_2 = larvitar.buildLayer(serie_2, "colored", {
|
|
87
|
-
opacity: 0.25,
|
|
88
|
-
colormap: "hotIron"
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
// define a layer into the series object to be rendered
|
|
92
|
-
serie_1.layer = layer_1;
|
|
93
|
-
serie_2.layer = layer_2;
|
|
94
|
-
|
|
95
|
-
larvitar.renderImage(serie_1, "viewer").then(() => {
|
|
96
|
-
console.log("Image 1 has been rendered");
|
|
97
|
-
});
|
|
98
|
-
larvitar.renderImage(serie_2, "viewer").then(() => {
|
|
99
|
-
console.log("Image 2 has been rendered");
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
$("#active-layer").html("Active Layer: main");
|
|
103
|
-
$("#opacity").html("Opacity: 1.0");
|
|
104
|
-
|
|
105
|
-
larvitar.addDefaultTools();
|
|
106
|
-
})
|
|
107
|
-
.catch(err => console.log(err));
|
|
108
|
-
}
|
|
109
|
-
let demoFileList = getDemoFileNames();
|
|
110
|
-
_.each(demoFileList, function (demoFile) {
|
|
111
|
-
createFile(demoFile, renderSerie);
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
document.onkeypress = function (e) {
|
|
115
|
-
e = e || window.event;
|
|
116
|
-
if (e.keyCode == 97) {
|
|
117
|
-
let activeLayer = larvitar.getActiveLayer("viewer");
|
|
118
|
-
let newActiveLayer =
|
|
119
|
-
activeLayer.layerId == layer_1.id ? layer_2 : layer_1;
|
|
120
|
-
|
|
121
|
-
larvitar.setActiveLayer("viewer", newActiveLayer.id);
|
|
122
|
-
$("#active-layer").html(
|
|
123
|
-
"Active Layer: " + newActiveLayer.options.name
|
|
124
|
-
);
|
|
125
|
-
$("#opacity").html("Opacity: " + newActiveLayer.options.opacity);
|
|
126
|
-
}
|
|
127
|
-
if (e.keyCode == 111) {
|
|
128
|
-
let activeLayer = larvitar.getActiveLayer("viewer");
|
|
129
|
-
let opacity =
|
|
130
|
-
activeLayer.options.opacity == 1.0
|
|
131
|
-
? 0.0
|
|
132
|
-
: activeLayer.options.opacity + 0.25;
|
|
133
|
-
larvitar.updateLayer("viewer", activeLayer.layerId, {
|
|
134
|
-
opacity: opacity
|
|
135
|
-
});
|
|
136
|
-
$("#opacity").html("Opacity: " + opacity);
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
</p>
|
|
140
|
-
</code>
|
|
141
|
-
</pre>
|
|
142
|
-
</div>
|
|
143
|
-
</div>
|
|
144
|
-
|
|
145
|
-
<script src="./larvitar.js"></script>
|
|
146
|
-
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js"></script>
|
|
147
|
-
<script
|
|
148
|
-
src="https://code.jquery.com/jquery-3.6.0.slim.min.js"
|
|
149
|
-
integrity="sha256-u7e5khyithlIdTpu22PHhENmPcRdFiHRjhAuHcs05RI="
|
|
150
|
-
crossorigin="anonymous"
|
|
151
|
-
></script>
|
|
152
|
-
|
|
153
|
-
<script>
|
|
154
|
-
let demoFiles = [];
|
|
155
|
-
let counter = 0;
|
|
156
|
-
|
|
157
|
-
const getDemoFileNames = function () {
|
|
158
|
-
let demoFileList = [];
|
|
159
|
-
for (let i = 1; i < 25; i++) {
|
|
160
|
-
let filename = "anon" + i;
|
|
161
|
-
demoFileList.push(filename);
|
|
162
|
-
}
|
|
163
|
-
return demoFileList;
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
// init all
|
|
167
|
-
larvitar.initLarvitarStore();
|
|
168
|
-
larvitar.initializeImageLoader();
|
|
169
|
-
larvitar.initializeCSTools();
|
|
170
|
-
larvitar.larvitar_store.addViewport("viewer");
|
|
171
|
-
|
|
172
|
-
async function createFile(fileName, cb) {
|
|
173
|
-
let response = await fetch("./demo/" + fileName);
|
|
174
|
-
let data = await response.blob();
|
|
175
|
-
let file = new File([data], fileName);
|
|
176
|
-
demoFiles.push(file);
|
|
177
|
-
counter++;
|
|
178
|
-
if (counter == 24) {
|
|
179
|
-
cb();
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
let layer_1, layer_2;
|
|
184
|
-
|
|
185
|
-
function renderSerie() {
|
|
186
|
-
larvitar
|
|
187
|
-
.readFiles(demoFiles)
|
|
188
|
-
.then(seriesStack => {
|
|
189
|
-
let seriesId = _.keys(seriesStack)[0];
|
|
190
|
-
|
|
191
|
-
let serie_1 = { ...seriesStack[seriesId] };
|
|
192
|
-
let serie_2 = { ...seriesStack[seriesId] };
|
|
193
|
-
|
|
194
|
-
layer_1 = larvitar.buildLayer(serie_1, "main");
|
|
195
|
-
layer_2 = larvitar.buildLayer(serie_2, "colored", {
|
|
196
|
-
opacity: 0.25,
|
|
197
|
-
colormap: "hotIron"
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
// define a layer into the series object to be rendered
|
|
201
|
-
serie_1.layer = layer_1;
|
|
202
|
-
serie_2.layer = layer_2;
|
|
203
|
-
|
|
204
|
-
larvitar.renderImage(serie_1, "viewer").then(() => {
|
|
205
|
-
console.log("Image 1 has been rendered");
|
|
206
|
-
});
|
|
207
|
-
larvitar.renderImage(serie_2, "viewer").then(() => {
|
|
208
|
-
console.log("Image 2 has been rendered");
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
$("#active-layer").html("Active Layer: main");
|
|
212
|
-
$("#opacity").html("Opacity: 1.0");
|
|
213
|
-
|
|
214
|
-
larvitar.addDefaultTools();
|
|
215
|
-
})
|
|
216
|
-
.catch(err => console.log(err));
|
|
217
|
-
}
|
|
218
|
-
let demoFileList = getDemoFileNames();
|
|
219
|
-
_.each(demoFileList, function (demoFile) {
|
|
220
|
-
createFile(demoFile, renderSerie);
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
document.onkeypress = function (e) {
|
|
224
|
-
e = e || window.event;
|
|
225
|
-
if (e.keyCode == 97) {
|
|
226
|
-
let activeLayer = larvitar.getActiveLayer("viewer");
|
|
227
|
-
let newActiveLayer =
|
|
228
|
-
activeLayer.layerId == layer_1.id ? layer_2 : layer_1;
|
|
229
|
-
|
|
230
|
-
larvitar.setActiveLayer("viewer", newActiveLayer.id);
|
|
231
|
-
$("#active-layer").html(
|
|
232
|
-
"Active Layer: " + newActiveLayer.options.name
|
|
233
|
-
);
|
|
234
|
-
$("#opacity").html("Opacity: " + newActiveLayer.options.opacity);
|
|
235
|
-
}
|
|
236
|
-
if (e.keyCode == 111) {
|
|
237
|
-
let activeLayer = larvitar.getActiveLayer("viewer");
|
|
238
|
-
let opacity =
|
|
239
|
-
activeLayer.options.opacity == 1.0
|
|
240
|
-
? 0.0
|
|
241
|
-
: activeLayer.options.opacity + 0.25;
|
|
242
|
-
larvitar.updateLayer("viewer", activeLayer.layerId, {
|
|
243
|
-
opacity: opacity
|
|
244
|
-
});
|
|
245
|
-
$("#opacity").html("Opacity: " + opacity);
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
</script>
|
|
249
|
-
</body>
|
|
250
|
-
</html>
|
package/docs/examples/masks.html
DELETED
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html class="h-100 overflow-hidden">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<link
|
|
6
|
-
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css"
|
|
7
|
-
rel="stylesheet"
|
|
8
|
-
integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl"
|
|
9
|
-
crossorigin="anonymous"
|
|
10
|
-
/>
|
|
11
|
-
<link
|
|
12
|
-
rel="stylesheet"
|
|
13
|
-
href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.2/styles/vs2015.min.css"
|
|
14
|
-
/>
|
|
15
|
-
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.2/highlight.min.js"></script>
|
|
16
|
-
<script>
|
|
17
|
-
hljs.highlightAll();
|
|
18
|
-
</script>
|
|
19
|
-
<title>Larvitar - Masks rendering example</title>
|
|
20
|
-
</head>
|
|
21
|
-
|
|
22
|
-
<body class="h-100" style="background-color: #000000">
|
|
23
|
-
<div class="row h-100">
|
|
24
|
-
<div
|
|
25
|
-
id="viewer"
|
|
26
|
-
class="col-8 h-100"
|
|
27
|
-
style="background-color: black"
|
|
28
|
-
></div>
|
|
29
|
-
|
|
30
|
-
<div class="col-4 h-100">
|
|
31
|
-
<pre class="h-100">
|
|
32
|
-
<p style="color: #ffffff">
|
|
33
|
-
Example of loading a segmentation
|
|
34
|
-
mask on the image.
|
|
35
|
-
You can modify the mask using Brush tool.
|
|
36
|
-
(press ctrl to delete instead of adding)
|
|
37
|
-
</p>
|
|
38
|
-
<button id="btn-label" class="btn btn-danger m-1" onclick="switchLabel()">Switch label</button>
|
|
39
|
-
<button class="btn btn-primary m-1" onclick="undo()">Undo</button><button class="btn btn-primary m-1" onclick="redo()">Redo</button>
|
|
40
|
-
<code class="javascript" style="background-color: #000000">
|
|
41
|
-
<p style="font-size:0.6vw;">
|
|
42
|
-
let demoFiles = [];
|
|
43
|
-
let counter = 0;
|
|
44
|
-
|
|
45
|
-
const getDemoFileNames = function () {
|
|
46
|
-
let demoFileList = [];
|
|
47
|
-
for (let i = 1; i < 25; i++) {
|
|
48
|
-
let filename = "anon" + i;
|
|
49
|
-
demoFileList.push(filename);
|
|
50
|
-
}
|
|
51
|
-
return demoFileList;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
// init all
|
|
55
|
-
larvitar.initLarvitarStore();
|
|
56
|
-
larvitar.initializeImageLoader();
|
|
57
|
-
larvitar.initializeCSTools();
|
|
58
|
-
larvitar.larvitar_store.addViewport("viewer");
|
|
59
|
-
larvitar.registerNRRDImageLoader();
|
|
60
|
-
|
|
61
|
-
async function createFile(fileName, cb) {
|
|
62
|
-
let response = await fetch("./demo/" + fileName);
|
|
63
|
-
let data = await response.blob();
|
|
64
|
-
let file = new File([data], fileName);
|
|
65
|
-
demoFiles.push(file);
|
|
66
|
-
counter++;
|
|
67
|
-
if (counter == 24) {
|
|
68
|
-
cb();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function renderSerie() {
|
|
73
|
-
larvitar.resetLarvitarManager();
|
|
74
|
-
larvitar.readFiles(demoFiles, function (seriesStack, err) {
|
|
75
|
-
if (seriesStack) {
|
|
76
|
-
// render the first series of the study
|
|
77
|
-
let seriesId = _.keys(seriesStack)[0];
|
|
78
|
-
let serie = seriesStack[seriesId];
|
|
79
|
-
larvitar.renderImage(serie, "viewer").then(function () {
|
|
80
|
-
larvitar.addDefaultTools();
|
|
81
|
-
demoFiles = [];
|
|
82
|
-
loadMasks();
|
|
83
|
-
});
|
|
84
|
-
} else {
|
|
85
|
-
console.log(err);
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
let demoFileList = getDemoFileNames();
|
|
91
|
-
|
|
92
|
-
_.each(demoFileList, function (demoFile) {
|
|
93
|
-
createFile(demoFile, renderSerie);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Load an image as in base example, then:
|
|
98
|
-
**/
|
|
99
|
-
|
|
100
|
-
async function loadMasks() {
|
|
101
|
-
larvitar.initSegmentationModule();
|
|
102
|
-
|
|
103
|
-
// fetch data
|
|
104
|
-
let response = await fetch("./demo/" + "segmentation.nrrd");
|
|
105
|
-
let data = await response.blob();
|
|
106
|
-
let nrrd_file = new File([data], "segmentation.nrrd");
|
|
107
|
-
// read file
|
|
108
|
-
let reader = new FileReader();
|
|
109
|
-
reader.readAsArrayBuffer(nrrd_file);
|
|
110
|
-
reader.onload = function () {
|
|
111
|
-
// create volume
|
|
112
|
-
let volume = larvitar.importNRRDImage(reader.result);
|
|
113
|
-
// define mask properties
|
|
114
|
-
let properties = {
|
|
115
|
-
// color: "#00ff00",
|
|
116
|
-
opacity: 0.2,
|
|
117
|
-
labelId: 0
|
|
118
|
-
};
|
|
119
|
-
// add to viewport
|
|
120
|
-
larvitar
|
|
121
|
-
.addSegmentationMask(properties, volume.data, "viewer")
|
|
122
|
-
.then(() => {
|
|
123
|
-
// activate brush on this labelmap
|
|
124
|
-
larvitar.setActiveLabelmap(0, "viewer");
|
|
125
|
-
larvitar.setToolActive("Brush");
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
let activeLabel = 1;
|
|
131
|
-
function switchLabel() {
|
|
132
|
-
let nextLabel = activeLabel == 1 ? 2 : 1;
|
|
133
|
-
larvitar.setActiveSegment(nextLabel, "viewer");
|
|
134
|
-
activeLabel = nextLabel;
|
|
135
|
-
let btn = document.getElementById("btn-label");
|
|
136
|
-
let btnClass = btn.className;
|
|
137
|
-
if (activeLabel == 1) {
|
|
138
|
-
btn.className = btnClass.replace("warning", "danger");
|
|
139
|
-
} else {
|
|
140
|
-
btn.className = btnClass.replace("danger", "warning");
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
function undo() {
|
|
144
|
-
larvitar.undoLastStroke("viewer");
|
|
145
|
-
}
|
|
146
|
-
function redo() {
|
|
147
|
-
larvitar.redoLastStroke("viewer");
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Undo: larvitar.undoLastStroke("viewer");
|
|
152
|
-
* Redo: larvitar.redoLastStroke("viewer");
|
|
153
|
-
* Switch: larvitar.setActiveSegment(1|2, "viewer");
|
|
154
|
-
*/
|
|
155
|
-
</p>
|
|
156
|
-
</code>
|
|
157
|
-
</pre>
|
|
158
|
-
</div>
|
|
159
|
-
</div>
|
|
160
|
-
|
|
161
|
-
<script src="./larvitar.js"></script>
|
|
162
|
-
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js"></script>
|
|
163
|
-
|
|
164
|
-
<script>
|
|
165
|
-
let demoFiles = [];
|
|
166
|
-
let counter = 0;
|
|
167
|
-
|
|
168
|
-
const getDemoFileNames = function () {
|
|
169
|
-
let demoFileList = [];
|
|
170
|
-
for (let i = 1; i < 25; i++) {
|
|
171
|
-
let filename = "anon" + i;
|
|
172
|
-
demoFileList.push(filename);
|
|
173
|
-
}
|
|
174
|
-
return demoFileList;
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
// init all
|
|
178
|
-
larvitar.initLarvitarStore();
|
|
179
|
-
larvitar.initializeImageLoader();
|
|
180
|
-
larvitar.initializeCSTools();
|
|
181
|
-
larvitar.larvitar_store.addViewport("viewer");
|
|
182
|
-
larvitar.registerNRRDImageLoader();
|
|
183
|
-
|
|
184
|
-
async function createFile(fileName, cb) {
|
|
185
|
-
let response = await fetch("./demo/" + fileName);
|
|
186
|
-
let data = await response.blob();
|
|
187
|
-
let file = new File([data], fileName);
|
|
188
|
-
demoFiles.push(file);
|
|
189
|
-
counter++;
|
|
190
|
-
if (counter == 24) {
|
|
191
|
-
cb();
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
function renderSerie() {
|
|
196
|
-
larvitar.resetLarvitarManager();
|
|
197
|
-
larvitar
|
|
198
|
-
.readFiles(demoFiles)
|
|
199
|
-
.then(seriesStack => {
|
|
200
|
-
// render the first series of the study
|
|
201
|
-
let seriesId = _.keys(seriesStack)[0];
|
|
202
|
-
let serie = seriesStack[seriesId];
|
|
203
|
-
larvitar.renderImage(serie, "viewer").then(() => {
|
|
204
|
-
larvitar.addDefaultTools();
|
|
205
|
-
demoFiles = [];
|
|
206
|
-
loadMasks();
|
|
207
|
-
});
|
|
208
|
-
})
|
|
209
|
-
.catch(err => console.log(err));
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
let demoFileList = getDemoFileNames();
|
|
213
|
-
|
|
214
|
-
_.each(demoFileList, function (demoFile) {
|
|
215
|
-
createFile(demoFile, renderSerie);
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Load an image as in base example, then:
|
|
220
|
-
**/
|
|
221
|
-
|
|
222
|
-
async function loadMasks() {
|
|
223
|
-
larvitar.initSegmentationModule();
|
|
224
|
-
|
|
225
|
-
// fetch data
|
|
226
|
-
let response = await fetch("./demo/" + "segmentation.nrrd");
|
|
227
|
-
let data = await response.blob();
|
|
228
|
-
let nrrd_file = new File([data], "segmentation.nrrd");
|
|
229
|
-
// read file
|
|
230
|
-
let reader = new FileReader();
|
|
231
|
-
reader.readAsArrayBuffer(nrrd_file);
|
|
232
|
-
reader.onload = function () {
|
|
233
|
-
// create volume
|
|
234
|
-
let volume = larvitar.importNRRDImage(reader.result);
|
|
235
|
-
// define mask properties
|
|
236
|
-
let properties = {
|
|
237
|
-
// color: "#00ff00",
|
|
238
|
-
opacity: 0.2,
|
|
239
|
-
labelId: 0
|
|
240
|
-
};
|
|
241
|
-
// add to viewport
|
|
242
|
-
larvitar
|
|
243
|
-
.addSegmentationMask(properties, volume.data, "viewer")
|
|
244
|
-
.then(() => {
|
|
245
|
-
// activate brush on this labelmap
|
|
246
|
-
larvitar.setActiveLabelmap(0, "viewer");
|
|
247
|
-
larvitar.setToolActive("Brush");
|
|
248
|
-
});
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
let activeLabel = 1;
|
|
253
|
-
function switchLabel() {
|
|
254
|
-
let nextLabel = activeLabel == 1 ? 2 : 1;
|
|
255
|
-
larvitar.setActiveSegment(nextLabel, "viewer");
|
|
256
|
-
activeLabel = nextLabel;
|
|
257
|
-
let btn = document.getElementById("btn-label");
|
|
258
|
-
let btnClass = btn.className;
|
|
259
|
-
if (activeLabel == 1) {
|
|
260
|
-
btn.className = btnClass.replace("warning", "danger");
|
|
261
|
-
} else {
|
|
262
|
-
btn.className = btnClass.replace("danger", "warning");
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
function undo() {
|
|
266
|
-
larvitar.undoLastStroke("viewer");
|
|
267
|
-
}
|
|
268
|
-
function redo() {
|
|
269
|
-
larvitar.redoLastStroke("viewer");
|
|
270
|
-
}
|
|
271
|
-
</script>
|
|
272
|
-
</body>
|
|
273
|
-
</html>
|