Bayer-Group / tiffslide

TiffSlide - cloud native openslide-python replacement based on tifffile
Other
84 stars 12 forks source link

Support for DICOM #32

Open sarthakpati opened 2 years ago

sarthakpati commented 2 years ago

Hey,

It would be great to add the ability to support WSI DICOM. There is a very nice library called wsidicom that takes care of it in a nice way.

Cheers, Sarthak

ap-- commented 2 years ago

Hi @sarthakpati

Thanks for suggesting 😃 I'll put it on the list. But it's low priority right now. Contributions would be super welcome ❤️

Cheers, Andreas

sarthakpati commented 2 years ago

Yup, it is the same on our side. I'll put this on our list, too. 😄Will coordinate here.

benmalef commented 1 week ago

Hey, I hope you are doing well. We have had a little discussion with @sarthakpati about WSI DICOM support.
I would like to contribute to this feature. 😄 Any guidance or help would be greatly appreciated

Cheers, Veniamin

ap-- commented 1 week ago

Hi @benmalef and @sarthakpati

Thank you for offering to contribute! It's been a long time since I've looked into DICOM support.

The basic idea for supporting file formats that can not be read by tifffile, is to provide an Array like interface to the new format, which then lazily loads only the data needed to return a specific slice. If the reader that provides this interface can work on file-like objects you get cloud support for free.

You can look at the open draft PR for mirax support, where I use kerchunk to build an index for reading the compressed image data via zarr. You could do something similar for DICOM I suppose. Another option is to look at something like pydicom, and see if it either provides that array interface, or if it can be wrapped to do so. In the end what you should try is to have the pyramidal image stack for the main image as the zarr_group attribute. For some formats it's pretty trivial to write the ZarrStore interface that can then be loaded as a zarr group.

I'm happy to give feedback on PRs, but can't guarantee prompt answers due to other projects having priority right now.

Also let me know if you need more information to get started.

Cheers, Andreas ☺️

ap-- commented 1 week ago

Just pinging for awareness:

On the Bayer side @sdvillal @wolny -- is there someone to provide more immediate feedback for this these days?

Or does BigPicture have an interest in support for DICOM here @erikogabrielsson ?

wolny commented 5 days ago

From my side I'd also be happy to provide feedback on PRs.

Simple solution would be to add wsidcom or pydicom as dependency and provide an adapter which is compatible with tiffslide/openslide API, see: https://github.com/imi-bigpicture/wsidicom?tab=readme-ov-file#api-differences-between-wsidicom-and-openslide.

sarthakpati commented 5 days ago

@wolny: could you perhaps give an example of an existing adapter on tiffslide for @benmalef to build upon?