Hi everyone,
I’ve got an issue when loading some dicom files using itk-wasm, in the past I load the uploaded files through readImageDICOMFileSeries, it worked fine when there is just a single serie.
But some of the dicoms are mixed with different series, e.g. one series is a summary of 256 * 256 * 1 sized image with component 3 and othes have size of 800 * 800 * 1 with component 1, and the 256 * 256 one might be the first, the last or some other order to be imported. Here are some results for different imports and setups:
1. The image of 3 components is the first file to be imported, in this situation the error ReadImageDICOMFileSeries.umd.js:9 Only one pixel component is currently supported. Image pixel components: 3 will always show not matter singleSortedSeries param is true or false.
2. The image of 3 components is not the first and singleSortedSeries is set to false, in this situation the correct ct data will not be read, result will be only the 3 component one.
3. The image of 3 components is not the first and singleSortedSeries is set to true, in this situation the correct ct data can be read.
I can read the single file information with readImageFile, but since it’s not ordered, if I read it one by one, the error WebAssembly.instantiate(): Out of memory will show if files are big enough.
How should I handle this correctly to get the different series info? The source files are from different scan machines so the names of the files and the order can not be changed.
I’ve made a mistake that I didn’t pass the worker to next readImageFile call, when it is passed the out of memory situation will not present, the readImageFile can work properly.
Hi @matt.mccormick ,
I’ve met a problem that when reading dicom files from some devices, the readImageFile throws an error ‘No DICOM magic number found, but the file appears to be DICOM without a preamble’, it seems that the dicom files lost some part called preamble, but it can be display in 3d sclicer correctly, should I manully add the lost part to the file?
I’ve also done update itk to the newest version to check if this could be solved but find readImageFile deprecated, the error log tolds me to use new one from @itk-wam/image-io, but that module does not have a function exported which named with that. I’ve found a readImage function, but when I run it to replace the old readImageFile(params changed) like this:
import { readImage } from '@itk-wasm/image-io'
...
// in an async func, file is an input File given by an input element
{
...
const imageResult = await readImage(file, { webWorker: null })
....
}
The promise keeps pending at this state and will not return anything. The readDicomTags from module dicom still have the same problem.
Hi matt,
I still can not get it to work, here is a sandbox, could you please check it if you have spare time? The dicom file to test is in the public dir if you do not have. ITK module demo
I’m just using the methods like what I did in older version itk-wasm(orders of params are changed), but the promise returned by new APIs (including readImage and readDicomTags) seem to be always pending
With sandbox, I made the following changes. Reading the dicom tags work, I did not see about the images.
package.json: remove the itk-wasm entry, update the packages. Mixing that very old pre-release version of itk-wasm with the newer packages is likely not compatible. The newer itk-wasm packages are modular and self-sufficient.
vite.config.js: due to limitation / bug of vite regarding transitive dependencies, we want to exclude the itk-wasm packages from optimization. This can also be seen in the vite.config.js examples in the itk-wasm demo apps.
CTManager.ts: Update and use the simplified readImageDicomFileSeries calls. There is now only one function. And the input is an object with inputFiles property.
Hi @matt.mccormick ,
Thank you for your reply, the reason I use the readDicomTags instead of readImageDicomFileSeries is that sometimes user would select and upload all the files in a folder which includes multiple series in a case. In this case readImageDicomFileSeries will throw error for the unsupported series whose image pixel components is 3, so I use readDicomTags to sort them at first.
I have set the excluded packages in vite config and update to newest package, it is working.