imi-bigpicture / wsidicom

Python package for reading DICOM WSI file sets.
Apache License 2.0
33 stars 5 forks source link

Add property to count number of tile frames #116

Closed psavery closed 11 months ago

psavery commented 11 months ago

The "NumberOfFrames" attribute on a dataset takes into account not just the number of frames corresponding to tiles, but also the number of focal planes and optical paths (for example, see here).

When I was trying to view a dataset with multiple optical paths, I would encounter errors in the image_size property since it did not distinguish frames that came from optical paths and tiles.

This PR fixes viewing this example via DICOMweb in large_image.

I am new to the field, so please feel free to correct any naming issues or misconceptions...

erikogabrielsson commented 11 months ago

Looking at the git blame for the logics that is causing trouble with your wsis, I find these commits: Invalid image size handling Tiled full if only one frame Both of these are workarounds for when the dataset is not as expected, compared to the issue you have reported for datasets that are per standard (except for the label with multiple frames). So we should prioritize getting fixing your issue.

I made a branch removing the 'unsafe' properties and added comments on the special handling. With these changes your example (also) works.

I will try to find the wsis I tested which needed the special treatment.

psavery commented 11 months ago

I made a branch removing the 'unsafe' properties and added comments on the special handling. With these changes your example (also) works.

I will try to find the wsis I tested which needed the special treatment.

Sounds good. FYI, the example where I ran into this issue was this one (you can try it with the DICOMwebClient mentioned here, and using the study_uid in that URL). Let me know if I should do anything to help.

erikogabrielsson commented 11 months ago

I made a branch removing the 'unsafe' properties and added comments on the special handling. With these changes your example (also) works. I will try to find the wsis I tested which needed the special treatment.

Sounds good. FYI, the example where I ran into this issue was this one (you can try it with the DICOMwebClient mentioned here, and using the study_uid in that URL). Let me know if I should do anything to help.

I have verified that the changes works for this wsi, and also checked against the files I have locally available. All seems Ok. Thanks for the help.