Hello
I’m encountering issues when trying to read MHD files using the metaReadImage
method from ITK-Wasm. I’ve tried multiple approaches, but I cannot successfully load an MHD/ZRAW file. Additionally, the official online example also fails and returns an error that I am unable to interpret.
https://insightsoftwareconsortium.github.io/ITK-Wasm/image-io/ts/app/?functionName=readImage
I observed two distinct errors depending on how I attempt to read the file.
Case 1: “Cannot open data file” Error
Steps to Reproduce
- Select an
.mhd
file along with its corresponding.zraw
file. - Attempt to load the image using:
const { image } = await metaReadImage(mhdFile);
- The following error appears in the console:
Error Message
MetaImage: Read: Cannot open data file
Exception while running pipeline
stderr: MetaImage: Read: Cannot open data file
Build module in Debug mode for exception message information.
Expected Behavior
The file should load correctly without failing to open the data file.
Case 2: “ErrnoError: 28” Error
Steps to Reproduce
- Select an
.mhd
file along with its corresponding.zraw
file. - Attempt to load the image using:
const { image } = await metaReadImage([mhdFile, rawFile]);
- The following error appears in the console:
Error Message
Error reading MetaImage files: Object { name: "ErrnoError", errno: 28 }
const handleFileChange = async (event) => {
const files = event.target.files;
let mhdFile, rawFile;
for (const file of files) {
const name = file.name.toLowerCase();
if (name.endsWith('.mhd')) {
mhdFile = file;
} else if (name.endsWith('.raw') || name.endsWith('.zraw')) {
rawFile = file;
}
}
try {
console.log('Loaded MetaImage files:', mhdFile, rawFile);
// Case 1
const { image } = await metaReadImage(mhdFile);
// Case 2
// const { image } = await metaReadImage([mhdFile, rawFile]);
setItkImage(image);
} catch (error) {
console.error('Error reading MetaImage files:', error);
}
};
Would appreciate any guidance on resolving these issues! Thanks.