Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageFileReader does not instantiate image object (sometimes) #241

Closed
cheyvaert-medexprim opened this issue Jul 4, 2023 · 8 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@cheyvaert-medexprim
Copy link

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.

@CPBridge
Copy link
Collaborator

CPBridge commented Jul 5, 2023

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?

@CPBridge CPBridge self-assigned this Jul 5, 2023
@CPBridge CPBridge added the bug Something isn't working label Jul 5, 2023
@cheyvaert-medexprim
Copy link
Author

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...)

@CPBridge
Copy link
Collaborator

CPBridge commented Jul 14, 2023

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

@CPBridge
Copy link
Collaborator

Could you try the branch on #242 ? (Making sure you have pillow<10.0.0 and >=8.3 installed to avoid #243)

@cheyvaert-medexprim
Copy link
Author

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

@CPBridge
Copy link
Collaborator

CPBridge commented Jul 24, 2023

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

@CPBridge
Copy link
Collaborator

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

@CPBridge
Copy link
Collaborator

This issue should be resolved in the latest release 0.22.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants