I am using SimpleITK 2.0.2 and Python 3.7.9 to read a 3D CT image in the compressed mhd format (ct.mhd, ct.zraw). When I run the code below, I am getting the following message. “data not read completely”. So, I saved the read image back to file, opened in a viewer and I got the correct image. So, it seems like there is no issue for the code… Anyone has any clue why I am getting this message?
Thanks.
JK
[message]
MetaImage: M_ReadElementsROI: data not read completely
ideal = 1069833 : actual = 633067
That might be true for an image that is mostly zero, so the last 40% of it which was not read only contained zeroes. This is practically possible with label images.
True for me. I have experienced the same “MetaImage: M_ReadElementsROI: data not read completely” issue and figured the 3D image is a label, where 28,295,732 pixels are 0 and 15,820 pixels are labels.
I’m experiencing similar issues with (non-binary) CT images.
As an experiment I tried reading a CT image with a purposely corrupted .raw file.
when doing so, I see the console message:
MetaImage: M_ReadElementsData: data not read completely
ideal = 203948032 : actual = 16384
What is concerning is that with ITK 4.13, attempting to read this image with the standard itk::ImageFileReader would throw an itk::ExceptionObject. However, after updating to ITK 5.2 reading fails silently.
The M_ReadElementsROI() function correctly returns false in this condition:
but that return value is now being lost within the M_ReadROIStream() function
and also in lines 2661, 2767, and 2832 in that file.
I’ll create a pull request to fix these errors in the MetaIO library. I’ll need to work with the other ITK devs to determine how to update that library in ITK.
Actually, ignoring the return value is a now systemic problem in the metaImage.cxx file - happens with writing and reading. It is going to take some hunting to fix all of them. git blame…