Press "p" to play/pause frame animation
Max Web Workers:
let demoFiles = [];
// init all
larvitar.initializeImageLoader();
larvitar.registerMultiFrameImageLoader();
larvitar.initializeCSTools();
larvitar.store.initialize();
larvitar.store.addViewport("viewer");
async function renderSerie() {
const t0 = performance.now();
const seriesStack = await larvitar.readFiles(demoFiles);
// render the first series of the study
let seriesId = _.keys(seriesStack)[0];
let serie = seriesStack[seriesId];
larvitar.populateLarvitarManager(seriesId, serie);
let manager = larvitar.getLarvitarManager();
let multiFrameSerie = manager[seriesId];
let frameId = 0;
await larvitar.renderImage(multiFrameSerie, "viewer", frameId);
const t1 = performance.now();
console.log("Time to render First frame: " + (t1 - t0) + "ms");
larvitar.addDefaultTools();
larvitar.setToolActive("StackScroll");
await larvitar.loadAndCacheImageStack(multiFrameSerie);
console.log(
"Stack has been loaded and cached",
multiFrameSerie.bytes / 1048576
);
}
async function createFile(fileName, cb) {
let response = await fetch("./demo/" + fileName);
let data = await response.blob();
let file = new File([data], fileName);
demoFiles.push(file);
cb();
}
createFile("xa_integris.dcm", renderSerie);