larvitar 1.1.2 → 1.2.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/.github/workflows/deploy.yml +3 -12
- package/README.md +3 -3
- package/docs/documentation/Mixins.polygonSegmentationMixin%20-%20segmentation%20operations%20for%20polyline.html +171 -0
- package/docs/documentation/Tools.Annotation.ContoursTool.html +218 -0
- package/docs/documentation/Tools.Annotation.DiameterTool.html +219 -0
- package/docs/documentation/Tools.Annotation.SeedsTool.html +214 -0
- package/docs/documentation/Tools.Brush.BrushTool.html +218 -0
- package/docs/documentation/Tools.Brush.ThresholdsBrushTool.html +218 -0
- package/docs/documentation/Tools.PolylineScissorsTool.html +218 -0
- 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 +978 -0
- 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 +1049 -0
- 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 +1303 -0
- package/docs/documentation/imageAnonymization.js.html +245 -0
- package/docs/documentation/imageColormaps.js.html +283 -0
- package/docs/documentation/imageContours.js.html +278 -0
- package/docs/documentation/imageIo.js.html +291 -0
- package/docs/documentation/imageLayers.js.html +188 -0
- package/docs/documentation/imageLoading.js.html +297 -0
- package/docs/documentation/imageParsing.js.html +385 -0
- package/docs/documentation/imagePresets.js.html +207 -0
- package/docs/documentation/imageRendering.js.html +849 -0
- package/docs/documentation/imageReslice.js.html +162 -0
- package/docs/documentation/imageStore.js.html +360 -0
- package/docs/documentation/imageTools.js.html +784 -0
- package/docs/documentation/imageUtils.js.html +1609 -0
- package/docs/documentation/image_colormaps.js.html +283 -0
- package/docs/documentation/image_contours.js.html +279 -0
- package/docs/documentation/image_io.js.html +288 -0
- package/docs/documentation/image_layers.js.html +188 -0
- package/docs/documentation/image_loading.js.html +294 -0
- package/docs/documentation/image_parsing.js.html +391 -0
- package/docs/documentation/image_presets.js.html +207 -0
- package/docs/documentation/image_rendering.js.html +845 -0
- package/docs/documentation/image_reslice.js.html +164 -0
- package/docs/documentation/image_store.js.html +359 -0
- package/docs/documentation/image_tools.js.html +792 -0
- package/docs/documentation/image_utils.js.html +1609 -0
- package/docs/documentation/index.html +175 -0
- package/docs/documentation/loaders_commonLoader.js.html +306 -0
- package/docs/documentation/loaders_dicomLoader.js.html +130 -0
- package/docs/documentation/loaders_fileLoader.js.html +155 -0
- package/docs/documentation/loaders_multiframeLoader.js.html +443 -0
- package/docs/documentation/loaders_niftiLoader.js.html +150 -0
- package/docs/documentation/loaders_nrrdLoader.js.html +545 -0
- package/docs/documentation/loaders_resliceLoader.js.html +258 -0
- package/docs/documentation/module-imaging_contours.html +954 -0
- package/docs/documentation/module-imaging_imageAnonymization.html +544 -0
- package/docs/documentation/module-imaging_imageColormaps.html +1012 -0
- package/docs/documentation/module-imaging_imageContours.html +954 -0
- package/docs/documentation/module-imaging_imageIo.html +1057 -0
- package/docs/documentation/module-imaging_imageLayers.html +904 -0
- package/docs/documentation/module-imaging_imageLoading.html +1301 -0
- package/docs/documentation/module-imaging_imageParsing.html +1356 -0
- package/docs/documentation/module-imaging_imagePresets.html +679 -0
- package/docs/documentation/module-imaging_imageRendering.html +3223 -0
- package/docs/documentation/module-imaging_imageReslice.html +413 -0
- package/docs/documentation/module-imaging_imageStore-Larvitar_Store.html +284 -0
- package/docs/documentation/module-imaging_imageStore.html +1560 -0
- package/docs/documentation/module-imaging_imageTools.html +3617 -0
- package/docs/documentation/module-imaging_imageUtils.html +7253 -0
- package/docs/documentation/module-imaging_io.html +1057 -0
- package/docs/documentation/module-imaging_layers.html +904 -0
- package/docs/documentation/module-imaging_loading.html +1301 -0
- package/docs/documentation/module-imaging_parsing.html +1375 -0
- package/docs/documentation/module-imaging_presets.html +679 -0
- package/docs/documentation/module-imaging_rendering.html +8094 -0
- package/docs/documentation/module-imaging_reslice.html +411 -0
- package/docs/documentation/module-imaging_store-Larvitar_Store.html +284 -0
- package/docs/documentation/module-imaging_store.html +1537 -0
- package/docs/documentation/module-imaging_strategies_eraseFreehand.html +708 -0
- package/docs/documentation/module-imaging_strategies_fillFreehand.html +708 -0
- package/docs/documentation/module-imaging_tools.html +3617 -0
- package/docs/documentation/module-imaging_tools_custom_contourTool.html +207 -0
- package/docs/documentation/module-imaging_tools_custom_diameterTool.html +205 -0
- package/docs/documentation/module-imaging_tools_custom_editMaskTool.html +205 -0
- package/docs/documentation/module-imaging_tools_custom_polygonScissorsTool.html +203 -0
- package/docs/documentation/module-imaging_tools_custom_thresholdBrushTool.html +684 -0
- package/docs/documentation/module-imaging_tools_default.html +205 -0
- package/docs/documentation/module-imaging_tools_interaction.html +530 -0
- package/docs/documentation/module-imaging_tools_io.html +832 -0
- package/docs/documentation/module-imaging_tools_main.html +2028 -0
- package/docs/documentation/module-imaging_tools_polygonSegmentationMixin.html +567 -0
- package/docs/documentation/module-imaging_tools_segmentation.html +3586 -0
- package/docs/documentation/module-imaging_tools_state.html +494 -0
- package/docs/documentation/module-imaging_utils.html +7253 -0
- package/docs/documentation/module-loaders_commonLoader.html +1313 -0
- package/docs/documentation/module-loaders_dicomLoader.html +522 -0
- package/docs/documentation/module-loaders_fileLoader.html +593 -0
- package/docs/documentation/module-loaders_multiframeLoader.html +1169 -0
- package/docs/documentation/module-loaders_niftiLoader.html +565 -0
- package/docs/documentation/module-loaders_nrrdLoader.html +1459 -0
- package/docs/documentation/module-loaders_resliceLoader.html +590 -0
- package/docs/documentation/module-monitors_memory.html +980 -0
- package/docs/documentation/module-tools_default.html +740 -0
- package/docs/documentation/module.exports_module.exports.html +203 -0
- package/docs/documentation/monitors_memory.js.html +189 -0
- package/docs/documentation/parsers_nrrd.js.html +569 -0
- package/docs/documentation/scripts/collapse.js +20 -0
- package/docs/documentation/scripts/linenumber.js +25 -0
- package/docs/documentation/scripts/nav.js +12 -0
- package/docs/documentation/scripts/polyfill.js +4 -0
- package/docs/documentation/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/docs/documentation/scripts/prettify/lang-css.js +2 -0
- package/docs/documentation/scripts/prettify/prettify.js +28 -0
- package/docs/documentation/scripts/search.js +83 -0
- package/docs/documentation/styles/jsdoc.css +765 -0
- package/docs/documentation/styles/prettify.css +80 -0
- package/docs/documentation/tools_contourTool.js.html +1963 -0
- package/docs/documentation/tools_custom_contourTool.js.html +1968 -0
- package/docs/documentation/tools_custom_diameterTool.js.html +225 -0
- package/docs/documentation/tools_custom_editMaskTool.js.html +225 -0
- package/docs/documentation/tools_custom_polylineScissorsTool.js.html +143 -0
- package/docs/documentation/tools_custom_thresholdsBrushTool.js.html +245 -0
- package/docs/documentation/tools_default.js.html +576 -0
- package/docs/documentation/tools_diameterTool.js.html +219 -0
- package/docs/documentation/tools_editMaskTool.js.html +219 -0
- package/docs/documentation/tools_interaction.js.html +258 -0
- package/docs/documentation/tools_io.js.html +297 -0
- package/docs/documentation/tools_main.js.html +443 -0
- package/docs/documentation/tools_polygonSegmentationMixin.js.html +329 -0
- package/docs/documentation/tools_polylineScissorsTool.js.html +136 -0
- package/docs/documentation/tools_seedTool.js.html +423 -0
- package/docs/documentation/tools_segmentation.js.html +558 -0
- package/docs/documentation/tools_state.js.html +163 -0
- package/docs/documentation/tools_strategies_eraseFreehand.js.html +160 -0
- package/docs/documentation/tools_strategies_fillFreehand.js.html +163 -0
- package/docs/documentation/tools_thresholdsBrushTool.js.html +239 -0
- package/docs/documentation/tools_tools.default.js.html +569 -0
- package/docs/documentation/tools_tools.interaction.js.html +251 -0
- package/docs/documentation/tools_tools.io.js.html +288 -0
- package/docs/documentation/tools_tools.main.js.html +442 -0
- package/docs/documentation/tools_tools.segmentation.js.html +445 -0
- package/docs/documentation/tools_tools.state.js.html +157 -0
- package/docs/examples/base.html +170 -0
- package/docs/examples/colorMaps.html +181 -0
- package/docs/examples/defaultTools.html +246 -0
- 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 +129 -0
- package/docs/examples/larvitar.js +108623 -0
- package/docs/examples/layers.html +250 -0
- package/docs/examples/masks.html +273 -0
- package/docs/examples/multiframe.html +200 -0
- package/docs/examples/nrrd.html +96 -0
- package/docs/examples/reslice.html +174 -0
- package/docs/index.html +92 -0
- package/imaging/tools/segmentation.js +12 -2
- package/imaging/tools/segmentations.md +6 -0
- package/imaging/tools/setLabelMap3D.js +248 -0
- package/package.json +1 -1
|
@@ -0,0 +1,200 @@
|
|
|
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 - Multiframe 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 "p" to play/pause frame animation
|
|
31
|
+
</p>
|
|
32
|
+
<p
|
|
33
|
+
id="frame-rate"
|
|
34
|
+
style="position: absolute; top: 20px; color: white"
|
|
35
|
+
></p>
|
|
36
|
+
<p
|
|
37
|
+
id="current-frame"
|
|
38
|
+
style="position: absolute; top: 40px; color: white"
|
|
39
|
+
></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
|
+
|
|
47
|
+
// init all
|
|
48
|
+
larvitar.initLarvitarStore();
|
|
49
|
+
larvitar.initializeImageLoader();
|
|
50
|
+
larvitar.registerMultiFrameImageLoader();
|
|
51
|
+
larvitar.initializeCSTools();
|
|
52
|
+
larvitar.larvitar_store.addViewport("viewer");
|
|
53
|
+
|
|
54
|
+
function renderSerie() {
|
|
55
|
+
larvitar
|
|
56
|
+
.readFiles(demoFiles)
|
|
57
|
+
.then(seriesStack => {
|
|
58
|
+
// render the first series of the study
|
|
59
|
+
let seriesId = _.keys(seriesStack)[0];
|
|
60
|
+
let serie = seriesStack[seriesId];
|
|
61
|
+
larvitar.populateLarvitarManager(seriesId, serie);
|
|
62
|
+
let manager = larvitar.getLarvitarManager();
|
|
63
|
+
let multiFrameSerie = manager[seriesId];
|
|
64
|
+
let frameId = 1;
|
|
65
|
+
larvitar
|
|
66
|
+
.renderImage(multiFrameSerie, "viewer", frameId)
|
|
67
|
+
.then(() => {
|
|
68
|
+
console.log("Image has been rendered");
|
|
69
|
+
});
|
|
70
|
+
larvitar.addDefaultTools();
|
|
71
|
+
larvitar.setToolActive("Wwwc");
|
|
72
|
+
|
|
73
|
+
let animation = false;
|
|
74
|
+
let animationId = null;
|
|
75
|
+
let numberOfFrames = multiFrameSerie.numberOfFrames;
|
|
76
|
+
let frameRate = multiFrameSerie.frameTime;
|
|
77
|
+
$("#frame-rate").html("Frame Rate: " + parseInt(frameRate) + "ms");
|
|
78
|
+
$("#current-frame").html("Current Frame: 1 of " + numberOfFrames);
|
|
79
|
+
|
|
80
|
+
document.onkeypress = function (e) {
|
|
81
|
+
e = e || window.event;
|
|
82
|
+
if (e.keyCode == 112) {
|
|
83
|
+
animation = !animation;
|
|
84
|
+
if (animation) {
|
|
85
|
+
frameId =
|
|
86
|
+
larvitar.larvitar_store.state.viewports.viewer.sliceId;
|
|
87
|
+
animationId = setInterval(function () {
|
|
88
|
+
let series =
|
|
89
|
+
larvitar.getSeriesDataFromLarvitarManager(seriesId);
|
|
90
|
+
frameId = frameId == numberOfFrames ? 1 : frameId + 1;
|
|
91
|
+
larvitar.updateImage(series, "viewer", frameId, true);
|
|
92
|
+
$("#current-frame").html(
|
|
93
|
+
"Current Frame: " + frameId + " of " + numberOfFrames
|
|
94
|
+
);
|
|
95
|
+
}, frameRate);
|
|
96
|
+
} else {
|
|
97
|
+
clearInterval(animationId);
|
|
98
|
+
$("#current-frame").html();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
})
|
|
103
|
+
.catch(err => console.log(err));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async function createFile(fileName, cb) {
|
|
107
|
+
let response = await fetch("./demo/" + fileName);
|
|
108
|
+
let data = await response.blob();
|
|
109
|
+
let file = new File([data], fileName);
|
|
110
|
+
demoFiles.push(file);
|
|
111
|
+
cb();
|
|
112
|
+
}
|
|
113
|
+
createFile("xa_integris.dcm", renderSerie);
|
|
114
|
+
</p>
|
|
115
|
+
</code>
|
|
116
|
+
</pre>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
<script src="./larvitar.js"></script>
|
|
121
|
+
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js"></script>
|
|
122
|
+
<script
|
|
123
|
+
src="https://code.jquery.com/jquery-3.6.0.slim.min.js"
|
|
124
|
+
integrity="sha256-u7e5khyithlIdTpu22PHhENmPcRdFiHRjhAuHcs05RI="
|
|
125
|
+
crossorigin="anonymous"
|
|
126
|
+
></script>
|
|
127
|
+
|
|
128
|
+
<script>
|
|
129
|
+
let demoFiles = [];
|
|
130
|
+
|
|
131
|
+
// init all
|
|
132
|
+
larvitar.initLarvitarStore();
|
|
133
|
+
larvitar.initializeImageLoader();
|
|
134
|
+
larvitar.registerMultiFrameImageLoader();
|
|
135
|
+
larvitar.initializeCSTools();
|
|
136
|
+
larvitar.larvitar_store.addViewport("viewer");
|
|
137
|
+
|
|
138
|
+
function renderSerie() {
|
|
139
|
+
larvitar
|
|
140
|
+
.readFiles(demoFiles)
|
|
141
|
+
.then(seriesStack => {
|
|
142
|
+
// render the first series of the study
|
|
143
|
+
let seriesId = _.keys(seriesStack)[0];
|
|
144
|
+
let serie = seriesStack[seriesId];
|
|
145
|
+
larvitar.populateLarvitarManager(seriesId, serie);
|
|
146
|
+
let manager = larvitar.getLarvitarManager();
|
|
147
|
+
let multiFrameSerie = manager[seriesId];
|
|
148
|
+
let frameId = 1;
|
|
149
|
+
larvitar
|
|
150
|
+
.renderImage(multiFrameSerie, "viewer", frameId)
|
|
151
|
+
.then(() => {
|
|
152
|
+
console.log("Image has been rendered");
|
|
153
|
+
});
|
|
154
|
+
larvitar.addDefaultTools();
|
|
155
|
+
larvitar.setToolActive("Wwwc");
|
|
156
|
+
|
|
157
|
+
let animation = false;
|
|
158
|
+
let animationId = null;
|
|
159
|
+
let numberOfFrames = multiFrameSerie.numberOfFrames;
|
|
160
|
+
let frameRate = multiFrameSerie.frameTime;
|
|
161
|
+
$("#frame-rate").html("Frame Rate: " + parseInt(frameRate) + "ms");
|
|
162
|
+
$("#current-frame").html("Current Frame: 1 of " + numberOfFrames);
|
|
163
|
+
|
|
164
|
+
document.onkeypress = function (e) {
|
|
165
|
+
e = e || window.event;
|
|
166
|
+
if (e.keyCode == 112) {
|
|
167
|
+
animation = !animation;
|
|
168
|
+
if (animation) {
|
|
169
|
+
frameId =
|
|
170
|
+
larvitar.larvitar_store.state.viewports.viewer.sliceId;
|
|
171
|
+
animationId = setInterval(function () {
|
|
172
|
+
let series =
|
|
173
|
+
larvitar.getSeriesDataFromLarvitarManager(seriesId);
|
|
174
|
+
frameId = frameId == numberOfFrames ? 1 : frameId + 1;
|
|
175
|
+
larvitar.updateImage(series, "viewer", frameId, true);
|
|
176
|
+
$("#current-frame").html(
|
|
177
|
+
"Current Frame: " + frameId + " of " + numberOfFrames
|
|
178
|
+
);
|
|
179
|
+
}, frameRate);
|
|
180
|
+
} else {
|
|
181
|
+
clearInterval(animationId);
|
|
182
|
+
$("#current-frame").html();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
})
|
|
187
|
+
.catch(err => console.log(err));
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
async function createFile(fileName, cb) {
|
|
191
|
+
let response = await fetch("./demo/" + fileName);
|
|
192
|
+
let data = await response.blob();
|
|
193
|
+
let file = new File([data], fileName);
|
|
194
|
+
demoFiles.push(file);
|
|
195
|
+
cb();
|
|
196
|
+
}
|
|
197
|
+
createFile("xa_integris.dcm", renderSerie);
|
|
198
|
+
</script>
|
|
199
|
+
</body>
|
|
200
|
+
</html>
|
|
@@ -0,0 +1,96 @@
|
|
|
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 - NRRD 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
|
+
<code class="javascript" style="background-color: #000000">
|
|
33
|
+
<p style="font-size:0.6vw;">
|
|
34
|
+
// init all
|
|
35
|
+
larvitar.initLarvitarStore();
|
|
36
|
+
larvitar.initializeImageLoader();
|
|
37
|
+
larvitar.registerNRRDImageLoader();
|
|
38
|
+
larvitar.initializeCSTools();
|
|
39
|
+
larvitar.larvitar_store.addViewport("viewer");
|
|
40
|
+
|
|
41
|
+
createFile("example.nrrd", function (nrrd_file) {
|
|
42
|
+
let reader = new FileReader();
|
|
43
|
+
reader.readAsArrayBuffer(nrrd_file);
|
|
44
|
+
reader.onload = function () {
|
|
45
|
+
let volume = larvitar.importNRRDImage(reader.result);
|
|
46
|
+
let serie = larvitar.buildNrrdImage(volume, "1234", {});
|
|
47
|
+
larvitar.renderImage(serie, "viewer");
|
|
48
|
+
larvitar.addDefaultTools();
|
|
49
|
+
larvitar.setToolActive("Wwwc");
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
async function createFile(fileName, callback) {
|
|
54
|
+
let response = await fetch("./demo/" + fileName);
|
|
55
|
+
let data = await response.blob();
|
|
56
|
+
let file = new File([data], fileName);
|
|
57
|
+
callback(file);
|
|
58
|
+
}
|
|
59
|
+
</p>
|
|
60
|
+
</code>
|
|
61
|
+
</pre>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<script src="./larvitar.js"></script>
|
|
66
|
+
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js"></script>
|
|
67
|
+
|
|
68
|
+
<script>
|
|
69
|
+
// init all
|
|
70
|
+
larvitar.initLarvitarStore();
|
|
71
|
+
larvitar.initializeImageLoader();
|
|
72
|
+
larvitar.registerNRRDImageLoader();
|
|
73
|
+
larvitar.initializeCSTools();
|
|
74
|
+
larvitar.larvitar_store.addViewport("viewer");
|
|
75
|
+
|
|
76
|
+
createFile("example.nrrd", function (nrrd_file) {
|
|
77
|
+
let reader = new FileReader();
|
|
78
|
+
reader.readAsArrayBuffer(nrrd_file);
|
|
79
|
+
reader.onload = function () {
|
|
80
|
+
let volume = larvitar.importNRRDImage(reader.result);
|
|
81
|
+
let serie = larvitar.buildNrrdImage(volume, "1234", {});
|
|
82
|
+
larvitar.renderImage(serie, "viewer");
|
|
83
|
+
larvitar.addDefaultTools();
|
|
84
|
+
larvitar.setToolActive("Wwwc");
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
async function createFile(fileName, callback) {
|
|
89
|
+
let response = await fetch("./demo/" + fileName);
|
|
90
|
+
let data = await response.blob();
|
|
91
|
+
let file = new File([data], fileName);
|
|
92
|
+
callback(file);
|
|
93
|
+
}
|
|
94
|
+
</script>
|
|
95
|
+
</body>
|
|
96
|
+
</html>
|
|
@@ -0,0 +1,174 @@
|
|
|
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 - Reslice rendering example</title>
|
|
20
|
+
</head>
|
|
21
|
+
|
|
22
|
+
<body class="h-100" style="background-color: #000000">
|
|
23
|
+
<div class="row h-100">
|
|
24
|
+
<div class="col-8 h-100">
|
|
25
|
+
<div
|
|
26
|
+
id="viewer-base"
|
|
27
|
+
class="col-12 h-50"
|
|
28
|
+
style="background-color: black"
|
|
29
|
+
></div>
|
|
30
|
+
<div
|
|
31
|
+
id="viewer-reslice"
|
|
32
|
+
class="col-12 h-50"
|
|
33
|
+
style="background-color: black"
|
|
34
|
+
></div>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="col-4 h-100">
|
|
37
|
+
<pre class="h-100">
|
|
38
|
+
<code class="javascript" style="background-color: #000000">
|
|
39
|
+
<p style="font-size:0.6vw;">
|
|
40
|
+
let demoFiles = [];
|
|
41
|
+
let counter = 0;
|
|
42
|
+
|
|
43
|
+
const getDemoFileNames = function () {
|
|
44
|
+
let demoFileList = [];
|
|
45
|
+
for (let i = 1; i < 25; i++) {
|
|
46
|
+
let filename = "anon" + i;
|
|
47
|
+
demoFileList.push(filename);
|
|
48
|
+
}
|
|
49
|
+
return demoFileList;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// init all
|
|
53
|
+
larvitar.initLarvitarStore();
|
|
54
|
+
larvitar.initializeImageLoader();
|
|
55
|
+
larvitar.registerResliceLoader();
|
|
56
|
+
larvitar.initializeCSTools();
|
|
57
|
+
larvitar.larvitar_store.addViewport("viewer-base");
|
|
58
|
+
larvitar.larvitar_store.addViewport("viewer-reslice");
|
|
59
|
+
|
|
60
|
+
async function createFile(fileName, cb) {
|
|
61
|
+
let response = await fetch("./demo/" + fileName);
|
|
62
|
+
let data = await response.blob();
|
|
63
|
+
let file = new File([data], fileName);
|
|
64
|
+
demoFiles.push(file);
|
|
65
|
+
counter++;
|
|
66
|
+
if (counter == 24) {
|
|
67
|
+
cb();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function renderSerie() {
|
|
72
|
+
larvitar
|
|
73
|
+
.readFiles(demoFiles)
|
|
74
|
+
.then(seriesStack => {
|
|
75
|
+
// render the first series of the study
|
|
76
|
+
let seriesId = _.keys(seriesStack)[0];
|
|
77
|
+
let serie = seriesStack[seriesId];
|
|
78
|
+
larvitar.populateLarvitarManager(seriesId, serie);
|
|
79
|
+
larvitar.renderImage(serie, "viewer-base").then(() => {
|
|
80
|
+
console.log("Image axial has been rendered");
|
|
81
|
+
});
|
|
82
|
+
larvitar.cacheImages(serie, function (resp) {
|
|
83
|
+
if (resp.loading == 100) {
|
|
84
|
+
larvitar.resliceSeries(serie, "coronal").then(data => {
|
|
85
|
+
larvitar.renderImage(data, "viewer-reslice").then(() => {
|
|
86
|
+
console.log("Image resliced has been rendered");
|
|
87
|
+
});
|
|
88
|
+
larvitar.addDefaultTools();
|
|
89
|
+
larvitar.setToolActive("Wwwc");
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
})
|
|
94
|
+
.catch(err => console.log(err));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
let demoFileList = getDemoFileNames();
|
|
98
|
+
_.each(demoFileList, function (demoFile) {
|
|
99
|
+
createFile(demoFile, renderSerie);
|
|
100
|
+
});
|
|
101
|
+
</p>
|
|
102
|
+
</code>
|
|
103
|
+
</pre>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<script src="./larvitar.js"></script>
|
|
108
|
+
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js"></script>
|
|
109
|
+
|
|
110
|
+
<script>
|
|
111
|
+
let demoFiles = [];
|
|
112
|
+
let counter = 0;
|
|
113
|
+
|
|
114
|
+
const getDemoFileNames = function () {
|
|
115
|
+
let demoFileList = [];
|
|
116
|
+
for (let i = 1; i < 25; i++) {
|
|
117
|
+
let filename = "anon" + i;
|
|
118
|
+
demoFileList.push(filename);
|
|
119
|
+
}
|
|
120
|
+
return demoFileList;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// init all
|
|
124
|
+
larvitar.initLarvitarStore();
|
|
125
|
+
larvitar.initializeImageLoader();
|
|
126
|
+
larvitar.registerResliceLoader();
|
|
127
|
+
larvitar.initializeCSTools();
|
|
128
|
+
larvitar.larvitar_store.addViewport("viewer-base");
|
|
129
|
+
larvitar.larvitar_store.addViewport("viewer-reslice");
|
|
130
|
+
|
|
131
|
+
async function createFile(fileName, cb) {
|
|
132
|
+
let response = await fetch("./demo/" + fileName);
|
|
133
|
+
let data = await response.blob();
|
|
134
|
+
let file = new File([data], fileName);
|
|
135
|
+
demoFiles.push(file);
|
|
136
|
+
counter++;
|
|
137
|
+
if (counter == 24) {
|
|
138
|
+
cb();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function renderSerie() {
|
|
143
|
+
larvitar
|
|
144
|
+
.readFiles(demoFiles)
|
|
145
|
+
.then(seriesStack => {
|
|
146
|
+
// render the first series of the study
|
|
147
|
+
let seriesId = _.keys(seriesStack)[0];
|
|
148
|
+
let serie = seriesStack[seriesId];
|
|
149
|
+
larvitar.populateLarvitarManager(seriesId, serie);
|
|
150
|
+
larvitar.renderImage(serie, "viewer-base").then(() => {
|
|
151
|
+
console.log("Image axial has been rendered");
|
|
152
|
+
});
|
|
153
|
+
larvitar.cacheImages(serie, function (resp) {
|
|
154
|
+
if (resp.loading == 100) {
|
|
155
|
+
larvitar.resliceSeries(serie, "coronal").then(data => {
|
|
156
|
+
larvitar.renderImage(data, "viewer-reslice").then(() => {
|
|
157
|
+
console.log("Image resliced has been rendered");
|
|
158
|
+
});
|
|
159
|
+
larvitar.addDefaultTools();
|
|
160
|
+
larvitar.setToolActive("Wwwc");
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
})
|
|
165
|
+
.catch(err => console.log(err));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
let demoFileList = getDemoFileNames();
|
|
169
|
+
_.each(demoFileList, function (demoFile) {
|
|
170
|
+
createFile(demoFile, renderSerie);
|
|
171
|
+
});
|
|
172
|
+
</script>
|
|
173
|
+
</body>
|
|
174
|
+
</html>
|
package/docs/index.html
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html class="h-100">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<title>Larvitar</title>
|
|
6
|
+
<link
|
|
7
|
+
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css"
|
|
8
|
+
rel="stylesheet"
|
|
9
|
+
integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl"
|
|
10
|
+
crossorigin="anonymous"
|
|
11
|
+
/>
|
|
12
|
+
</head>
|
|
13
|
+
<body class="h-100" style="background-color: #d7e8e1">
|
|
14
|
+
<div class="container h-100">
|
|
15
|
+
<div class="row justify-content-center">
|
|
16
|
+
<div class="col-4"></div>
|
|
17
|
+
<div class="col-4 text-center">
|
|
18
|
+
<img
|
|
19
|
+
src="https://assets.pokemon.com/assets/cms2/img/pokedex/full/246.png"
|
|
20
|
+
style="height: 200px"
|
|
21
|
+
alt="..."
|
|
22
|
+
/>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="col-4"></div>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<div>
|
|
28
|
+
<div class="row justify-content-center">
|
|
29
|
+
<div class="col-3"></div>
|
|
30
|
+
<div class="col-6 text-center">
|
|
31
|
+
<div id="title">
|
|
32
|
+
<p class="display-5">Larvitar Documentation</p>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
<div class="col-3"></div>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<hr class="my-4" />
|
|
39
|
+
<div class="row justify-content-center">
|
|
40
|
+
<div class="col-3"></div>
|
|
41
|
+
<div class="col-6 text-center">
|
|
42
|
+
<div id="title">
|
|
43
|
+
<p class="lead">Dicom Image Toolkit for CornestoneJS</p>
|
|
44
|
+
<p class="lead" id="version"><i>v</i></p>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
<div class="col-3"></div>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div class="row justify-content-center">
|
|
51
|
+
<div class="col-3"></div>
|
|
52
|
+
<div class="col-6 text-center">
|
|
53
|
+
<a
|
|
54
|
+
class="btn btn-outline-success btn-lg"
|
|
55
|
+
href="./documentation/index.html"
|
|
56
|
+
role="button"
|
|
57
|
+
>Docs
|
|
58
|
+
</a>
|
|
59
|
+
|
|
60
|
+
<a
|
|
61
|
+
class="btn btn-outline-success btn-lg"
|
|
62
|
+
href="./examples/index.html"
|
|
63
|
+
role="button"
|
|
64
|
+
>Examples
|
|
65
|
+
</a>
|
|
66
|
+
</div>
|
|
67
|
+
<div class="col-3"></div>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<hr class="mt-5 mb-5" />
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<div class="row align-items-end">
|
|
74
|
+
<div class="col-2"></div>
|
|
75
|
+
<div class="col-8 text-center">
|
|
76
|
+
<a href="https://www.dvisionlab.com" target="_blank">
|
|
77
|
+
<img
|
|
78
|
+
src="https://www.dvisionlab.com/images/logo_500.png"
|
|
79
|
+
style="height: 300px"
|
|
80
|
+
alt="..."
|
|
81
|
+
/>
|
|
82
|
+
</a>
|
|
83
|
+
</div>
|
|
84
|
+
<div class="col-2"></div>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
<script src="examples/larvitar.js"></script>
|
|
88
|
+
<script>
|
|
89
|
+
document.getElementById("version").innerHTML += larvitar.VERSION;
|
|
90
|
+
</script>
|
|
91
|
+
</body>
|
|
92
|
+
</html>
|
|
@@ -14,6 +14,11 @@ const { getters, setters } = segModule;
|
|
|
14
14
|
import { setToolActive, setToolDisabled } from "./main";
|
|
15
15
|
import { isElement } from "../imageUtils";
|
|
16
16
|
|
|
17
|
+
// custom code
|
|
18
|
+
import { setLabelmap3DForElement } from "./setLabelMap3D";
|
|
19
|
+
// override function
|
|
20
|
+
setters.labelmap3DForElement = setLabelmap3DForElement;
|
|
21
|
+
|
|
17
22
|
// General segmentation cs tools module configuration
|
|
18
23
|
const config = {
|
|
19
24
|
arrayType: 0,
|
|
@@ -172,7 +177,7 @@ export function initSegmentationModule(customConfig) {
|
|
|
172
177
|
* @returns {Promise} - Return a promise which will resolve when segmentation mask is added
|
|
173
178
|
*/
|
|
174
179
|
export function addSegmentationMask(props, data, elementId) {
|
|
175
|
-
let promise = new Promise(resolve => {
|
|
180
|
+
let promise = new Promise(async resolve => {
|
|
176
181
|
let element = isElement(elementId)
|
|
177
182
|
? elementId
|
|
178
183
|
: document.getElementById(elementId);
|
|
@@ -180,7 +185,12 @@ export function addSegmentationMask(props, data, elementId) {
|
|
|
180
185
|
console.error("invalid html element: " + elementId);
|
|
181
186
|
return;
|
|
182
187
|
}
|
|
183
|
-
|
|
188
|
+
|
|
189
|
+
const res = await setters.labelmap3DForElement(
|
|
190
|
+
element,
|
|
191
|
+
data.buffer,
|
|
192
|
+
props.labelId
|
|
193
|
+
);
|
|
184
194
|
// if user set a color property, use that color for all segments on the labelmap
|
|
185
195
|
let lut = props.color
|
|
186
196
|
? generateUniformLUT(props.color, props.opacity)
|
|
@@ -30,3 +30,9 @@ TODO
|
|
|
30
30
|
# Larvitar segmentation API
|
|
31
31
|
|
|
32
32
|
TODO
|
|
33
|
+
|
|
34
|
+
# Customization
|
|
35
|
+
|
|
36
|
+
Some function in larvitar overrides the default behaviour of cornerstone tools, here is a list of them:
|
|
37
|
+
|
|
38
|
+
- `setters.labelmap3DForElement` is overridden to have a non-blocking behaviour, the custom code is in ./setLabelMap3D.js, same as original code in cs tools repo.
|