imi-bigpicture / wsidicom

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

need to read from google cloud bucket #99

Closed zergxyz closed 1 year ago

zergxyz commented 1 year ago

Hello. I need to read those dicom files from the gcp cloud storage bucket. Is there any way I can pass the gs link to the WsiDicom.open() method?

erikogabrielsson commented 1 year ago

Hi @zergxyz What API can be used to access your files in the storage bucket?

zergxyz commented 1 year ago

Hello Erik @erikogabrielsson I am using Apache Beam (Cloud Dataflow) to read DICOM files from the cloud storage buckets. Each file will be read as the binary data and I can also convert them as bytes through DicomBytesIO(dicom_bn) in pydicom. I wish in our wsidicom lib we can implemente something similar to pydicom.dcmread() to accept not only string but also bytes and binaryIO. Or maybe there are some other smater ways to achieve this as well. Thanks

erikogabrielsson commented 1 year ago

There is work in progress to enable reading from streams. The motive has been to enable direct read of encrypted (with crypt4gh) slides stored in S3 buckets, but the same solution should likely also be useful for your use case.

I will clean up the code and make a branch.

erikogabrielsson commented 1 year ago

There is a draft for extending WsiDicom.open() to handle streams here #101

erikogabrielsson commented 1 year ago

Support for handling opened streams is included in #106 .