Closed ChristianMarzahl closed 7 months ago
Hi @ChristianMarzahl and thanks for reporting this issue.
I have worked on a more flexible interface for providing metadata, were one can specify metadata that should override the metadata from the image file as well as metadata that should be used as default if no other metadata is available. This might be worth putting into that.
I dont now what the source file format is (if it is possible, please share the file)? As it is opened by the tiffslide reader, is it supported by tiffslide.?
Dear @erikogabrielsson,
First of all, thank you very much for your quick response. The file was created with the Philips SDK and was converted from .isyntax to TIFF. Unfortunately, I can't share the file, but I will try to create one I can share. It looks like the SDK is not storing any meta information in the resulting tiff file.
Regarding tiffslide:
Yes, the Python package can open the WSI and extract tiles.
Your flexible interface for setting meta data sounds excellent.
Ho @ChristianMarzahl,
The development branches for adding more metadata functionality to wsidicom and wsidicomizer are here and here. With these changes, one can specify a base pixel spacing (either overriding or defaulting), see test.
If you are able to share a test image for from your converter I can test if this works. Otherwise you are free to test it yourself. There is still some work needed before this is released.
Dear @erikogabrielsson,
Thank you for looking into this. It took a little bit longer to figure out that the attached file is anonymous enough to act as a demo I can provide to you: https://drive.google.com/file/d/1nPwvexvbm-2f3rOzsLdNkkumGe-vhVxV/view?usp=sharing
The WSI was converted with Philips SDK from .isyntax to TIFF. We saw this exception with all the examples.
With kind regards, Christian
Thanks for sharing @ChristianMarzahl. I will look into this as soon as possible.
Is the philips converter avaiable somewhere?
Dear @erikogabrielsson,
Yes: https://www.usa.philips.com/healthcare/sites/pathology/about/sdk
By the way. Thank you very much for updating the wsidicomizer.
With kind regards, Christian
Hi @ChristianMarzahl
Short update on this. Using the new metadata
feature in wsidicom and wsidicomizer one can insert missing or override properties, such as pixel spacing:
from wsidicom.geometry import SizeMm
from wsidicom.metadata.image import Image
from wsidicomizer import WsiDicomizer
from wsidicomizer.metadata import WsiDicomizerMetadata
input_file = Path(r'C:\research_data\ISyntaxToTiff.tiff')
image = Image(pixel_spacing=SizeMm(0.00025, 0.00025))
metadata = WsiDicomizerMetadata(image=image)
with WsiDicomizer.open(input_file, default_metadata=metadata) as wsi:
print(f"wsi of size: {wsi.mm_size} and pixel spacing {wsi.pixel_spacing}")
region = wsi.read_region_mm((0, 8), 6, (10, 10))
region
And get:
wsi of size: SizeMm(width=24.064, height=22.784) and pixel spacing SizeMm(width=0.00025, height=0.00025)
This is unfortunately not ready for release, as Im waiting for highdicom
to support Python 3.12. You can however test the feature by installing from git:
git clone
on both repositories. The repositories much be in the same folder.pip install .
in the wsidicomizer
folder.Fixed in 0.12.0. Metadata such as pixel spacing can now be specified if missing.
Dear authors,
Thank you very much for this helpful repository.
Observation
The conversion throws an exception if the PROPERTY_NAME_MPP_X value is not set in a tiff file.
Environment
Possible Solution
Could you set a default value for MPP to enable the conversion with missing values? https://github.com/imi-bigpicture/wsidicomizer/blob/539d18ae1596dd70c6fc1982a2267213cb027b3a/wsidicomizer/sources/tiffslide/tiffslide_image_data.py#L200
With kind regards, Christian