Closed 464hee closed 1 year ago
@ap--
This is my code:
from tiffslide import TiffSlide
from openslide import OpenSlide
img_slide = TiffSlide('test.tif')
print(img_slide.properties)
print('-----------------------')
img_slide = OpenSlide('test.tif')
print(img_slide.properties)```
Now I have a new discovery, that is, tifffile is actually parsed, but tiffslide is not correctly obtained, about the interface between tifffile and tiffslide, can a more compatible method be used to obtain the MPP attribute, because the MPP attribute is crucial for a wsi file
new_code:
from tifffile import TiffReader with TiffReader('test.tif') as tif:
for page in tif.pages:
for tag in page.tags:
tag_name, tag_value = tag.name, tag.value
if 'MPP' in str(tag_value).upper():
print(tag_name, tag_value)
<tifffile.TiffTag 270 @829688804> coercing invalid ASCII to bytes
ImageDescription b'Aperio Format Scanned By KFBIO\r\n74004x44269 [0,0 74004x44269] (256x256), JPEG/RGB Q=30|AppMag = 20|MPP = 0.484498|User = KFPBL02000110022|Time = 18:11:07|Time-Used = \x03(:.):\x8d,\x00'
ImageDescription Aperio Format Scanned By KFBIO
37000x21504 [0,0 37000x21504] (256x256), JPEG/RGB Q=30|AppMag = 10|MPP = 0.484498
ImageDescription Aperio Format Scanned By KFBIO
18500x10752 [0,0 18500x10752] (256x256), JPEG/RGB Q=30|AppMag = 5|MPP = 0.484498
ImageDescription Aperio Format Scanned By KFBIO
9250x5376 [0,0 9250x5376] (256x256), JPEG/RGB Q=30|AppMag = 2|MPP = 0.484498
ImageDescription Aperio Format Scanned By KFBIO
4625x2688 [0,0 4625x2688] (256x256), JPEG/RGB Q=30|AppMag = 1|MPP = 0.484498
ImageDescription Aperio Format Scanned By KFBIO
2312x1344 [0,0 2312x1344] (256x256), JPEG/RGB Q=30|AppMag = 0|MPP = 0.484498
ImageDescription Aperio Format Scanned By KFBIO
1156x672 [0,0 1156x672] (256x256), JPEG/RGB Q=30|AppMag = 0|MPP = 0.484498
ImageDescription Aperio Format Scanned By KFBIO
578x336 [0,0 578x336] (256x256), JPEG/RGB Q=30|AppMag = 0|MPP = 0.484498
Hi @464hee
Can you provide some additional background here? Since this seems to be a bug in the KFBIO svs export, I would initially suggest it's better to fix it there, rather then introducing compatibility code in tiffslide. That being said, I'm willing to consider support for this, but I need to understand the circumstances in more detail first.
Cheers, Andreas
Here's the thing, KFBIO has a tool to convert KFB format files to svs, most of the svs files are fine, but a few exist tiffslide can't read mpp, because the conversion code is not officially disclosed, only the conversion tool is provided, so I can't start with the conversion
Except for not reading mpp, reading images is no problem, so I tend to think tiffsilde is compatible, because tifffile and openslide can read out MPP normally for this case, and I hope tiffsilde becomes more powerful and useful.
As far as I know, KFB occupies some users in pathology images, the reason is that their scanning equipment is cheap and good, some hospitals in China have sampled the equipment for scanning to generate KFB files, but SVS is the common format, so the company provides KFB to SVS service for users, maybe they also have some problems, I personally can't communicate with the company to get changes, forgive my lack of ability
Here's the thing, KFBIO has a tool to convert KFB format files to svs, most of the svs files are fine, but a few exist tiffslide can't read mpp, because the conversion code is not officially disclosed, only the conversion tool is provided, so I can't start with the conversion
No changes can be made to the conversion code because the tool code is not publicly available
Thank you for the information @464hee!
I contacted KFBIO and informed them about their broken converter. I'll update this issue when they reply.
I also implemented workarounds in #67. It would be great if you could test the tiffslide version in that branch, and provide me with feedback.
Cheers, Andreas
I've merged this for now, and will prepare a new release in the next days. KFBIO is aware of the bug. So it's up to them to provide a fix. In the meantime the PR will support broken files.
Cheers, Andreas 😃
I have a tif file in which the mpp read using openslide is fine, but the mpp read in tiffslide is 'tiffslide.mpp-x': None, with the warning. <tifffile.TiffTag 270 @829688804> coercing invalid ASCII to bytes <tifffile.TiffTag 270 @829688804> coercing invalid ASCII to bytes
Is it because tiffslide still has some decoding deficiencies that cause it to fail to read out the mpp properly?
Here is the link to my file: https://drive.google.com/file/d/1ctw5-oxXxtXYdGXnSO-AFFcW5OuMm8eV/view?usp=share_link