// init all larvitar.initializeImageLoader(); larvitar.registerNRRDImageLoader(); larvitar.initializeCSTools(); larvitar.store.initialize(); larvitar.store.addViewport("viewer"); createFile("example.nrrd", function (nrrd_file) { let reader = new FileReader(); reader.readAsArrayBuffer(nrrd_file); reader.onload = function () { let volume = larvitar.importNRRDImage(reader.result); let serie = larvitar.buildNrrdImage(volume, "1234", {}); larvitar.renderImage(serie, "viewer"); larvitar.addDefaultTools(); larvitar.setToolActive("Wwwc"); }; }); async function createFile(fileName, callback) { let response = await fetch("./demo/" + fileName); let data = await response.blob(); let file = new File([data], fileName); callback(file); }