ImageFileReader does not instantiate image object (sometimes)
cheyvaert-medexprim opened this issue · 8 comments
Hello,
I run on python shell the example from the documentation:
from pydicom.data import get_testdata_file
from highdicom.io import ImageFileReader
test_filepath = get_testdata_file('eCT_Supplemental.dcm')
with ImageFileReader(test_filepath) as image:
print(image.metadata.SOPInstanceUID)
for i in range(image.number_of_frames):
frame = image.read_frame(i)
print(frame.shape)
It works well.
BUT:
If I tried to do the same with one of my own files:
number_of_frames returns 1, the other method returns empty values, sometimes with error or warning.
BUT:
If called twice the number_of_frames method:
with ImageFileReader(test_filepath) as image:
image.number_of_frames # calling number_of_frames twice
image.number_of_frames # calling number_of_frames twice
print(image.metadata.SOPInstanceUID)
for i in range(image.number_of_frames):
frame = image.read_frame(i)
print(frame.shape)
It's working suddenly well.
The image I tried to open weight 2Go, and the modality is SM.
Hi @cheyvaert-medexprim, thanks for using the library and reporting this bug. It will help a lot if you provide an deidentified example dataset that demonstrates the issue. I'm afraid I do not understand what you mean in this sentence:
The image I tried to open weight 2Go
Could you explain? Is this some open data?
Hi, I didn't have the permission yet from my colleage to send you the dicom image. I'll warn you when I will have it. (Someone thinks it may be linked to the colorimetry but I didnt understand how...)
If you can't provide the files, it would be useful if you could confirm a few details:
- what is the SOPClassUID of the file?
- what is the PhotometricInterpretation?
- what is the TransferSyntaxUID?
- what are the values of Rows, Columns and NumberOfFrames?
I suspect this may be related to #235
After a few local test the bug is coming from #243 (it is set by using pillow 2.9.5) thank you. I had the authorization to send you the image today. Just tell me where I can send it to you.
Also:
what is the SOPClassUID of the file? => 1.2.840.10008.5.1.4.1.1.77.1.6
what is the PhotometricInterpretation? => YBR_FULL_422
what is the TransferSyntaxUID? => 1.2.840.10008.1.2.4.50
what are the values of Rows, Columns and NumberOfFrames? => 256, 256, 6
Sorry I am a little confused by your message. Are you saying that your original bug was due to #243, i.e. the version of pillow? That doesn't seem likely me, and pillow 2.9.5 appears not to exist... Did you rather mean that it was fixed by #242?
You can send the files to cbridge at mgh dot harvard dot edu
P.s. if indeed this is fixed by #242, I understand the cause of the problem and there's no need to send the files
This issue should be resolved in the latest release 0.22.0