sarafridov / DAB-quant

Quantify DAB staining in immunohistochemistry (IHC) slides
7 stars 0 forks source link

DAB-quant with .tif or .czi #3

Open CharlieMagarey opened 2 weeks ago

CharlieMagarey commented 2 weeks ago

Hi Sara, I'm very excited about trying this tool for our animal model of brain injury.

We scan our slides with a zeiss scanner which gives .czi files. I have also tried running DAB-quant with .tif files and in both cases I get this error (pasted below) relating to openslide compatability, despite .czi and .tif files being compatible with openslide.

Note, I have run the program for the example slides and it has worked.

I would really appreciate any troubleshooting help as I'm new to both python and openslide and not sure where to start.

Thanks!

Error: (py38dabquant) D:\xxx\DAB-quant>python quantify.py --folder=TestSlide --ext=.czi background_threshold is 220 stain_threshold is 0.2 processing TestSlide\STBI005N5.czi Traceback (most recent call last): File "quantify.py", line 280, in slide = openslide.OpenSlide(filename) File "C:\Users\xxx\AppData\Local\miniconda3\envs\py38dabquant\lib\site-packages\openslide__init.py", line 160, in init__ self._osr = lowlevel.open(filename) File "C:\Users\xxx\AppData\Local\miniconda3\envs\py38dabquant\lib\site-packages\openslide\lowlevel.py", line 128, in _check_open raise OpenSlideUnsupportedFormatError( openslide.lowlevel.OpenSlideUnsupportedFormatError: Unsupported or missing image file

sarafridov commented 2 weeks ago

Hi Charlie,

It looks like the error is coming from OpenSlide not being able to read the files. For the .czi files it seems like OpenSlide can only open it if it is not compressed and not a fluorescence image (https://github.com/openslide/openslide/issues/611), so it's possible that is the issue. If you have access to uncompressed .czi files those might have better luck. For the .tif I think it is probably also a preprocessing issue (see https://github.com/btcrabb/SlideSeg/issues/8). There's a little more detail on the file types OpenSlide supports here (and I think also example files for testing): https://openslide.org/formats/

If this is the case I think there are a couple of options. The easiest is if there is a way to get uncompressed files that are compatible with OpenSlide. In theory Zeiss scanners are supported so hopefully this is possible. Otherwise we would need to look for another way to load the files into python, since the rest of DAB-quant just needs to have the pixel values accessible in python.

Sara

CharlieMagarey commented 2 weeks ago

Thanks for such a quick response

My issue with tiff images seems to be a quirk with QuPath, if I export images/slides as an OME TIF they work just fine in DAB-quant/OpenSlide, unless they are quite small (<6mm^2) then open slide doesn't accept them.