我是Java和ITK的新手。我从克隆ITK-JS存储库开始,并通过示例进行工作。
我的目标-从浏览器中,将目录(MR系列)中的所有图像读取到单个ITK图像(3D卷)中。
我从ITK-JS示例中的“ webpack”示例开始-在我的浏览器中运行了该示例。
然后我:
1.更改index.html以为multiple
元素启用<input type='file'>
。我通过将FileList对象的内容写入html元素来确认可以正常工作,并通过'readFile()'使它工作;然后
2.将'readFile(null,files [0])'替换为'readImageDICOMFileSeries(null,files)'。
当我使用'readImageDICOMFileSeries()'运行代码时,收到控制台消息:“ TypeError:filePath is undefined”。
我尝试了几种变体,但总是出现相同的错误。这是我当前的代码:
//
// read the images
// return readFile(null,files[0]) // -- this line works
return readImageDICOMFileSeries(null,files) // the causes TypeError: filePath is undefined
.then((worker)=>{
const {image}=worker;
let mFile = JSON.stringify(image) ;
alert(mFile)
console.log(image);
})
.catch(error=>{
console.error(error);
alert(error.message);
})
我在做什么错了?
预先感谢您的帮助。
道格