Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setupDicomForm(patientDict, async (files) => {
outputTextArea.textContent = "Loading..."
// Read DICOM serie
const { image, webWorker } = await readImageDICOMFileSeries(null, files)
webWorker.terminate()
// Display
function replacer (key, value) {
if (!!value && value.byteLength !== undefined) {
return String(value.slice(0, 6)) + '...'
}
return value
}
outputTextArea.textContent = JSON.stringify(image, replacer, 4)
})
})
publicAPI.readFileSeries = (files) => {
if (!files || !files.length || files === model.files) {
return Promise.resolve();
}
model.files = files;
return readImageDICOMFileSeries(null, files)
.then(({ webWorker, image }) => {
webWorker.terminate();
return image;
})
.then((itkImage) => {
const imageData = convertItkToVtkImage(itkImage, {
scalarArrayName: model.arrayName || getArrayName(model.fileName),
});
model.output[0] = imageData;
publicAPI.modified();
});
};