-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
44 lines (37 loc) · 1.05 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import * as niivue from "../dist/index.js";
// import { Niivue } from "@niivue/niivue";
let config = window.parent.config || window.config;
if (!config) {
console.log("Config not set.. using debug config");
config = {
path: "../images/mni152.nii.gz",
};
}
const drop = document.getElementById("sliceType");
drop.onchange = function () {
const st = parseInt(document.getElementById("sliceType").value);
nv1.setSliceType(st);
}
function handleIntensityChange(data) {
document.getElementById("intensity").innerHTML = " " + data.string;
console.log(data);
}
const volumeList1 = [
{
url: config.path, // Use the dynamic path from the config object
colormap: "gray",
visible: true,
},
];
const nv1 = new niivue.Niivue({
dragAndDropEnabled: true,
onLocationChange: handleIntensityChange,
isRuler: true,
show3Dcrosshair: true,
});
nv1.attachTo("gl1");
nv1.loadVolumes(volumeList1).then(() => {
nv1.setSliceType(nv1.sliceTypeMultiplanar);
}).catch((error) => {
console.error("Error loading volumes:", error);
});